feat(swing-sim): land variation execution-metadata orphaned by the slice pivot - #4529
Merged
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…ice pivot The 34-PR variation consolidation (#4447) is being superseded piecemeal: main is absorbing that campaign as slices, so #4447 will likely never merge. These files were left with no route onto main. They exist on `consolidated/variation-morris-2026-08-13` and on two closed-unmerged codex branches (#4428, #4431); the sibling consolidation #4466 does not carry them. Adds the execution-metadata sidecar that pins what a variation plan actually ran against -- resolved variable values with unit and dimension semantics, RNG algorithm and stream-derivation identity, and solver / runtime implementation identity -- so a historical plan can be replayed with its reproducibility either proven or explicitly refused. variation/_execution_metadata_schema.py 75 LOC (new) variation/execution_metadata.py 477 LOC (new) variation/tests/test_execution_metadata.py 300 LOC (new) Scope is larger than the three new files because the claim that this slice's dependencies were already on main was package-scoped and wrong. Verified against origin/main rather than assumed: * variation/spec.py has no MAX_SAFE_INTEGER, so execution_metadata raised ImportError at its import line -- the module was not merely untested on main, it could not be loaded at all. * variation/registry.py has no VariableDef.dimension, which failed 20 of 26 tests with AttributeError. * The four variation_execution_document_*.json fixtures the tests read live outside the package, under src/rate_of_closure/web/src/model/__fixtures__/, so counting the variation/** files could not see them. So spec.py (+40/-10) and registry.py (+30) come along, adding the safe-integer bound on n_runs and seed, signed-zero JSON normalisation, and the registry dimension field. Also removes a dead duplicate __all__ in execution_metadata.py, an artifact of splitting the schema module out: the file carried two assignments and the second silently won, leaving the first eight-name block unreachable. Its names are a strict subset of the survivor, so no export changes; all 21 remaining names verified to resolve. scripts/benchmark_rate_ensemble_archive.py is deliberately excluded. It imports ensemble_archive, ensemble_request_identity and ensemble_trace_authority -- three of fifteen rate_of_closure/variation modules absent from main -- and belongs to a separate ensemble-archive slice. Verified: 26 execution-metadata tests pass; 265 variation and 1183 swing_sim tests pass with no regressions from the spec/registry changes. Part of #4142 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
dieterolson
force-pushed
the
port/swing-sim-variation-execution-metadata
branch
from
August 18, 2026 07:22
d3abcc9 to
d6bb21a
Compare
dieterolson
enabled auto-merge (squash)
August 18, 2026 07:31
… main Two things, neither of them a defect in the ported code. 1. quality-gate failed at "Type Check (Mypy)" with a single error: `variation/registry.py:404: error: Returning Any`. That function is PRE-EXISTING and byte-identical on main (line 374 there) -- this PR did not introduce it. It surfaced only because CI runs mypy on CHANGED FILES ONLY, so putting registry.py into a diff exposed a latent error that main never checks. The cause is a delta-CI artifact rather than a real typing problem: the delegate `registry_mode_policy.keys_for_mode` IS annotated `-> tuple[str, ...]`, but it is not among the changed files, so with `ignore_missing_imports` its import resolves to `Any` and returning that directly trips `warn_return_any`. Fixed by binding to an annotated local, which narrows a value that genuinely has that type rather than asserting something untrue. Verified: zero mypy errors across all four ported files. 2. Re-synced onto main after #4527 and #4528 merged, which collided in SPEC.md's Change Log. Main's max is now 1.17.29, and this branch had also claimed 1.17.28 -- a straight union produced TWO rows at 1.17.28. Renumbered this change to 1.17.30 and re-sorted the 2026-08-18 block version-descending; verified four rows, zero duplicate versions. Edited in binary mode so the file's CRLF endings survive (6134 CRLF, 0 bare LF). Part of #4142 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #4142
Why these files had no route in
The 34-PR variation consolidation (#4447) is being superseded piecemeal —
mainis absorbing that campaign as slices, so #4447 will likely never merge. That left this work stranded:consolidated/variation-morris-2026-08-13,What this adds
The execution-metadata sidecar that pins what a variation plan actually ran against — resolved variable values with unit and dimension semantics, RNG algorithm and stream-derivation identity, and solver/runtime implementation identity — so a historical plan can be replayed with its reproducibility either proven or explicitly refused. Legacy plans without a sidecar resolve against the current registry behind an explicit warning rather than silently claiming reproducibility.
variation/_execution_metadata_schema.pyvariation/execution_metadata.pyvariation/tests/test_execution_metadata.pyWhy the scope is 9 files and not 3
The premise that this slice's dependencies were already on
mainwas package-scoped and wrong in three ways. Each was verified againstorigin/mainrather than assumed:variation/spec.pyhas noMAX_SAFE_INTEGER.execution_metadataraisedImportErrorat its import line — the module was not merely untested onmain, it could not be loaded at all.variation/registry.pyhas noVariableDef.dimension, which failed 20 of 26 tests withAttributeError.variation_execution_document_*.jsonfixtures live outside the package, undersrc/rate_of_closure/web/src/model/__fixtures__/— so counting the 40variation/**files could not see them.So
spec.py(+40/−10) andregistry.py(+30) come along, adding the safe-integer bound onn_runs/seed, signed-zero JSON normalisation, and the registry dimension field. This is the minimum coherent set: it was determined empirically, not guessed — adding these is exactly what turns the suite from 20 failures into 26 passes.Dead
__all__removedexecution_metadata.pycarried two__all__assignments (an artifact of splitting the schema module out) and the second silently won, leaving the first eight-name block unreachable. Those eight names are a strict subset of the survivor, so no export changes; all 21 remaining names were verified to resolve.Deliberately excluded
scripts/benchmark_rate_ensemble_archive.pyis not in this PR. It importsensemble_archive,ensemble_request_identityandensemble_trace_authority— three of fifteenrate_of_closure/variationmodules absent frommain— and belongs to a separate ensemble-archive slice. Landing it here would add a script that cannot import.Gates
No regressions from touching the two shared modules: 265
variationtests and 1183swing_simtests pass.One inherited red:
ruff format --checkpython -m ruff format --check .reports 4 files — allsrc/data_processing/..., none touched here. This fails onmaintoday, so every open PR inherits it. Addressed separately in #4525, which should merge first; this branch then goes green. My own files are clean:tests/rate_of_closure/also has ~8 pre-existing flaky failures (Qt/perf tests under the-n autoxdist config). Confirmed unrelated: the same failures occur on a cleanmainbaseline, and the failing set differs run-to-run.