Skip to content

feat: bring every port to parity with the 1.3.0 codegen and migration work - #567

Merged
dmealing merged 14 commits into
mainfrom
fm/mo-rc19-parity
Nov 13, 2026
Merged

dmealing merged 14 commits into
mainfrom
fm/mo-rc19-parity

Conversation

@dmealing

@dmealing dmealing commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Closes #544
Closes #546

Validated in one no-mistakes run (review took seven fix rounds, document one; every fix commit is on this branch).

What Changed

  • @sequenceStart is forward-only in every DDL path (Honour identity.primary @sequenceStart in the TypeScript, Java, Kotlin and Python ports #544): meta migrate records START WITH n and advances a counter that sits below to GREATEST(n, max(id) + 1) (the sequence-start-change-keeps-counter persistence scenario is replaced by sequence-start-change-moves-counter-forward and sequence-start-change-below-max-id, pinned on live Postgres); the Drizzle identity column and the Kotlin Exposed table carry the start (autoIncrement(Sequence(...)), also pinned on live Postgres); and the C# context ships generated <Context>DesignTimeServices so dotnet ef migrations add scaffolds a start-only change as SET START WITH n plus the forward-only move, replacing the UseIdentityStartMigrations() registration (kept as an [Obsolete] no-op). Java and Python, which write no DDL, load the vocabulary only; ADR-0015 Amendment 1 keeps meta migrate the reference engine with EF Core migrations as a supported second C# path.

  • Output is keyed by metadata package, and names are claimed, never rewritten (Generated output paths keyed by metadata package in Java, Kotlin and Python #546): meta init and metaobjects init scaffold outputLayout: "package" (the engine default stays flat, so existing projects change nothing); C# gains opt-in csharp.outputLayout / csharp.packageNamespaces with global::-qualified cross-namespace references; Python writes per-package directories with relative imports and __init__.py files; and Java/Kotlin refuse two metadata packages that would land in one directory (ERR_NAME_COLLISION). The codegen-compile gate and the generated-server api-contract lanes run in both layouts, and the reference examples, recipes and agent-context generator guidance follow. A value object is never renamed: the TypeScript derived AcmeAlphaNote-style names and their ERR_PAYLOAD_NAME_COLLISION backstop are removed, one claim registry per run in TypeScript, C# and Python refuses a real clash with ERR_NAME_COLLISION (C# ValueObjectNames.Names becomes an [Obsolete] identity shim; ADR-0044 and ADR-0056 amended), two shared enums with one name are refused in TypeScript and Python, @collectionName and naming.collections now drive REST segments in Java, Kotlin and Python too (with reverse finders following the name in C#, TypeScript and Python), and a collection-name clash is ERR_COLLECTION_NAME_COLLISION in every port via the shared collection-segments.json corpus.

  • View-lowering and C# EF-context parity fixes: the TypeScript view lowering, which builds every port's views, makes every join LEFT OUTER (a report dimension's required flag no longer changes the join), qualifies a relation only when its entity declares @schema, and lowers multi-operator origin filters, projection-extends-projection, filter paths and multi-hop origin.first, TPH discriminator scoping, declared-type casts, relative dates and case — a shape it cannot lower is refused, not silently skipped; and the C# EF context now declares meta migrate's CHECK constraints with the same names and expression text (new fixtures/check-conformance/check-constraint-conformance shared corpus with meta migrate as reference), carries a JSON value object's @description into the database as a column comment, configures a flattened value-object member reference's foreign key on the owned type, and — in every port — keeps an entity's derived origin.* field out of table reads and writes.

Validation

Risk Assessment

⚠️ Medium: A ~300-file cross-port parity change whose most recent commits are pipeline-authored fixes; every adversarial trace of the new logic (identity-sequence SQL, claim registries, alias derivation, using-directive lexer, package-layout paths) held up and the shared corpora gate behavior, but the breadth plus the unreviewed remainder (check-constraint/xpkg fixture files, several secondary generators and test files in the changed set but not read this pass) keeps it above low.

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 2 infos
  • ⚠️ server/typescript/packages/codegen-ts/src/generators/entity-file.ts:43 - Garbled code comment introduced by the change ("// the module's type name are claimed in its directory;" — missing subject words). Fixed in place during this pass to "The module's file name and its type name are claimed in its directory;". Comment-only, no behavior change.
  • ℹ️ server/csharp/MetaObjects.Cli/VerifyCommand.cs:457 - NeutralConfig.Read(ProjectRoot..., validateNaming: false) is called three times back-to-back (Dialect, SkipRedundantChecks, WithCSharpLayout) at VerifyCommand.cs:457-459; the identical triple call was introduced at CodegenCli.cs:260-262 and CodegenCli.cs:962-964. Each gen/verify invocation reads and parses the same JSON config file three times; a single var project = NeutralConfig.Read(...) local would remove the redundancy (and guarantee one consistent snapshot per run). Purely mechanical, no behavior change.

🔧 Fix applied.
2 issues (1 warning, 1 info) still open:

  • ⚠️ docs/CONFORMANCE.md:136 - The intent requires issue Honour identity.primary @sequenceStart in the TypeScript, Java, Kotlin and Python ports #544 (identity.primary @sequenceStart, forward-only to GREATEST(n, max(id)+1)) to be honoured "in TypeScript, Java, Kotlin and Python". The change honours it in TypeScript (renderAdvanceSequence in migrate-ts/src/emit/postgres.ts), in Kotlin (autoIncrement(Sequence(..., startWith = n)) in KotlinExposedTableGenerator.kt) and in C#. It records Java and Python as "Not applicable" (docs/CONFORMANCE.md:136-137, reasoning that OMDB has no DDL and Python has no DDL path), and no Java or Python source reads @sequenceStart. That is a deliberate narrowing of a stated requirement. It is defensible under the "unless we actually want it to be different" clause and under ADR-0015, but it is the author's ruling and needs the user's confirmation. The remedy, not the defect, needs authorization: honouring the start in either port would need new DDL emission (for example a Spring/JPA sequence generator, or a Python SQL emitter) that ADR-0015 removed.

  • ℹ️ server/python/src/metaobjects/codegen/config.py:43 - The comment on GenConfig.output_layout says the CLI fills it from the output_layout key of the python block in .metaobjects/config.json. The actual source is the top-level outputLayout key of metaobjects.config.yaml (project_config.py TOP_LEVEL_KEYS, load_project_config, cli.py _run_gen_targets passing config.output_layout). The comment points maintainers at a config location that does not exist.

  • ℹ️ server/python/src/metaobjects/codegen/config.py:43 - The comment on GenConfig.output_layout says the CLI fills it from the output_layout key of the python block in .metaobjects/config.json. The CLI actually reads the top-level outputLayout key of metaobjects.config.yaml (project_config.py TOP_LEVEL_KEYS and load_project_config; cli.py passes config.output_layout). The comment points maintainers at a config location that does not exist. This was reported in the previous fix round as review-2 and is still unfixed in the committed code.

  • ℹ️ server/python/src/metaobjects/codegen/config.py:43 - The comment on GenConfig.output_layout said the CLI fills it from the output_layout key of the python block in .metaobjects/config.json. The real source is the top-level outputLayout key of metaobjects.config.yaml (project_config.py TOP_LEVEL_KEYS / load_project_config, passed through cli.py _run_gen_targets). The comment pointed maintainers at a config location that does not exist. A previous round reported this as fixed, but the committed tree still carried the wrong text. I corrected the comment in place. Comment only, no behaviour change.

  • ⚠️ server/csharp/MetaObjects.Codegen/Generators/DbContextGenerator.cs:105 - The branch deletes AssertOnePhysicalAddress, the codegen-time ERR_DUPLICATE_SQL_NAME check that refused two objects in one generated context mapping to the same (schema, table/view/routine). It existed on the base commit. None of the stated intent items (Generated output paths keyed by metadata package in Java, Kotlin and Python #546 package-keyed paths, Honour identity.primary @sequenceStart in the TypeScript, Java, Kotlin and Python ports #544 @sequenceStart forward-only, Python no-rename collision rule) asks for it to go. The only replacement is the comment 'Two objects on one table are EF's to refuse (it does, at model build)', so a clash now surfaces at runtime or at migrations add, not at dotnet meta gen. EF does not cover routines: two objects on one stored proc or table function are no longer caught anywhere in C# codegen. The test was weakened to match: CSharpNamingTests.cs Two_objects_mapping_one_relation_in_one_context_are_refused_naming_both became ..._are_left_to_the_model_build, which asserts only Assert.Single(Run(...)), so it would pass whatever the generator does with the clash. The branch folds that guard into the claim registry only for DbSet and REST names. I cannot tell whether the removal is deliberate. Remedy, not the defect, needs the author's call: either restore the guard (move it to ctx.Claim with a physical-address scope and the ERR_DUPLICATE_SQL_NAME code) or record the removal as an intended behaviour change in the CHANGELOG and ADR-0015 Amendment 1.

🔧 Fix applied.
1 warning still open:

  • ⚠️ server/csharp/MetaObjects.Codegen/ValueObjectNames.cs:36 - The branch deletes the public ValueObjectNames.Names(MetaData root) with no replacement. It was made public on purpose so an owned (ejected) generator copy could read the value-object name map. CHANGELOG.md (~line 5412) lists it in the eject public surface, and docs/superpowers/specs/2026-09-22-eject-in-every-port-design.md:60 names it. TypeName(obj, root) keeps its unused root parameter 'so an owned generator copy keeps compiling', so the author evidently wanted owned copies not to break. The siblings did keep deprecated shims for one release: TypeScript keeps RenderContext.valueObjectNames and packageOf, and Python keeps value_object_names, model_class_name and model_import. C# alone drops the member. An adopter's ejected C# generator that calls ValueObjectNames.Names(root) now fails to compile after upgrading. The CHANGELOG 'C#: the same claim registry' entry says only that the rename and ERR_PAYLOAD_NAME_COLLISION are gone; it does not mention the API removal. The remedy needs the author's call, not the defect: either restore Names(root) as a [Obsolete] identity map (ResolutionKey to PascalCase name) like the other two ports, or record the removal as an intended breaking change in the CHANGELOG.

🔧 Fix applied.
1 warning still open:

  • ⚠️ server/typescript/packages/migrate-ts/src/emit/postgres.ts:553 - Intent Honour identity.primary @sequenceStart in the TypeScript, Java, Kotlin and Python ports #544 requires @sequenceStart to be honoured forward-only, to GREATEST(n, max(id)+1), in every DDL path. The alter-sequence path now does that (renderAdvanceSequence, line 538). The sibling change-column-identity path does not. When an existing, populated column gains increment identity together with a @sequenceStart, renderIdentity emits only ALTER COLUMN .. ADD GENERATED BY DEFAULT AS IDENTITY (START WITH n) and never advances the new sequence past max(id)+1 (diff/index.ts:1089-1091 passes sequence through; the unit test at migrate-ts/test/unit/identity-sequence.test.ts:139 pins that exact output). Concrete sequence: table Ticket has ids 1..5000 with a plain integer key; the author adds increment plus @sequenceStart: 100; meta migrate creates a sequence starting at 100 and the first insert hands out 100, which collides with an existing row. This is the same failure the alter-sequence rule exists to prevent, and the renderAdvanceSequence doc comment claims the rule holds "in every port that changes a live sequence". Fix: when to === &#34;increment&#34; and sequence.start is set, append the advance statement after ADD GENERATED. Resolve the sequence with pg_get_serial_sequence when no explicit name is given. Update the unit expectation. Siblings: the SQLite emitter (emit/sqlite.ts:418 and :496) has no sequence concept and is not affected.

🔧 Fix applied.
2 infos still open:

  • ℹ️ CHANGELOG.md:58 - The [Unreleased] section now has two ### Changed headings (line 16, the new 'Breaking, TypeScript' entry, and the pre-existing one at line 58, with ### Added between them). Merge the new entry into the existing Changed section so each heading appears once.
  • ℹ️ server/csharp/MetaObjects.Codegen/FrameworkQualifier.cs:57 - The lexer copies every line that starts with using through verbatim, to skip using directives. That also skips using var x = new System.IO.StringReader(..) and using (System.IO.Stream s = ..) statements, so a System. reference on such a line is left unqualified. Under packageNamespaces a package named system (namespace Acme.System) then fails with CS0234, which is the failure this class exists to prevent. The generators in this repo are not affected: their using var lines (ReportExportGenerator.cs:327, RoutesGenerator.cs:475 and :1049) name no System.. An adopter's owned generator that emits using var with a System. type would hit it. FrameworkQualifierTests has no using var case. Fix: skip only a directive, meaning using followed by something other than var or (. Add a test case for each.

🔧 Fix applied.
6 issues (1 warning, 5 infos) still open:

  • ℹ️ CHANGELOG.md:58 - The [Unreleased] section now has two ### Changed headings (line 16, the new 'Breaking, TypeScript' entry, and the pre-existing one at line 58, with ### Added between them). Merge the new entry into the existing Changed section so each heading appears once.
  • ℹ️ server/csharp/MetaObjects.Codegen/FrameworkQualifier.cs:57 - The lexer copies every line that starts with using through verbatim, to skip using directives. That also skips using var x = new System.IO.StringReader(..) and using (System.IO.Stream s = ..) statements, so a System. reference on such a line is left unqualified. Under packageNamespaces a package named system (namespace Acme.System) then fails with CS0234, which is the failure this class exists to prevent. The generators in this repo are not affected: their using var lines (ReportExportGenerator.cs:327, RoutesGenerator.cs:475 and :1049) name no System.. An adopter's owned generator that emits using var with a System. type would hit it. FrameworkQualifierTests has no using var case. Fix: skip only a directive, meaning using followed by something other than var or (. Add a test case for each.
  • ℹ️ server/csharp/MetaObjects.Codegen/FrameworkQualifier.cs:110 - The round-6 fix (commit 32f0615) closed the using var x = .. and using (..) statement forms, but left a third statement form behind: the explicit-type using declaration using System.IO.StringReader r = new System.IO.StringReader(s);. UsingDirective sees using followed by something other than var/( and classifies the line as a directive, so it is copied through verbatim and the System. reference on it is left unqualified — the exact CS0234 failure under packageNamespaces with a package named system that this class exists to prevent. Reachable only from an adopter's owned generator emitting that form (this repo's generators do not), which is why this is info. Sibling of cov-fq-1, left behind by the round-6 fix. A workable discriminator: a using statement has two or more whitespace-separated tokens between using and the first = (or ; when no =), while a directive (using Foo = .., using System.IO;, using static ..) has at most one before =.
  • ℹ️ server/typescript/packages/migrate-ts/src/emit/postgres.ts:554 - The round-5/6 fix (commit 8cf2ba3) advances a newly created identity sequence past max(id) only when sequence.start is declared: return sequence?.start === undefined ? add : add + advance. The no-start sibling remains: an author adds identity.primary (increment, no @sequenceStart) to a populated plain-int column; diff/index.ts:1089-1091 passes sequence: undefined-carrying metadata through, renderIdentity emits only ADD GENERATED BY DEFAULT AS IDENTITY (Postgres leaves the new sequence at 1), and the first INSERT after the migration fails with a duplicate-key error against an existing row with id 1. This violates the invariant the code's own doc comment states (postgres.ts:508-509, "no id a live row holds is handed out again") and is the same class as seq-1, but it is pre-existing base behavior (the base branch never advanced either), and the intent scopes the required fix to @sequenceStart paths — so the remedy (advance to GREATEST(start ?? 1, max(id)+1) whenever ADD GENERATED is emitted on the up path, with the guard target &gt; (start ?? 1)) extends behavior slightly beyond the stated requirement and needs the author's authorization, not a silent fixer round. The alter-sequence sibling is unaffected (its sequence is live and already past max in normal operation).
  • ⚠️ server/typescript/packages/codegen-ts/src/render-context.ts:19 - The package-qualified LOCAL alias the no-rename design derives (localTypeName, and Python's value_objects.local_name at server/python/src/metaobjects/codegen/value_objects.py:150) is never checked against real object names. The Python port's old backstop — _assign's owner seeding, deleted in this change — explicitly refused "a derived AcmeAlphaNote must not land on an entity already called that"; the new claim registries claim module/type names per scope but never claim a local alias, so that invariant is now unguarded. Concrete sequence under outputLayout: &#34;package&#34;: packages acme::alpha and acme::beta each declare object.value Note, and the root declares object.value AcmeAlphaNote. A generated file referencing both acme::alpha::Note and the root AcmeAlphaNote emits import type { Note as AcmeAlphaNote } beside import type { AcmeAlphaNote } (TS: confusing duplicate-identifier compile error; Python: silent module-level rebinding — with from __future__ import annotations, Pydantic resolves the field annotation from the final binding, so the field validates against the WRONG model with no error). The amended ADR-0044/0056 contract says a clash is ERR_NAME_COLLISION; this one is neither refused nor detected. Same unclaimed-derived-name property in the extract-tier mirror/mapper names that take the alias: server/python/src/metaobjects/codegen/runtime/extract_delegate_emitter.py:65 (mirror_name), server/typescript/packages/codegen-ts/src/templates/extract-delegate-emitter.ts (mirrorName), server/typescript/packages/codegen-ts/src/import-path.ts:98 (valueObjectFieldImport's alias branch). Earliest boundary: at alias derivation — refuse (ERR_NAME_COLLISION naming the alias's source object and the clashing object), or extend the qualification — the exact place the removed backstop sat.
  • ℹ️ server/typescript/packages/codegen-ts/src/projection/extract-view-spec.ts:386 - This change deleted assertNoRelativeDate from encodeIntEnumFilterValue (its doc said the throw existed because "a programmatic caller skips the loader, so refuse it here, loudly") and lowered relative-date VALUES — but only scalars. In resolveViewFilter a relative date inside an in ARRAY ({ f: { in: [{ now: &#34;-P7D&#34; }, ...] } }) is not lowered (isRelativeOperand(rawValue) is false for the array) and falls through to the literal renderer, which emits garbage SQL text silently instead of the old loud refusal. The sibling path lowerFilterValue (the origin @filter lowering, same file) DOES map array elements, so the two value paths are inconsistent. Loader rule F1 refuses relative dates off reporting hosts, so reaching it needs a programmatic caller — the exact case the deleted guard covered. Fix: lower array elements the way lowerFilterValue does, or keep a loud refusal for the array form.

🔧 Fix applied.
2 infos still open:

  • ℹ️ CHANGELOG.md:58 - The [Unreleased] section now has two ### Changed headings (line 16, the new 'Breaking, TypeScript' entry, and the pre-existing one at line 58, with ### Added between them). Merge the new entry into the existing Changed section so each heading appears once.
  • ℹ️ CHANGELOG.md:40 - The new Unreleased entry "Breaking, TypeScript: a value object is never renamed" claimed that "the run-wide ERR_COLLECTION_NAME_COLLISION pre-pass (naming/collection-name-collision.ts) are removed". That pre-pass still exists and still runs (runner.ts:635 calls assertNoCollectionNameCollisions, correctly refusing collection-name clashes); what was removed is naming/collision-names.ts (assignEmittedNames and the ERR_PAYLOAD_NAME_COLLISION backstop, whose ERROR-CODES.json entry says no port raises it since 1.3.0). A reader upgrading would wrongly expect collection-collision refusals to disappear. Fixed in place during this pass: the sentence now names naming/collision-names.ts / ERR_PAYLOAD_NAME_COLLISION as removed and states the ERR_COLLECTION_NAME_COLLISION pre-pass stays. Wording only, no behavior change.
⚠️ **Test** - 1 error
  • 🚨 examples/showcase/site-payload.json:11 - Committed site payload was stale: counts.corpora read 38 but the builder now counts 39, so the gates lane site payload is true failed (bun scripts/build-site-payload.ts --check). This branch adds a conformance corpus and did not refresh the payload. Fixed in place by running bun scripts/build-site-payload.ts (one-line diff); --check now passes and the gates lane re-ran green. The change is uncommitted in the worktree and needs committing with this PR.
  • Live validation: ✅ go - 15 of 18 scenarios driven live against the product
Scenario Result Live Evidence
TS #544 fresh create: identity.primary increment + @sequenceStart 100 via meta migrate, then two defaulted inserts return ids 100 and 101 (local Postgres 16 container, synthetic project) ✅ pass live Ran meta migrate --slug init --apply against mo-validate-pg, then INSERT; output ids 100, 101 (transcript in terminal; populated cases saved as live-scenarios/ts-seq-BCD.out)
TS #544 populated table, @sequenceStart 3 below live max(id) 5: counter advances forward to 6, no duplicate id ✅ pass live live-scenarios/ts-seq-BCD.out (ts_b_below_max): ALTER ... ADD GENERATED ... (START WITH 3) + GREATEST advance; next id 6, 1 row sharing it
TS #544 populated table, @sequenceStart 100 above live max 5: next id 100 ✅ pass live live-scenarios/ts-seq-BCD.out (ts_c_above_max): next id 100, no duplicate
TS #544 seq-1 (change-column-identity path): populated key max 5000, @sequenceStart 1000 added, next insert id 5001 (no collision) ✅ pass live live-scenarios/ts-seq-BCD.out (ts_d_seq1_5000): next id 5001, 1 row sharing it
TS #544 alter path: identity live, @sequenceStart 1000 added with live max 5000 → ALTER SEQUENCE START WITH plus forward advance, next id 5001, counter never moves back ✅ pass live live-scenarios/ts-seq-E.out: ALTER SEQUENCE "tickets_id_seq" START WITH 1000 + setval GREATEST; first insert 5001, 1 row sharing it
TS adversarial/observation: increment added to populated key without @sequenceStart → advance to GREATEST(1, max+1); next insert 5001, no collision (addresses review seq-nostart-1) ✅ pass live ts-seq-E.out observation block: up.sql includes setval GREATEST(1, max+1); insert returned 5001 on mo_ts_obs
Python #546: outputLayout package → generated/acme/alpha/Note.py, acme/beta/Note.py, acme/app/Digest.py with relative imports; value objects not renamed; Digest.a/Digest.b resolve to the right package… ✅ pass live metaobjects gen in {tmp-dir}/mo-validate/py-pkg; live-scenarios/py-package-layout-generated; isinstance checks passed under real pydantic
Python no-rename rule: flat layout with same-named Note in two packages → ERR_NAME_COLLISION (exit 1, nothing renamed) ✅ pass live metaobjects gen in {tmp-dir}/mo-validate/py-flat: 'ERR_NAME_COLLISION ... both generate Note ... set output_layout package'; exit 1
Python alias clash: root AcmeAlphaNote plus acme::alpha::Note referenced together → ERR_NAME_COLLISION (review alias-vs-name-1) ✅ pass live live-scenarios/py-alias.out: 'ERR_NAME_COLLISION ... both generate AcmeAlphaNote in the local type bindings', exit 1
Python loader @sequenceStart: increment + start 100 generates; start without increment → ERR_SEQUENCE_WITHOUT_INCREMENT ✅ pass live metaobjects gen in {tmp-dir}/mo-validate/py-seq: increment case exit 0; no-increment case exit 1 with ERR_SEQUENCE_WITHOUT_INCREMENT
TS #546/no-rename: outputLayout package generates per-package files; the generated package output typechecks under tsc --strict; flat layout refused with ERR_NAME_COLLISION ✅ pass live live-scenarios/ts-pkg.out and ts-package-layout-generated; ts-flat.out (ERR_NAME_COLLISION, exit 1); tsc --strict --module nodenext exit 0 on generated Digest/Note files (zod linked from codegen-ts)
TS alias clash: root AcmeAlphaNote plus same-named value objects → ERR_NAME_COLLISION (review alias-vs-name-1) ✅ pass live live-scenarios/ts-alias.out: ERR_NAME_COLLISION ... local type bindings, exit 1
meta init writes the new layout: scaffolded metaobjects.config.ts has outputLayout "package" (ADR standing ruling: meta init writes the new layout) ✅ pass live live-scenarios/ts-init-metaobjects.config.ts (line 9 outputLayout: "package")
C# #544 EF Core: identity increment + @sequenceStart 100 with Postgres dialect → AppDbContext emits Npgsql:IdentitySequenceOptions start '100'; without Postgres dialect → warning ✅ pass live live-scenarios/cs-seq.gen2.log and generated AppDbContext.g.cs line 16 (HasAnnotation(&#34;Npgsql:IdentitySequenceOptions&#34;, &#34;&#39;100&#39;, &#39;1&#39;, ...&#34;)); first run logged the no-dialect warning
C# duplicate-physical-address guard restored: two entities on one @table → ERR_DUPLICATE_SQL_NAME naming both, gen exit 1 (review restored-guard fix) ✅ pass live live-scenarios/cs-dup.gen.log: 'ERR_DUPLICATE_SQL_NAME: acme::Ticket and acme::TicketArchive both generate tickets ...', exit 1
Java #546: maven-plugin generate with outputLayout package writes package-keyed paths (run the real Java generator) ⏸️ untested no Tried to drive it: the Maven plugin in the local Maven repository is 8.3.0 from before this branch's build; a fresh offline mvn install plus a scaffolded Maven project was not completed within the 1h30m budget. Driving…
Kotlin #546 and Kotlin Exposed #544 (@sequenceStart in generated Exposed table): live generation and inspection ⏸️ untested no Not driven live in this run: no Kotlin CLI invocation was set up within the time budget. Driving it needs the Kotlin codegen via the Maven plugin (same as the Java scenario) and a generated Exposed ta…
Python and Java DDL recorded Not applicable for @sequenceStart (vocabulary loads, no DDL emitted) ⏸️ untested no Only the loader half was driven live. The Java 'not applicable' record is in docs/CONFORMANCE.md and was not verified live.
  • scripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchains
  • Full flagless regression: scripts/ci-local.sh (log: evidence full-regression/ci-local-full.log). All lanes passed except gates (site payload stale, fixed) — java, java-integ, python, ts, ts-integ, csharp, kotlin-integ, showcase, cube, mutation all ✓.
  • Gates lane re-run after fix: scripts/ci-local.sh --only gates exit 0 (evidence full-regression/ci-local-gates-rerun.log).
  • Baseline already run by configured command: scripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchains.
  • Disposable Postgres 16 (docker container mo-validate-pg, 127.0.0.1:56611), removed afterwards. Used the built meta CLI server/typescript/packages/cli/dist/bin/meta.js against throwaway projects under {tmp-dir}/mo-validate.
  • TS live: fresh create with identity.primary increment + @sequenceStart 100 via meta migrate --slug init --apply; inserted two rows → ids 100, 101.
  • TS live populated-table cases (scripts ts-seq-BCD.sh): live max(id)=5, start 3 → next id 6; live max=5, start 100 → 100; live max=5000, start 1000 (change-column-identity path, the seq-1 fix) → 5001; each checked no duplicate id.
  • TS live alter path (ts-seq-E.sh): identity already live, @sequenceStart 1000 added with live max 5000 → ALTER SEQUENCE ... START WITH 1000 plus forward GREATEST advance → next id 5001, no duplicate.
  • TS observation: identity increment with no start added to populated plain key → advance to GREATEST(1, max+1) emitted; next insert 5001 (no collision).
  • Python live: metaobjects gen (server/python/.venv/bin/metaobjects 1.3.0) on two packages each declaring value Note plus acme::app Digest. outputLayout package → generated/acme/alpha/Note.py, acme/beta/Note.py, acme/app/Digest.py with relative imports; imported with real pydantic; Digest.a is alpha Note, Digest.b is beta Note (isinstance). Flat layout → ERR_NAME_COLLISION exit 1.
  • Python live alias clash: root AcmeAlphaNote plus acme::alpha::Note referenced together → ERR_NAME_COLLISION refused (exit 1).
  • Python live @sequenceStart loader: increment + start 100 generates; start without increment → ERR_SEQUENCE_WITHOUT_INCREMENT.
  • TypeScript live meta gen (cli dist, entityFile, disposable project with node_modules symlink): flat → ERR_NAME_COLLISION exit 1; package → generates acme/alpha/Note.ts, acme/beta/Note.ts, acme/app/Digest.ts; tsc --strict --module nodenext typecheck of the generated package-layout output exit 0 (zod linked from codegen-ts); alias clash with root AcmeAlphaNote → ERR_NAME_COLLISION.
  • meta init in an empty directory writes metaobjects.config.ts with outputLayout: "package".
  • C# live: built MetaObjects.Cli from this branch; dotnet meta gen (scaffolded codegen project repointed at local MetaObjects.Codegen via ProjectReference, since 1.3.0 is not on NuGet) with identity.primary increment + @sequenceStart 100 and Postgres dialect → AppDbContext emits Npgsql:IdentitySequenceOptions start '100'; without Postgres dialect → warning (intended).
  • C# live duplicate physical table: two entities on @table tickets → ERR_DUPLICATE_SQL_NAME naming both, exit 1 (restored guard).
  • Adversarial checks: flat-layout and alias collisions (TS and Python), a start below max(id) not restarting the counter, and a start without increment rejected by the loader.
🔧 **Document** - 1 issue found → auto-fixed ✅
  • ℹ️ docs/recipes/write-your-own-generator.md:40 - The change made a claim registry the way every emitted name is refused on collision (ctx.claim(scope, name, claimant, remedy) in TypeScript, ctx.Claim(...) in C#; ERR_NAME_COLLISION names both claimants), but the generator-authoring recipe — the primary-path doc for owned-generator authors, the audience that now shares name scopes with the stock generators — never mentions it. Nothing in the recipe is factually wrong, so this is an addition rather than a stale fact, and adding it here would exceed this phase's stale-only scope. Follow-up: one short paragraph in the recipe's shape section saying an owned generator that emits a type, module, barrel entry, route segment or file path into a shared scope should claim each name so a real clash is refused with ERR_NAME_COLLISION instead of colliding silently.

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

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Codegen and migrations, across the five ports:

- @sequenceStart is honoured forward-only: a changed start sets START WITH and
  moves the counter to GREATEST(n, max(id)+1) only when it is below, never back
  (TypeScript migrate, the Drizzle identity column, C# design-time services,
  Kotlin Exposed). Java and Python write no DDL.
- Output paths keyed by metadata package: Python's package layout, C#'s opt-in
  csharp.outputLayout / csharp.packageNamespaces, and a Java/Kotlin refusal when
  two metadata packages map to one directory. meta init, metaobjects init and
  dotnet meta init scaffold the package layout; engine defaults stay flat.
- A value object is never renamed. One claim registry per run in TypeScript,
  C# and Python refuses a real clash with ERR_NAME_COLLISION; a collection-name
  clash is ERR_COLLECTION_NAME_COLLISION in every port.
- @collectionName and the naming.collections pluralizer drive REST segments in
  Java, Kotlin and Python too.
- TypeScript view lowering: every join LEFT OUTER, @schema-only qualification,
  declared-type casts, multi-operator origin filters, projection-extends-
  projection, filter paths, multi-hop origin.first, TPH scope, and the view
  vocabulary (entity-derived fields, origin @segment, base-row operands,
  relative dates, case).
- C#: the EF context declares meta migrate's CHECKs (new check-constraint
  corpus), JSON-column comments, entity-derived fields are no column, and
  framework references are global::-qualified under package namespaces.
- Gates run in both output layouts; ADR-0015, ADR-0044 and ADR-0056 amended.
C# design-time HasDifferences counts a JSON-column comment change; the
framework qualifier leaves global using and preprocessor lines alone.
TypeScript and Python refuse two shared enums with one name instead of
dropping one; Python refuses a package tree it cannot import. An inlined
origin.first with no outer alias is refused, short-name counts are cached
per root, and the init scaffold says a barrel still claims every name.
@dmealing dmealing changed the title feat: bring every port to parity with the rc19 codegen and migration work feat: bring every port to parity with the 1.3.0 codegen and migration work Nov 13, 2026
@dmealing
dmealing merged commit f8a1dc5 into main Nov 13, 2026
9 checks passed
@dmealing
dmealing deleted the fm/mo-rc19-parity branch November 13, 2026 19:37
dmealing added a commit that referenced this pull request Nov 14, 2026
* fix(cli): stop installing dprint-node with every CLI install

ts-poet requires dprint-node (about 25 MB of platform binaries) at module
load. Vendor ts-poet's printer as codegen-ts/src/poet.ts (Apache-2.0,
licence kept) and format with the same dprint TypeScript plugin, 0.87.1,
through its WebAssembly build (@dprint/typescript + @dprint/formatter).
Output is byte-identical: every codegen golden and conformance fixture
is unchanged.

poet.ts is an engine module, so owned and ejected templates take Code
from @metaobjectsdev/codegen-ts/engine and class identity holds. The
config loader still maps a legacy bare ts-poet import to that entry.

check-peer-ranges now refuses dprint-node, ts-poet and @types/* in a
published package's dependencies or required peers unless allowlisted.
No published package declared @types/*; @types/node arrives only
through the libSQL driver, which is out of scope.

Fresh CLI install: 151 MB (134,525,165 bytes) -> 133 MB (115,177,311 bytes).

* docs(changelog): note the standalone binary no longer crashes on dprint-node

* fix(codegen-ts): address review of the vendored printer

- A formatter that fails to load now throws instead of silently
  emitting unformatted code; only a format error falls back.
- The CLI pins @metaobjectsdev/codegen-ts/engine to the same build
  (dist vs src) as the package root, so both reach one poet.ts.
- The engine entry re-exports only code/imp/joinCode/Import/Code from
  the printer, as it did from ts-poet.
- Restore ts-poet's toString() call for non-plain placeholders.
- Refresh the index.ts comment and narrow the CHANGELOG claims about
  legacy ts-poet imports and the standalone binary.

* refactor: drop unused printer helpers; reuse the workspace walk in the peer guard

Remove asOneline/oneline, Import.fromMaybeString and arrayOf from the
vendored printer (no callers). check-peer-ranges enumerates packages
through publish-set.mjs's enumerateWorkspacePackages instead of its own
readdir walk.

* fix(codegen-ts): import-path.ts takes the vendored printer; refresh install numbers after #567

* no-mistakes(review): guard: refuse install-only deps via optionalDependencies; add real-check tests

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

* no-mistakes(review): wire peer-ranges guard test into gate_peer_ranges lane

* no-mistakes(test): apply changes made during test validation

* no-mistakes(document): Doc sync: ts-poet printer, guard, binary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant