You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 865c1ef
Browse filesBrowse the repository at this point in the historyBrowse files
fix(python): key .gen-state by the project, not by --out
The manifest lives at the project root — `<project>/.metaobjects/.gen-state`,
anchored on the metadata directory's parent, deliberately and matching C#. Its
KEYS were relative to `--out`. So two runs with different `--out` shared ONE
manifest keyed by names that mean different files: `gen --out a` and `gen --out
b` both record `Program.py`, and whichever ran last decided whether the other
run's file still counted as ours.
That manifest is the only thing that can tell "this is exactly what I wrote"
from "somebody edited this" on a machine that did not generate the code. One
that can be populated from an unrelated tree and keyed ambiguously is one that
can say yes to the wrong file. The multi-target path (#267) has the same shape
by construction: every target writes its own outDir and they all share one
gen-state dir. TypeScript keys project-root-relative, which is what makes
multiple targets work there.
Keys are now relative to the project. The old spelling is read as a FALLBACK
and dropped once each file is recorded under the new key, so an existing
manifest keeps working and converges with no migration command — re-keying with
no fallback is fail-closed (`gen` REFUSES a now-unrecorded file) and the wrong
cost to impose on adopters for a change they did not ask for.
`verify --codegen`'s jurisdiction guard reads the same manifest and had to move
with it. That half fails in the direction nothing notices: a lookup that finds
nothing makes every file "not ours", so the `extra` verdict silently empties
while the gate still prints `in sync`. Reproduced exactly — the break-probe run
printed "in sync (0 file(s))" over stale committed output.
The report that found this also claimed `_record` replaces the manifest
wholesale (21 entries → 6). Not reproducible from the code: `_record` loads and
adds. Only the keying was wrong.
Gates: the keying and the legacy fallback as units; the key shape, the two-out-
dir case and the `extra` conviction end to end through the CLI, because the
keying is decided in three places and a unit test of any one passes while the
other two disagree. `test_verify_codegen_ignores_a_file_it_never_wrote` covered
only the negative direction and would have stayed green throughout.
Migration guide §13. No metadata contract changes; `metamodelVersion` unmoved.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NTcEKXTQMYt84fAjuw5A2M
0 commit comments