Skip to content

Save a KiteUtils log with its system definition, and read it back from the loaded log - #50

Open
1-Bort-1 wants to merge 1 commit into
mainfrom
agent/KiteModels.jl-322
Open

1-Bort-1 wants to merge 1 commit into
mainfrom
agent/KiteModels.jl-322

Conversation

@1-Bort-1

Copy link
Copy Markdown
Member

A simulation log can carry the system it was recorded on, so a viewer can draw it without the model. Until now each package that wanted this had to write the definition into the log metadata as JSON under the right key, and a reader had to dig the string out of the loaded log again. Now saving a log with a system definition does both: the definition goes in, and one call on the loaded log reads it back.

save_log(logger, "run"; metadata=Dict("topology" => to_json(system)))   # before
KiteGeometry.definition(load_log("run").metadata["topology"])

save_log(logger, system, "run")                                        # after
KiteGeometry.definition(load_log("run"))

The new save method takes the same path, compression, column metadata and extra metadata as KiteUtils' own. The extra metadata is kept beside the definition. KiteGeometry already depends on KiteUtils, so this adds no dependency, and it extends KiteUtils' function only for KiteGeometry's own type.

OpenSourceAWE/KiteModels.jl#327 uses both methods to save the KPS3 and KPS4 definition with each log. It needs a KiteGeometry release after v0.1.0 that contains this change.

Verification

  • Reproduced first: n/a, new feature.
  • test/test-log.jl red before (MethodError: the logger's save_log took the definition as the log name), green after: 2/2 (juliaserver, Julia 1.13.0).
  • Full suite: Authoring 443, Log 2, Structure 137, all pass.
  • Docs build clean. Both docstrings render under the new Logs section.
  • REUSE lint: not run locally (no reuse on the box). The new test file carries its SPDX header, and changelog.d/*.md is covered by the glob in REUSE.toml.
  • Benchmark: n/a.
  • Risk: a log saved this way whose metadata already holds a topology key gets it overwritten by the definition.

Opened by 1-Bort-1, an AI agent working for @1-Bart-1.
From OpenSourceAWE/KiteModels.jl#322 · task KiteModels.jl-322

save_log(logger, system, name) writes the SystemDefinition into the log
metadata under topology; definition(log) reads it from a loaded SysLog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants