Skip to content

feat(codegen): skip gen when nothing changed, in every port - #585

Merged
dmealing merged 12 commits into
release/1.2from
fm/mo-codegen-skip-1-2
Nov 15, 2026
Merged

dmealing merged 12 commits into
release/1.2from
fm/mo-codegen-skip-1-2

Conversation

@dmealing

@dmealing dmealing commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

What Changed

  • gen in every port (TypeScript, Python, C#, Java, Kotlin) computes a skip key from the loaded model and the generator inputs (ADR-0062), before anything renders. When the key matches the last successful run and every generated file still matches its record, the run renders and writes nothing. The key is stored in .metaobjects/.gen-state/.fingerprint-<port>.json, --force regenerates everything, and a local verify --codegen answers "no drift" from the same key (CI and --full still render and compare). When it does render, the rendered bytes are compared with disk in memory.
  • The hash manifest (.metaobjects/.gen-state/.hashes.json) is loaded once and saved once per run, and only when an entry changed. TypeScript, Python and C# previously rewrote it per file. A file whose fresh bytes already equal what is on disk is no longer rewritten, so its timestamp is preserved.
  • TypeScript runs git merge-file only for a file edited by hand since it was generated, and deletes its merge temporary files in every case (under $DEV_SCRATCH when set).
Validation

Risk Assessment

✅ Low: The only change since the starting head is a narrow docs-site fix: the raw metadata source roots join the skip key, so a comment-only edit makes gen render again. The earlier refused-orphan fix is also correct. I found no defect in either, but I did not re-read the rest of the large branch in this round.

Testing

The TypeScript and Python CLIs were driven live against disposable projects built under $DEV_SCRATCH. The TypeScript CLI ran from worktree source through bun, not the built dist. Every scenario the ADR says must render did render, and the no-change run skipped with the render counter and output mtimes unchanged. Local verify --codegen answered without rendering after a no-change run, and CI=1 rendered. The adversarial cases also passed: an edited orphan the sweep refuses stores no key, an output outside the project root is restored when deleted, and a comment-only docs-site edit reaches the published page. Java/Kotlin and C# were not driven live. The regression suite did not complete: the TypeScript server bun test was killed before reporting, and the Python unit run was stopped at about 5% with three environment-only failures. The baseline ts-fast and ts-unit lanes passed. Verdict is inconclusive because a required regression check has no result. Separately, my process cleanup killed six bun test --shard=N/6 processes that this step did not start.

  • Live validation: ⚠️ inconclusive - 19 of 23 scenarios driven live against the product
Scenario Result Live Evidence
TS: first meta gen writes generated files and stores a skip key ✅ pass live live-transcripts.txt; TS project under $DEV_SCRATCH: gen wrote Order.ts and mine.txt, .fingerprint-typescript.json created
TS: no-change meta gen skips: no render, outputs and .hashes.json mtimes unchanged ✅ pass live Command output: 'nothing changed ... nothing was rendered or written', skipped: true; render counter stayed at 1; mtimes unchanged
TS: local verify --codegen after no change answers without rendering; CI=1 renders ✅ pass live Local verify: 'nothing changed since the last meta gen ... no codegen drift', render counter unchanged; CI=1 verify: render counter incremented
TS: reformatted metadata (child order kept) plus an unrelated README edit skips ✅ pass live live-transcripts.txt, section 'TS S3 pure reformat'
TS: metadata edit adds a field, gen renders and the field appears in output ✅ pass live Command output: Order.ts overwrite, render counter +1, grep finds customerNote in generated/Order.ts
TS: declared extra input edited, gen renders and mine.txt updates ✅ pass live Command output: render counter +1; generated/mine.txt contains 'extra two'
TS: hand-edited generated file makes gen render and merge (edit kept), not skip ✅ pass live Command output: 'generated/Order.ts,merged', render counter +1, hand edit still at end of file
TS: generated file deleted, gen restores it ✅ pass live Command output: 'generated/mine.txt,new', render counter +1, file restored
TS: gen --force with nothing changed renders ✅ pass live Command output: render counter +1 (--force renders even though nothing changed)
TS: stored fingerprint deleted (fresh clone) makes gen render ✅ pass live Command output: render counter +1
TS: metadata file added makes gen render and write the new entity ✅ pass live Command output: 'generated/Customer.ts,new', render counter +1
TS adversarial: edited orphan whose entity was removed, sweep refused -> no key stored, next gen renders and re-warns ✅ pass live live-transcripts.txt, section 'TS S12': fingerprint ABSENT after run 1, run 2 rendered (render counter +1) and repeated the 'NOT deleted' warning
TS adversarial: output outside project root (outDir ../outside2), fresh project -> no-change skip; deleted outside file -> render and restore ✅ pass live live-transcripts.txt, section 'TS outside-root' (f2 skipped, f3 '1 written, 1 unchanged' with render counter +1)
TS adversarial: docs-site wired, comment-only YAML edit above a template.output payload object -> render, output page updated; no-change control skips ✅ pass live live-transcripts.txt, section 'TS docs-site': control skipped; after the comment edit, '1 written, 11 unchanged' and docs-out/site/shop/summaryOut.html contains the revised comment
TS: hand edit after the last gen, then local verify --codegen renders and classifies it ✅ pass live Command output: render counter +1 with 'generated/Order.ts carry hand edits' notice
Python live: first metaobjects gen, then no-change run skips with output and manifest mtimes unchanged ✅ pass live live-transcripts.txt, section 'Python live' P1/P2: 'nothing changed since the last run, so nothing was generated', mtimes unchanged
Python live: metadata edit makes gen render and the new field appears ✅ pass live live-transcripts.txt, section 'Python live' P3: generated/Author.py contains 'bio'
Python live: hand-edited generated file makes gen refuse, not skip ✅ pass live live-transcripts.txt, section 'Python live' P4: 'Refused to overwrite Author.py: it has been edited since it was generated' (exit 1); not a skip
Python live: gen --force on clean output renders (no 'nothing changed') ✅ pass live live-transcripts.txt, section 'Python live' P6c: 'wrote 0 file(s) across 1 target(s), 2 unchanged'
Java/Kotlin live: maven-plugin skip, force and verify behaviour ⏸️ untested no Not driven in this run. I did not run mvn -o in server/java/maven-plugin, nor the GenSkipConformanceTest or RefusedOrphanSkipTest runners. The time budget went to the TS and Python live drives. The…
C# live: dotnet meta gen skip, force and verify behaviour ⏸️ untested no Not driven in this run. I did not build or run server/csharp MetaObjects.Cli or GenSkipConformanceTests (dotnet test). Dotnet is on PATH, so this was a time-budget decision, not a missing tool.
Regression: full TypeScript server suite ⏸️ untested no bun test in server/typescript was started in the background and killed before it reported a result, so its outcome is unknown. Required check outstanding; see the regression-incomplete finding.
Regression: full Python unit suite ⏸️ untested no Run stopped before completion. The three failures come from running with PYTHONPATH and no install, not from the change. Full result unknown. Integration tests need pg8000 and a Postgres container, wh…
Evidence: Live CLI transcripts for TS and Python ADR-0062 scenarios (S3, S12, outside-root, docs-site, Python P1 to P6)
# ADR-0062 live transcripts. TS: meta CLI from worktree source (bun). Python: metaobjects CLI from worktree src.
# TS project: one entity (Order), plus owned probe generator 'mine' that appends a line to renders.log on each render.

\### TS S3 pure reformat (child order kept) + unrelated README edit: expect skip
gen: []
summary: "nothing changed since the last meta gen, so nothing was rendered or written"
help[1]: meta gen --force regenerates everything
antiPatterns:
  status: skipped
  note: "not run: nothing changed since the last meta gen"
  total: 0
  rows: []
skipped: true
upToDate: 2

\### TS S12 refused orphan: run 1 (orphan edited, kept) and run 2 (must re-render, must re-warn)
-- run1
meta: meta gen: 1 generated file(s) are no longer generated but have been edited by hand, so they were NOT deleted: generated/Order.ts. Delete each one, or, if what produced it was renamed, move your edits into the newly generated file first and then delete it (regeneration cannot follow a rename).
gen[2]{file,status}:
  generated/Customer.ts,new
  generated/mine.txt,unchanged
summary: "1 written, 1 unchanged"
help[2]: typecheck the generated code with `npx tsc`,create your database tables with `meta migrate --from-db --db <url> --dialect sqlite --slug init --apply`
antiPatterns:
  status: ran
  total: 0
  rows: []
warnings[1]: "meta gen: 1 generated file(s) are no longer generated but have been edited by hand, so they were NOT deleted: generated/Order.ts. Delete each one, or, if what produced it was renamed, move your edits into the newly generated file first and then delete it (regeneration cannot follow a rename)."
-- run2
meta: meta gen: 1 generated file(s) are no longer generated but have been edited by hand, so they were NOT deleted: generated/Order.ts. Delete each one, or, if what produced it was renamed, move your edits into the newly generated file first and then delete it (regeneration cannot follow a rename).
gen[2]{file,status}:
  generated/Customer.ts,unchanged
  generated/mine.txt,unchanged
summary: 2 unchanged
help[1]: typecheck the generated code with `npx tsc`
antiPatterns:
  status: ran
  total: 0
  rows: []
warnings[1]: "meta gen: 1 generated file(s) are no longer generated but have been edited by hand, so they were NOT deleted: generated/Order.ts. Delete each one, or, if what produced it was renamed, move your edits into the newly generated file first and then delete it (regeneration cannot follow a rename)."

\### TS outside-root project (outDir ../outside2): f1 first, f2 no-change expect skip, f3 deleted output expect re-render
-- f2
gen: []
summary: "nothing changed since the last meta gen, so nothing was rendered or written"
help[1]: meta gen --force regenerates everything
antiPatterns:
  status: skipped
  note: "not run: nothing changed since the last meta gen"
  total: 0
  rows: []
skipped: true
upToDate: 0
-- f3
meta: 2 generated file(s) were written outside the project root and are not recorded in .metaobjects/.gen-state/.hashes.json, so hand-edit protection does not apply to them: a later run overwrites them without checking for edits.
gen[2]{file,status}:
  ../outside2/Order.ts,unchanged
  ../outside2/mine.txt,new
summary: "1 written, 1 unchanged"
help[1]: typecheck the generated code with `npx tsc`
antiPatterns:
  status: ran
  total: 0
  rows: []
warnings[1]: "2 generated file(s) were written outside the project root and are not recorded in .metaobjects/.gen-state/.hashes.json, so hand-edit protection does not apply to them: a later run overwrites them without checking for edits."

\### TS docs-site (payload output page): ds2b no-change control, ds3b comment-only edit above the payload object expect render
-- ds2b
gen: []
summary: "nothing changed since the last meta gen, so nothing was rendered or written"
help[1]: meta gen --force regenerates everything
antiPatterns:
  status: skipped
  note: "not run: nothing changed since the last meta gen"
  total: 0
  rows: []
skipped: true
upToDate: 12
-- ds3b
meta: warning: ERR_UNKNOWN_ATTR: Unknown attribute '@dataflow' on template.output 'summaryOut' — not declared by any registered provider for template.output
  in meta.shop.yaml at $['metadata.root'].children[2]['template.output']
meta: warning: meta gen loads leniently and generated anyway, but `meta verify` rejects this metadata (ADR-0023): fix or remove the attribute — a typo'd one (`isAbstrakt`, `@requird`) silently changes what is generated. `meta gen --strict` stops the run instead.
gen[12]{file,status}:
  out/Order.ts,unchanged
  out/Summary.ts,unchanged
  docs-out/site/index.html,unchanged
  docs-out/site/enums.html,unchanged
  docs-out/site/shop/index.html,unchanged
  docs-out/site/shop/Order.html,unchanged
  docs-out/site/shop/Summary.html,unchanged
  docs-out/site/shop/summaryOut.html,overwrite
  docs-out/site/coverage.html,unchanged
  docs-out/site/assets/site.css,unchanged
  docs-out/site/assets/site.js,unchanged
  docs-out/site/assets/search-index.json,unchanged
summary: "1 written, 11 unchanged"
help[1]: typecheck the generated code with `npx tsc`
antiPatterns:
  status: ran
  total: 0
  rows: []
warnings[2]: "ERR_UNKNOWN_ATTR: Unknown attribute '@dataflow' on template.output 'summaryOut' — not declared by any registered provider for template.output\n  in meta.shop.yaml at $['metadata.root'].children[2]['template.output']","meta gen loads leniently and generated anyway, but `meta verify` rejects this metadata (ADR-0023): fix or remove the attribute — a typo'd one (`isAbstrakt`, `@requird`) silently changes what is generated. `meta gen --strict` stops the run instead."

\### Python live: P1 first, P2 no-change expect skip, P3 metadata edit expect render, P4 hand edit expect refusal not skip, P6 restore then no-change and --force
-- p1.out
/mnt/scratch/mo-skip-live/pyproj/generated/Author.py
/mnt/scratch/mo-skip-live/pyproj/generated/__init__.py
metaobjects gen: wrote 2 file(s) across 1 target(s).
-- p2.out
metaobjects gen: nothing changed since the last run, so nothing was generated (pass --force to regenerate).
-- p3.out
/mnt/scratch/mo-skip-live/pyproj/generated/Author.py
metaobjects gen: wrote 1 file(s) across 1 target(s), 1 unchanged.
-- p4.out
metaobjects gen: FAILED — 1 file(s) refused (see the warnings above; `--baseline=adopt` records what you have and writes nothing)
warning: Refused to overwrite Author.py: it has been edited since it was generated, or there is no record of generating it. Move your edits into a non-generated file, or delete it to accept fresh output.
metaobjects gen: wrote 0 file(s) across 1 target(s), 1 unchanged.
-- p6b.out
metaobjects gen: nothing changed since the last run, so nothing was generated (pass --force to regenerate).
-- p6c.out
metaobjects gen: wrote 0 file(s) across 1 target(s), 2 unchanged.
  • Outcome: ⚠️ 4 issues (3 warnings, 1 info) across 1 run (20m30s)

Live end-to-end scenarios (run by hand on the pushed head, after the PR opened)

Both scenarios ran against the canonical fitness model (fixtures/persistence-conformance/canonical/meta.fitness.json), with each tool built from this branch's head.

Maven plugin (mvn metaobjects:generate / metaobjects:verify, Java + Kotlin generators)

# Step Result
1 first generate renders, exit 0
2 generate, nothing changed skips: "nothing changed since the last run, so nothing was generated", exit 0
3 generate -Dmetaobjects.force=true renders (all 3 generators execute), exit 0
4 local verify, nothing changed answers from the key: "no drift (no input changed since the last generate and no generated file was edited)", exit 0
5 verify with CI=true renders in memory, "No codegen drift detected", exit 0
6 local verify -Dmetaobjects.verify.full=true renders in memory, no drift, exit 0
7 local verify after a hand edit to a generated file renders, reports [content-differs] on that file, BUILD FAILURE (exit 1)
8 generate after the hand edit does not skip; refuses to overwrite the edited file (handEdits: keep)
9 generate after a metadata edit (@maxLength) does not skip; all 3 generators execute
10 generate after reverting the metadata renders back; the next generate skips again

C# (dotnet meta gen / dotnet meta verify --codegen, owned generator list)

# Step Result
1 gen --force renders, "0 file(s) written" (identical bytes not rewritten)
2 gen, nothing changed skips: "nothing changed since the last run; skipped (use --force to regenerate)"; no generated file's mtime changed
3 gen --force renders, 0 files written
4 local verify --codegen, nothing changed "OK (nothing changed since the last gen; --full renders and compares)", exit 0
5 verify --codegen with CI=true renders: "OK (generated output is in sync)", exit 0
6 local verify --codegen --full renders: "OK (generated output is in sync)", exit 0
7 local verify --codegen after a hand edit to a generated file "drift (1 file(s) differ from a fresh regen)", naming the file, exit 1
8 gen after the hand edit does not skip; refuses to overwrite the edited file, exit 1
9 gen after a metadata edit (@maxLength) does not skip; "6 file(s) written"
10 gen after reverting the metadata "6 file(s) written"; the next gen skips again

All 20 steps behaved as expected.

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found → auto-fixed ✅
  • ⚠️ server/typescript/packages/cli/src/lib/gen-fingerprint.ts:347 - TypeScript can skip a run it should render, which is the unsafe direction ADR-0062 §3 forbids. The docs-site generator reads raw YAML metadata files through its own scan, and the skip key does not cover that read. harvestComments in docs-site/src/yaml-comments.ts walks every *.yaml/*.yml under ctx.sourceRoots and turns the # comment above an - object.*: line, and the trailing # ... on a field.* line, into the description and note text in the output-payload pages (builders/output-data.ts:34,45). computeGenInputs hashes only .mustache files under the source roots (line 347 onward). The model half hashes the loaded model, which carries no comments. docsSiteFile declares inputs only for prompts. Concrete sequence: a project wires docsSiteFile() and runs meta gen, which stores the key. Someone edits only the comment above a payload object in meta.*.yaml, with no description attribute. The loaded model is unchanged, the key matches, and decideGenSkip returns skip. The next gen prints 'nothing changed', and meta verify --codegen answers no drift locally through decideVerifyNoDrift. The docs page is stale. The shared-model generator is not affected: it re-loads the same source files, so the model hash already covers it. Smallest fix: hash the .yaml/.yml files under the source roots as raw entries next to the .mustache ones (an over-count is the safe direction). If a comment-only edit must not change the key, mark docs-site cache: false instead. Add a test where a comment-only edit makes gen render when docs-site is wired.

🔧 Fix applied.
✅ Re-checked - no issues remain.

⚠️ **Test** - 4 issues (3 warnings, 1 info)
  • ⚠️ server/typescript/packages/cli/src/commands/gen.ts:425 - Regression suite is incomplete. The TypeScript server bun test run (server/typescript) was killed before it reported a result, and the Python unit run was stopped at about 5%. Java/Kotlin, C# and Python integration suites were not run. The change cannot be cleared as regression-safe from this step. The outer executor should run the conventional full command (scripts/ci-local.sh, or the server test suite) to completion.
  • ⚠️ n/a (host process state) - While stopping this step's background suites, I killed six bun test --timeout 60000 --shard=N/6 processes (PIDs 3961618 to 3961624 range, shards 1 to 6) that this step did not start. They look like a separate run on this machine. Their results are lost. Whoever owns them should check whether they need rerunning.
  • ℹ️ server/typescript/packages/cli/src/lib/gen-fingerprint.ts:426 - When an existing project moves outDir from inside the project to outside, its stale manifest entries (recorded paths that no longer exist) make writeStoredFingerprint return early, so no key is ever stored and every run renders. This is the safe direction and performance only, with no wrong skip. I observed it in a copied project and did not find an automatic cleanup of stale manifest entries.
  • ⚠️ live validation verdict: inconclusive (19 of 23 scenarios were driven live against the product); untested: Java/Kotlin live: maven-plugin skip, force and verify behaviour, C# live: dotnet meta gen skip, force and verify behaviour, Regression: full TypeScript server suite, Regression: full Python unit suite
  • Live validation: ⚠️ inconclusive - 19 of 23 scenarios driven live against the product
Scenario Result Live Evidence
TS: first meta gen writes generated files and stores a skip key ✅ pass live live-transcripts.txt; TS project under $DEV_SCRATCH: gen wrote Order.ts and mine.txt, .fingerprint-typescript.json created
TS: no-change meta gen skips: no render, outputs and .hashes.json mtimes unchanged ✅ pass live Command output: 'nothing changed ... nothing was rendered or written', skipped: true; render counter stayed at 1; mtimes unchanged
TS: local verify --codegen after no change answers without rendering; CI=1 renders ✅ pass live Local verify: 'nothing changed since the last meta gen ... no codegen drift', render counter unchanged; CI=1 verify: render counter incremented
TS: reformatted metadata (child order kept) plus an unrelated README edit skips ✅ pass live live-transcripts.txt, section 'TS S3 pure reformat'
TS: metadata edit adds a field, gen renders and the field appears in output ✅ pass live Command output: Order.ts overwrite, render counter +1, grep finds customerNote in generated/Order.ts
TS: declared extra input edited, gen renders and mine.txt updates ✅ pass live Command output: render counter +1; generated/mine.txt contains 'extra two'
TS: hand-edited generated file makes gen render and merge (edit kept), not skip ✅ pass live Command output: 'generated/Order.ts,merged', render counter +1, hand edit still at end of file
TS: generated file deleted, gen restores it ✅ pass live Command output: 'generated/mine.txt,new', render counter +1, file restored
TS: gen --force with nothing changed renders ✅ pass live Command output: render counter +1 (--force renders even though nothing changed)
TS: stored fingerprint deleted (fresh clone) makes gen render ✅ pass live Command output: render counter +1
TS: metadata file added makes gen render and write the new entity ✅ pass live Command output: 'generated/Customer.ts,new', render counter +1
TS adversarial: edited orphan whose entity was removed, sweep refused -> no key stored, next gen renders and re-warns ✅ pass live live-transcripts.txt, section 'TS S12': fingerprint ABSENT after run 1, run 2 rendered (render counter +1) and repeated the 'NOT deleted' warning
TS adversarial: output outside project root (outDir ../outside2), fresh project -> no-change skip; deleted outside file -> render and restore ✅ pass live live-transcripts.txt, section 'TS outside-root' (f2 skipped, f3 '1 written, 1 unchanged' with render counter +1)
TS adversarial: docs-site wired, comment-only YAML edit above a template.output payload object -> render, output page updated; no-change control skips ✅ pass live live-transcripts.txt, section 'TS docs-site': control skipped; after the comment edit, '1 written, 11 unchanged' and docs-out/site/shop/summaryOut.html contains the revised comment
TS: hand edit after the last gen, then local verify --codegen renders and classifies it ✅ pass live Command output: render counter +1 with 'generated/Order.ts carry hand edits' notice
Python live: first metaobjects gen, then no-change run skips with output and manifest mtimes unchanged ✅ pass live live-transcripts.txt, section 'Python live' P1/P2: 'nothing changed since the last run, so nothing was generated', mtimes unchanged
Python live: metadata edit makes gen render and the new field appears ✅ pass live live-transcripts.txt, section 'Python live' P3: generated/Author.py contains 'bio'
Python live: hand-edited generated file makes gen refuse, not skip ✅ pass live live-transcripts.txt, section 'Python live' P4: 'Refused to overwrite Author.py: it has been edited since it was generated' (exit 1); not a skip
Python live: gen --force on clean output renders (no 'nothing changed') ✅ pass live live-transcripts.txt, section 'Python live' P6c: 'wrote 0 file(s) across 1 target(s), 2 unchanged'
Java/Kotlin live: maven-plugin skip, force and verify behaviour ⏸️ untested no Not driven in this run. I did not run mvn -o in server/java/maven-plugin, nor the GenSkipConformanceTest or RefusedOrphanSkipTest runners. The time budget went to the TS and Python live drives. The…
C# live: dotnet meta gen skip, force and verify behaviour ⏸️ untested no Not driven in this run. I did not build or run server/csharp MetaObjects.Cli or GenSkipConformanceTests (dotnet test). Dotnet is on PATH, so this was a time-budget decision, not a missing tool.
Regression: full TypeScript server suite ⏸️ untested no bun test in server/typescript was started in the background and killed before it reported a result, so its outcome is unknown. Required check outstanding; see the regression-incomplete finding.
Regression: full Python unit suite ⏸️ untested no Run stopped before completion. The three failures come from running with PYTHONPATH and no install, not from the change. Full result unknown. Integration tests need pg8000 and a Postgres container, wh…
  • scripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchains
  • baseline (given): scripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchains
  • TS live: bun server/typescript/packages/cli/bin/meta.ts gen (first run, no-change run, --force) in a disposable project under $DEV_SCRATCH, with an owned probe generator that appends to renders.log on each render (render counter is the oracle)
  • TS live: meta verify --codegen locally (no-change: no render) and with CI=1 (renders)
  • TS live: metadata reformatted with child order kept plus unrelated README edit -> skip
  • TS live: metadata edit (field added) -> render, field present in generated/Order.ts
  • TS live: declared extra input edited -> render, generated/mine.txt updated
  • TS live: hand edit to generated/Order.ts -> render and merged (edit kept)
  • TS live: generated/mine.txt deleted -> render and restored
  • TS live: fingerprint file deleted -> render
  • TS live: metadata file added -> render, Customer.ts written
  • TS live adversarial: edited orphan with entity removed -> warning, no fingerprint stored, second run renders and re-warns
  • TS live adversarial: outDir outside project root (fresh project) -> no-change skip, deleted outside output -> re-render and restore
  • TS live adversarial: docs-site wired, comment-only edit above a template.output payload object -> render, output page shows revised comment; no-change control skips
  • TS live: hand edit after last gen then meta verify --codegen -> renders and classifies the hand edit
  • Python live: metaobjects gen (via from metaobjects.cli import main, PYTHONPATH=server/python/src) first run, no-change run (outputs and manifest mtimes unchanged), metadata edit, hand-edited file (refused, not skipped), restore then no-change and --force
  • PYTHONPATH=src python3 -m pytest -q tests/test_gen_skip_conformance.py tests/codegen/test_gen_unchanged.py -> 35 passed
  • bun test in server/typescript: started, killed before completion, no result
  • python3 -m pytest -q tests --ignore=tests/integration: stopped at ~5%; three failures in tests/codegen/test_cli_surface.py::test_a_version_flag_prints_the_bare_version are environmental (package metaobjects not installed, so importlib.metadata cannot find it)
  • Not run: Java/Kotlin maven-plugin GenSkipConformanceTest, C# GenSkipConformanceTests, Python tests/integration (needs pg8000 and Postgres), full scripts/ci-local.sh
  • Transcript evidence: kept in the local pipeline evidence store (not published)
  • Worktree check: git status --short is empty after cleanup; scratch project removed
🔧 **Document** - 3 issues found → auto-fixed ✅
  • ℹ️ server/java/maven-plugin/src/main/java/com/metaobjects/mojo/MetaDataVerifyMojo.java:414 - Java MetaDataVerifyMojo still creates an empty virtual root directory under a temp path (createTempDirectory, deleted in finally), and its inline comments still say the regenerate 'writes to a temp dir'. No rendered file is written, so the docs' 'no rendered temp tree is written' is accurate. The Javadoc was corrected. The remaining code comments describe the real mechanism, so I left them. Judgement call: decide whether the empty root should go too.
  • ⚠️ docs/llms/llms-full.txt - docs/llms/llms-full.txt is a hand-maintained mirror of the docs (the site copies it verbatim). I corrected its one stale temp-dir line, but it does not carry the new gen skip behaviour or the codegen-skip-conformance corpus, so it now lags docs/features/cli.md and docs/CONFORMANCE.md. A follow-up should either add the skip section to the mirror or decide that the mirror is exempt.
  • ℹ️ AGENTS.md - AGENTS.md and CLAUDE.md still say 'Biome for format pass' under codegen substrate, and their .hashes.json storage line predates the new stored key in .gen-state/.fingerprint-&lt;port&gt;.json. This branch does not make either fact false, and both are agent memory files that only a human should edit, so I did not touch them. If the formatter removal lands in this release line, that human edit is needed.

🔧 Fix applied.
✅ Re-checked - no issues remain.

🔧 **Lint** - 1 issue found → auto-fixed ✅
  • ⚠️ linter found issues (exit code 1)

🔧 Fix applied.
✅ Re-checked - no issues remain.

✅ **Push** - passed

✅ No issues found.

- gen builds a key from the loaded model (each root node in canonical effective
  form, rolled up per package) plus the generators' identity (built engine code,
  config, owned generators, templates, declared extra inputs, project config,
  output-changing flags), before anything renders. When it matches the last
  successful run and every generated file still holds that run's bytes, gen
  renders and writes nothing. --force (Maven: -Dmetaobjects.force=true) turns it
  off; a generator that cannot declare its inputs opts out (cache: false or the
  port's equivalent).
- verify --codegen always renders in CI; locally it may answer "no drift" from
  the key and the manifest, --full forces a render. When it renders, every port
  compares in memory: no rendered temp tree (Java/Kotlin now capture through
  GeneratedFileWriter).
- The hash manifest is loaded once and written once per run, only when it
  changed (TypeScript, Python, C#). Identical bytes are never rewritten in any
  port. Python gen no longer reports unchanged files as written.
- TypeScript runs git merge-file only for a file edited by hand, and deletes its
  temporaries in a finally, under $DEV_SCRATCH when set.
- fixtures/codegen-skip-conformance/cases.json: 25 shared cases run by every port.
… when unchanged

Two targets, four generators: a forced run over unchanged output keeps every
mtime and saves no manifest; a first run saves it once. Also corrects a stale
comment in verify --codegen, which renders in memory.
The skill references in agent-context/ now describe verify --codegen as
rendering in memory. Refresh the byte-for-byte expected mirrors to match.
@dmealing
dmealing merged commit b9bc9c7 into release/1.2 Nov 15, 2026
9 checks passed
@dmealing
dmealing deleted the fm/mo-codegen-skip-1-2 branch November 15, 2026 01:47
dmealing added a commit that referenced this pull request Nov 15, 2026
…and a thrown merge leaves no temp file

#585 added the fast path and per-merge temp cleanup; these decideAndWrite-level
tests pin the two cases it left untested: an unedited file regenerates with
META_GEN_GIT pointing at a missing binary (so any spawn would throw) and advances
its snapshot and hash, and a merge that throws GitMissingError leaves nothing in
mergeTempDir(). Clean merge and conflict are re-asserted at the same level.
dmealing added a commit that referenced this pull request Nov 15, 2026
…anged (ADR-0064) (#590)

* feat(codegen): skip gen when nothing changed, in every port (ADR-0064)

Forward-port of #585 from release/1.2 (b9bc9c7) onto main, merged with the
manifest written once per run (#584) and the uniform entity selection (#588).
The skip ADR is numbered ADR-0064 here: ADR-0062 and ADR-0063 are taken on main.

- gen builds a key from the loaded model (each root node in canonical effective
  form), the generators' identity (built engine code, config, owned generators,
  templates, declared extra inputs, project config) and the output-changing
  flags, before anything renders. A match with the last successful run, with
  every generated file still holding that run's bytes, renders and writes
  nothing. --force (Maven: -Dmetaobjects.force=true) turns it off; a generator
  that cannot declare its inputs opts out.
- A run that names entities (positional, --entities, -Dmeta.entities) forces
  exactly those: it never skips, never stores a key and leaves the stored
  full-run key alone, in every port.
- verify --codegen may answer "no drift" locally from the key; CI and --full
  always render, and every port compares in memory.
- The hash manifest stays loaded once and written once, and only when an entry
  changed; identical bytes are never rewritten; TypeScript runs git merge-file
  only for a hand-edited file.
- fixtures/codegen-skip-conformance/cases.json: the shared case table.

Hand-resolved: TypeScript runner, overwrite-policy, gen/verify/args/index and
codegen-drift; Python cli, runner, overwrite_policy; C# CodegenRunner,
CodegenCli, CodegenDrift, Generator, Program; Java generate and verify mojos;
docs, changelog and the ADR index.

* no-mistakes(review): apply reviewer inline fixes

* no-mistakes(review): apply reviewer inline fixes

* no-mistakes(review): warn unknown attrs before gen skip; add regression test

* no-mistakes(review): apply reviewer inline fixes

* no-mistakes(review): Carry warnings in skipped gen json/toon document

* no-mistakes(test): Align C# agent-context fixture wording; sdk suite green

* no-mistakes(document): align codegen-skip docs with ADR-0064
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.

1 participant