Skip to content

fix(csharp): make frozen metadata cache thread-safe; allow patch releases from release branches - #578

Merged
dmealing merged 5 commits into
release/1.2from
fm/mo-release-scripts-maint
Nov 14, 2026
Merged

dmealing merged 5 commits into
release/1.2from
fm/mo-release-scripts-maint

Conversation

@dmealing

@dmealing dmealing commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

What Changed

  • C# frozen-model cache is thread-safe. MetaData.Cached (server/csharp/MetaObjects/Meta/MetaData.cs) now stores memoized reads in a ConcurrentDictionary and keeps the first value added by a racing read (GetOrAdd), so concurrent first reads of a frozen node no longer corrupt the cache. New CachedReadConcurrencyTests.cs covers it. CHANGELOG gets a "Fixed" entry.
  • Patch releases from release/<major>.<minor> maintenance branches. The branch rule lives in a new shared module, scripts/lib/release-branch.mjs, used by scripts/release.mjs and scripts/finish-release.mjs. Both accept main or a maintenance branch. A maintenance branch cuts only versions on its own line, and all pushes and the sync check target origin/<branch>, never origin/main.
  • release.mjs refuses unsafe latest moves. It refuses any version older than the newest npm-line release tag, and any -rc of a version that has already shipped. docs/RELEASING.md gains a "Patch from a maintenance branch" section. scripts/test-release-branch.mjs tests the rules and is wired into the gate_release_tag gate in scripts/ci-local.sh. tsconfig.scripts.json includes the new module.
Validation

Risk Assessment

✅ Low: Both fix rounds correctly closed their findings (pre-publish latest-regression gate, clean unpushed-branch die, rc-of-shipped-version refusal) with shared helpers, behavioral tests with independent oracles, and docs matching behavior; the C# concurrency fix is a correct minimal ConcurrentDictionary swap; no new defect found across the remaining changed files.

Testing

The configured test command scripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchains passed on rerun, so the reported exit-1 failure did not reproduce. Per-package TS unit suites, TS conformance, workspace build and typecheck, the scripts typecheck, the cli suite, and the release-tag gate scripts all pass. Live drive of the release scripts in a disposable clone covers the intent: release/1.2 cuts 1.2.2 through release.mjs to a clean dry-run finish. Every refusal and allow path behaves as specified: wrong line, older patch, rc of a shipped version, feature branch, unpushed branch, behind origin. main still works. finish-release accepts release/1.2 and stops only on the pre-existing payload coordinate gate. Not covered here: the full multi-language ci-local run and the C# change in the reviewed commit range. Overall: all live scenarios pass, verdict go with those untested items noted.

  • Live validation: ✅ go - 12 of 12 scenarios driven live against the product
Scenario Result Live Evidence
release/1.2 cuts 1.2.2 from the maintenance branch: release.mjs --dry-run passes every preflight and completes (branch gate, origin sync, latest gate, npm auth, 14-package free check, site payload, ve… ✅ pass live local log release-A-1.2.2-on-release-1.2.log (disposable clone /mo-rel-e2e with local bare origin; real npm read-only registry checks)
release/1.2 refuses 1.3.0 (a different minor) before any network or write ✅ pass live local log release-scenarios-part1.log
release/1.2 refuses 1.1.9 (an older line) ✅ pass live local log release-scenarios-part1.log
Adversarial: release/1.2 refuses 1.2.0-rc.1, an rc of the already-shipped v1.2.0 (review round-3 fix; same triple, not a newer one) ✅ pass live local log release-scenarios-part1.log
release/1.2 allows an rc or patch past the newest release (1.2.1-rc.1, 1.2.1) ✅ pass live local log release-scenarios-part4.log
A feature branch is refused with the generic maintenance-branch diagnostic ✅ pass live local log release-scenarios-part2.log
main still cuts a prerelease of a newer triple (1.3.0-rc.1): full dry run passes; the change does not regress main ✅ pass live local log release-scenarios-part2.log
Adversarial: main refuses 1.1.5, an older patch than the newest release v1.2.0 (latest-regression gate) ✅ pass live local log release-scenarios-part2.log
Adversarial: main refuses 1.2.0-rc.1 (rc of a shipped version, on main) ✅ pass live local log release-scenarios-part2.log
Adversarial: an unpushed maintenance branch (release/1.3, no origin ref) gets a clear diagnostic, not a raw stack trace (review round-1 finding 2 fix) ✅ pass live local log release-scenarios-part2.log
Adversarial: release/1.2 behind origin/release/1.2 is refused before publish ✅ pass live local log release-scenarios-part3.log
finish-release on release/1.2 accepts the branch and refuses a wrong-line version (1.3.0) ✅ pass live local log finish-release-scenarios.log
Evidence: Configured command rerun log (ts-fast + ts-unit, PASSED)
[Survived] ConditionalExpression
src/super-resolve.ts:177:9
-       if (current === undefined) return undefined;
+       if (false) return undefined;

[Survived] ConditionalExpression
src/super-resolve.ts:195:9
-       if (found !== undefined) return found;
+       if (true) return found;

[Survived] ArrayDeclaration
src/super-resolve.ts:264:31
-     const pending: MetaData[] = [];
+     const pending: MetaData[] = ["Stryker was here"];

[Survived] ConditionalExpression
src/super-resolve.ts:266:9
-       if (n.superRef !== undefined) pending.push(n);
+       if (true) pending.push(n);

[Survived] ConditionalExpression
src/super-resolve.ts:278:11
-         if (e instanceof RefOverDropError) return "over-drop";
+         if (true) return "over-drop";

[Survived] ConditionalExpression
src/super-resolve.ts:284:40
-       if (node.superRef === undefined || node.superResolved !== undefined) return;
+       if (node.superRef === undefined || false) return;

[Survived] ConditionalExpression
src/super-resolve.ts:285:9
-       if (attempted.has(node)) return; // already resolved-or-failed this pass — never re-report
+       if (false) return; // already resolved-or-failed this pass — never re-report

[Survived] StringLiteral
src/super-resolve.ts:287:69
-       const effectivePkg = node.package ?? node.fileDefaultPackage ?? "";
+       const effectivePkg = node.package ?? node.fileDefaultPackage ?? "Stryker was here!";

[Survived] ConditionalExpression
src/super-resolve.ts:293:9
-       if (isChildTargetingRef(node.superRef)) {
+       if (true) {

[Survived] ConditionalExpression
src/super-resolve.ts:295:11
-         if (parsed !== undefined) {
+         if (true) {

[Survived] ConditionalExpression
src/super-resolve.ts:297:13
-           if (ownerNode !== undefined && ownerNode !== "over-drop") resolveNode(ownerNode);
+           if (true) resolveNode(ownerNode);

[Survived] ConditionalExpression
src/super-resolve.ts:297:13
-           if (ownerNode !== undefined && ownerNode !== "over-drop") resolveNode(ownerNode);
+           if (true && ownerNode !== "over-drop") resolveNode(ownerNode);

[Survived] LogicalOperator
src/super-resolve.ts:297:13
-           if (ownerNode !== undefined && ownerNode !== "over-drop") resolveNode(ownerNode);
+           if (ownerNode !== undefined || ownerNode !== "over-drop") resolveNode(ownerNode);

[Survived] ConditionalExpression
src/super-resolve.ts:297:40
-           if (ownerNode !== undefined && ownerNode !== "over-drop") resolveNode(ownerNode);
+           if (ownerNode !== undefined && true) resolveNode(ownerNode);

[Survived] StringLiteral
src/super-resolve.ts:297:54
-           if (ownerNode !== undefined && ownerNode !== "over-drop") resolveNode(ownerNode);
+           if (ownerNode !== undefined && ownerNode !== "") resolveNode(ownerNode);

[Survived] ObjectLiteral
src/super-resolve.ts:332:19
-             target: { type: target.type, subType: target.subType },
+             target: {},

[Survived] ObjectLiteral
src/super-resolve.ts:333:21
-             referrer: { type: node.type, subType: node.subType },
+             referrer: {},

[Survived] StringLiteral
src/super-resolve.ts:351:15
-           kind: "unresolved",
+           kind: "",

Ran 0.95 tests per mutant on average.
--------------------|------------------|----------|-----------|------------|----------|----------|
                    | % Mutation score |          |           |            |          |          |
File                |  total | covered | # killed | # timeout | # survived | # no cov | # errors |
--------------------|--------|---------|----------|-----------|------------|----------|----------|
All files           |  57.17 |   57.17 |      929 |        80 |        756 |        0 |        0 |
 parser-core.ts     |  49.81 |   49.81 |      459 |        61 |        524 |        0 |        0 |
 provider.ts        |  61.54 |   61.54 |       39 |         1 |         25 |        0 |        0 |
 serializer-json.ts |  64.49 |   64.49 |      193 |        14 |        114 |        0 |        0 |
 subtype-rules.ts   |  69.23 |   69.23 |      117 |         0 |         52 |        0 |        0 |
 super-resolve.ts   |  75.30 |   75.30 |      121 |         4 |         41 |        0 |        0 |
--------------------|--------|---------|----------|-----------|------------|----------|----------|
21:08:00 (1346573) INFO MutationTestReportHelper Final mutation score of 57.17 is greater than or equal to break threshold 35
21:08:01 (1346573) INFO HtmlReporter Your report can be found at: file://{run-worktree}/server/typescript/packages/metadata/reports/mutation/mutation.html
21:08:01 (1346573) INFO MutationTestExecutor Done in 13 minutes and 50 seconds.
── ✓ completeness-gate (mutation) (13m51s)

══════════════════════ SUMMARY ══════════════════════
  ✓ ts build + typecheck  (25s)
  ✓ conformance: typescript  (4m54s)
  ✓ ts unit suites  (25s)
  ✓ completeness-gate (mutation)  (13m51s)
── slowest steps ──
    13m51s  completeness-gate (mutation)
     4m54s  conformance: typescript
       25s  ts build + typecheck
       25s  ts unit suites
  total wall time: 19m35s
══════════════════════════════════════════════════════
LOCAL CI PASSED

[exited with code 0]
Evidence: Live: release.mjs 1.2.2 dry-run from release/1.2 (full preflight pass)

── Releasing 1.2.2  (DRY RUN) ──

✓ npm auth: dougmealing
✓ preflight: on release/1.2, synced, 1.2.2 free on all 14 packages
✓ lockstep set @ 1.2.2: 14 packages → 1.2.2
✓ site payload: showcase fresh on all five ports, payload fresh
✓ site bijection: every payload snippet is on a live page, and vice versa
✓ bumped 14 package.json → 1.2.2
✓ clean rebuild
✓ lockfile regenerated
✓ packed deps verified: all @metaobjectsdev/* pinned to 1.2.2
✓ CHANGELOG promoted → [1.2.2]
✓ site payload regenerated for the new version

Ready to publish 1.2.2 to npm `latest` (IRREVERSIBLE).
  packages: 14  |  packed deps: pinned  |  build: clean
✓ dry run — stopping before commit/publish/tag (no changes published)
Evidence: Live: release.mjs refusal and allow scenarios, release/1.2 (part 1)
\### A release/1.2 cuts 1.2.2 (in-line patch)
$ node <tmp>/mo-rel-e2e/newcode/scripts/release.mjs 1.2.2 --dry-run
error: bun <tmp>/mo-rel-e2e/work/server/typescript/packages/cli/bin/meta.ts gen --cwd <tmp>/showcase-pristine-gemLlF
  exit 1
error: Cannot find module '@metaobjectsdev/sdk' from '<tmp>/mo-rel-e2e/work/server/typescript/packages/cli/src/index.ts'

Bun v1.3.14 (Linux x64)

      at run (<tmp>/mo-rel-e2e/work/scripts/regen-showcase.ts:107:15)
      at generateInto (<tmp>/mo-rel-e2e/work/scripts/regen-showcase.ts:351:7)
      at <tmp>/mo-rel-e2e/work/scripts/regen-showcase.ts:423:5

Bun v1.3.14 (Linux x64)

exit=1

\### B release/1.2 refuses 1.3.0 (other minor)
$ node <tmp>/mo-rel-e2e/newcode/scripts/release.mjs 1.3.0 --dry-run

── Releasing 1.3.0  (DRY RUN) ──

✗ release/1.2 is the 1.2 maintenance branch and cuts only 1.2.x — 1.3.0 is not on that line (cut it from main, or from its own release/<major>.<minor>)
exit=1

\### C release/1.2 refuses 1.1.9 (older line)
$ node <tmp>/mo-rel-e2e/newcode/scripts/release.mjs 1.1.9 --dry-run

── Releasing 1.1.9  (DRY RUN) ──

✗ release/1.2 is the 1.2 maintenance branch and cuts only 1.2.x — 1.1.9 is not on that line (cut it from main, or from its own release/<major>.<minor>)
exit=1

\### D release/1.2 refuses 1.2.0-rc.1 (rc of already-shipped v1.2.0)
$ node <tmp>/mo-rel-e2e/newcode/scripts/release.mjs 1.2.0-rc.1 --dry-run

── Releasing 1.2.0-rc.1  (DRY RUN) ──

✗ 1.2.0-rc.1 is a release candidate for 1.2.0, which has already shipped — npm sorts it below the full release, so publishing to `latest` would move `latest` backwards.
exit=1

\### E release/1.2 allows 1.2.1-rc.1 (rc of unshipped patch)
$ node <tmp>/mo-rel-e2e/newcode/scripts/release.mjs 1.2.1-rc.1 --dry-run
error: bun <tmp>/mo-rel-e2e/work/server/typescript/packages/cli/bin/meta.ts gen --cwd <tmp>/showcase-pristine-trIibd
  exit 1
error: Cannot find module '@metaobjectsdev/sdk' from '<tmp>/mo-rel-e2e/work/server/typescript/packages/cli/src/index.ts'

Bun v1.3.14 (Linux x64)

      at run (<tmp>/mo-rel-e2e/work/scripts/regen-showcase.ts:107:15)
      at generateInto (<tmp>/mo-rel-e2e/work/scripts/regen-showcase.ts:351:7)
      at <tmp>/mo-rel-e2e/work/scripts/regen-showcase.ts:423:5

Bun v1.3.14 (Linux x64)

exit=1
Evidence: Live: release.mjs scenarios, feature branch, main, unpushed branch (part 2)
\### F feature branch refused for 1.2.2
$ bash -c git checkout -q -B feature/x b2be4d2e2 && node <tmp>/mo-rel-e2e/newcode/scripts/release.mjs 1.2.2 --dry-run

── Releasing 1.2.2  (DRY RUN) ──

✗ not on main or a release/<major>.<minor> maintenance branch (you are on feature/x)
exit=1

\### G main refuses 1.1.5 (older than newest v1.2.0)
$ bash -c git checkout -q main && node <tmp>/mo-rel-e2e/newcode/scripts/release.mjs 1.1.5 --dry-run

── Releasing 1.1.5  (DRY RUN) ──

✗ 1.1.5 is older than 1.2.0, the newest release — npm publishes to `latest`, so this would move `latest` backwards. A patch on a line a newer release has passed needs a non-`latest` dist-tag path this script does not yet offer.
exit=1

\### H main refuses 1.2.0-rc.1 (rc of shipped v1.2.0 on main)
$ bash -c git checkout -q main && node <tmp>/mo-rel-e2e/newcode/scripts/release.mjs 1.2.0-rc.1 --dry-run

── Releasing 1.2.0-rc.1  (DRY RUN) ──

✗ 1.2.0-rc.1 is a release candidate for 1.2.0, which has already shipped — npm sorts it below the full release, so publishing to `latest` would move `latest` backwards.
exit=1

\### I main allows 1.3.0-rc.1 (newer triple passes latest gate)
$ bash -c git checkout -q main && node <tmp>/mo-rel-e2e/newcode/scripts/release.mjs 1.3.0-rc.1 --dry-run

── Releasing 1.3.0-rc.1  (DRY RUN) ──

✓ npm auth: dougmealing
✓ preflight: on main, synced, 1.3.0-rc.1 free on all 14 packages
✓ lockstep set @ 1.2.2: 14 packages → 1.3.0-rc.1
✓ site payload: showcase fresh on all five ports, payload fresh
✓ site bijection: every payload snippet is on a live page, and vice versa
✓ bumped 14 package.json → 1.3.0-rc.1
✓ clean rebuild
✓ lockfile regenerated
✓ packed deps verified: all @metaobjectsdev/* pinned to 1.3.0-rc.1
✓ CHANGELOG promoted → [1.3.0-rc.1]
✓ site payload regenerated for the new version
exit=0

\### J unpushed maintenance branch release/1.3 refused with diagnostic
$ bash -c git checkout -q -B release/1.3 main && node <tmp>/mo-rel-e2e/newcode/scripts/release.mjs 1.3.0 --dry-run

── Releasing 1.3.0  (DRY RUN) ──

✗ release/1.3 has no origin/release/1.3 — push the branch first
exit=1
Evidence: Live: release.mjs behind-origin refusal (part 3)
\### K release/1.2 behind origin/release/1.2 refused
$ node <tmp>/mo-rel-e2e/newcode/scripts/release.mjs 1.2.2 --dry-run

── Releasing 1.2.2  (DRY RUN) ──

✗ release/1.2 is behind origin/release/1.2 — pull first
exit=1

\### L release/1.2 rc of unshipped patch 1.2.1-rc.1 passes latest gate
$ node <tmp>/mo-rel-e2e/newcode/scripts/release.mjs 1.2.1-rc.1 --preflight-only

── Releasing 1.2.1-rc.1 ──

✗ release/1.2 is behind origin/release/1.2 — pull first
exit=1
Evidence: Live: release.mjs --preflight-only allow scenarios (part 4)
\### L release/1.2 allows 1.2.1-rc.1 (rc of unshipped patch) past latest gate
$ node <tmp>/mo-rel-e2e/newcode/scripts/release.mjs 1.2.1-rc.1 --preflight-only

── Releasing 1.2.1-rc.1 ──

✓ npm auth: dougmealing
✓ preflight: on release/1.2, synced, 1.2.1-rc.1 free on all 14 packages
✓ lockstep set @ 1.2.2: 14 packages → 1.2.1-rc.1
✓ site payload: showcase fresh on all five ports, payload fresh
✓ site bijection: every payload snippet is on a live page, and vice versa
✓ --preflight-only: Phase 0 passed; stopping before the version bump
exit=0

\### M release/1.2 1.2.1 (patch past v1.2.0) passes latest gate
$ node <tmp>/mo-rel-e2e/newcode/scripts/release.mjs 1.2.1 --preflight-only

── Releasing 1.2.1 ──

✓ npm auth: dougmealing
✓ preflight: on release/1.2, synced, 1.2.1 free on all 14 packages
✓ lockstep set @ 1.2.2: 14 packages → 1.2.1
✓ site payload: showcase fresh on all five ports, payload fresh
✓ site bijection: every payload snippet is on a live page, and vice versa
✓ --preflight-only: Phase 0 passed; stopping before the version bump
exit=0
Evidence: Live: finish-release --check on release/1.2
\### N finish-release --check on release/1.2 (HEAD == origin/release/1.2, new scripts)
$ node scripts/finish-release.mjs 1.2.2 --check
✓ eject contract: the pending list is empty
✓ on release/1.2, clean, synced with origin
✓ v1.2.2 is free on both local and origin
✗ the site payload does not state this release:
    pypi: payload says 1.2.1, this release is 1.2.2  (manifest agrees with the payload — may have sat out)

  Fix: bump them, run `bun run site:payload`, commit, push, and re-run.
  Or, if these genuinely sat this release out (publish-what-changed):
    bun scripts/finish-release.mjs 1.2.2 --sat-out pypi
exit=1

\### O finish-release --check 1.3.0 on release/1.2 (wrong line)
$ node scripts/finish-release.mjs 1.3.0 --check
✓ eject contract: the pending list is empty
✗ release/1.2 is the 1.2 maintenance branch and cuts only 1.2.x — 1.3.0 is not on that line (cut it from main, or from its own release/<major>.<minor>)
exit=1
Evidence: Release-tag gate scripts (subset)
rc=0 node scripts/test-maven-coordinate.mjs :: All maven-coordinate tests passed.
rc=0 node scripts/test-prerelease-version.mjs :: all prerelease-version tests passed
rc=0 node scripts/test-check-release-tag.mjs :: all checks passed
rc=0 node scripts/test-changelog-promote.mjs :: all checks passed
rc=0 node scripts/test-release-branch.mjs :: all checks passed
rc=0 bash tools/prerelease/test-prerelease-link.sh :: all prerelease-link tests passed
Evidence: Full cli package suite
bun test v1.3.14 (0d9b296a)

test/migrate-drop-unmanaged.test.ts:
meta: migrate: refusing to drop public.theirs — absent from the committed schema snapshot, so this toolchain never managed it and the migration could not replay against a database where it never existed. Re-run with '--allow drop-unmanaged' if the drop is intended.
meta migrate — sqlite, file:<tmp>/drop-unmanaged-oPWWiI/t.db

  Changes: 1 drop-table

  Written:
    <tmp>/drop-unmanaged-oPWWiI/.metaobjects/migrations/20261114015950-x/up.sql
    <tmp>/drop-unmanaged-oPWWiI/.metaobjects/migrations/20261114015950-x/down.sql

meta migrate — sqlite, file:<tmp>/drop-unmanaged-445udv/t.db

  Changes: 1 drop-table

  Written:
    <tmp>/drop-unmanaged-445udv/.metaobjects/migrations/20261114015950-x/up.sql
    <tmp>/drop-unmanaged-445udv/.metaobjects/migrations/20261114015950-x/down.sql

meta migrate — sqlite, file:<tmp>/drop-unmanaged-Bk6muE/t.db

  Changes: 1 drop-table

  Written:
    <tmp>/drop-unmanaged-Bk6muE/.metaobjects/migrations/20261114015950-x/up.sql
    <tmp>/drop-unmanaged-Bk6muE/.metaobjects/migrations/20261114015950-x/down.sql

meta: migrate: refusing to drop public.orders.orders_job_id_fk — absent from the committed schema snapshot, so this toolchain never managed it and the migration could not replay against a database where it never existed. Re-run with '--allow drop-unmanaged' if the drop is intended.
meta migrate — sqlite, file:<tmp>/drop-unmanaged-fk-RKmbIT/t.db

  Changes: 1 drop-fk

  Written:
    <tmp>/drop-unmanaged-fk-RKmbIT/.metaobjects/migrations/20261114015950-x/up.sql
    <tmp>/drop-unmanaged-fk-RKmbIT/.metaobjects/migrations/20261114015950-x/down.sql

meta migrate — sqlite, file:<tmp>/drop-unmanaged-fk-pIYN5V/t.db

  Changes: 1 drop-fk

  Written:
    <tmp>/drop-unmanaged-fk-pIYN5V/.metaobjects/migrations/20261114015950-x/up.sql
    <tmp>/drop-unmanaged-fk-pIYN5V/.metaobjects/migrations/20261114015950-x/down.sql


test/help-and-exit.test.ts:
meta gen — codegen TS targets from your declared metadata

USAGE:
  meta gen [<entity>...] [flags]

FLAGS:
  --dry-run             Compute and print, don't write
  --list                Print the generator CATALOG (name, layer, tier, what it emits,
                        what to install) and exit. Codegen is opt-in: nothing runs until
                        you wire it, and this is where you choose. No config or metadata
                        required — add --format json for the same catalog, machine-readable.
  --probe               With --list: construct every catalog generator and dry-run it
                        against YOUR model, reporting how many files each would emit.
                        A count per generator beats any category label — and it cannot go
                        stale, because it runs the generators. Needs a project.
  --baseline <default|adopt|fresh>
                        First-time-on-existing-file behavior. Default: refuse a file that
                        cannot be proved to be generated output. "adopt" records the files
                        you have as the merge base and writes NOTHING — the first run a
                        project with no committed .hashes.json can perform. "fresh"
                        overwrites them with fresh output and re-baselines (discards edits).
  --no-antipatterns     Suppress the advisory "hand-rolled what MetaObjects can model" pass
  --limit <n|all>       Advisory lines TEXT output prints before truncating (default 20)
  --generators <names>  Narrow the run to these DECLARED generators, by stable name, comma-
                        separated (e.g. docs,api-docs to write only the documentation). A
                        name metaobjects.config.ts does not declare is refused: it never adds one.
  --strict              Load the model strictly, as `meta verify` does (ADR-0023): an
                        unknown attribute (a typo'd `@requird`) is an error and nothing is
                        written, instead of a warning over output that silently changed.
  --format <toon|json|text>   Output format (global flag; default toon off-TTY)
  <entity> [<entity>]   Positional filter on entity names
  --help, -h            Print this help

A real write run (not --dry-run) also runs an ADVISORY anti-pattern pass: it scans
your authored source for hand-rolled aggregates, money-as-float, and CHECK-IN enums
and points you at the construct that models them (origin.aggregate / field.currency /
field.enum). Warnings only — it never fails the build. Opt out with --no-antipatterns
or META_NO_ANTIPATTERNS=1.

Text output caps that list at --limit lines (default 20) and says how many it held
back. --format toon / --format json carry EVERY finding in the payload's
antiPatterns block, uncapped — --limit is a display cap for a terminal, never a
limit on the machine-readable result.

NOTE: outDir, dialect, dbImport, extStyle are read from metaobjects.config.ts

meta migrate — diff metadata vs live DB; emit migration SQL files

USAGE:
  meta migrate [baseline|apply-pending] [flags]

SUBCOMMANDS:
  baseline             Snapshot an EXISTING database's schema as the reference point
                       (use with --from-db). NOTE: for a brand-new/empty database use
                       the greenfield example below, NOT baseline — an offline baseline
                       records your metadata as already-applied and emits no CREATE TABLE.
  apply-pending        Replay committed migration files against --db (no diff).
                       Provisions a fresh/CI database when the chain BUILDS the
                       schema — 'meta verify --replay' proves that it does. A
                       database adopted via 'baseline --from-db' has no such
                       chain. postgres/sqlite only.

MIGRATE FLAGS:
  --db <url>           DB connection URL (required for live-introspect / --apply / --rollback)
                       Supports: file:, libsql:, postgres:, postgresql:
  --shadow-db <url>    Postgres: a scratch database for the drift comparison. Default: CREATE
                       DATABASE on the --db server (dropped afterwards), else the temp-object
                       probe on the target. Also SHADOW_DATABASE_URL / migrate.shadowDatabaseUrl.
  --dialect sqlite|postgres|d1
                       Optional dialect override (auto-detected from URL scheme)
  --migration-format default|flyway
                       Migration file layout (default: default). 'flyway' emits
                       V<N>__<slug>.sql + U<N>__<slug>.sql for a Flyway runner;
                       --apply/apply-pending/--rollback are refused under it
                       because Flyway owns apply and flyway_schema_history.
                       Also settable once as migrate.format in
                       .metaobjects/config.json.
  --out-dir <path>     Migration directory (default: ./.metaobjects/migrations;
                       flyway: src/main/resources/db/migration)
  --slug <name>        Required to WRITE a migration (not for --dry-run) (e.g., --slug add-user-shipping)
  --allow <csv>        Comma-separated destructive-change permissions:
                       drop-column,drop-table,type-change,drop-index,drop-fk,
                       drop-check,drop-view,drop-view-cascade,
                       adopt-view,nullable-to-not-null,drop-identity-default,
                       drop-unmanaged,drop-comment
                       drop-column DELETES the column and every value in it. If
                       the column was RENAMED, use --rename-column instead: it
                       keeps the data.
                       drop-unmanaged permits dropping a table/view the committed
                       snapshot never contained — one this toolchain never managed.
                       Without it that drop is refused, because the migration it
                       writes cannot replay against a database where the object
                       never existed.
  --on-ambiguous abort|rename|drop-add
                       How to handle ambiguous renames (default: abort)
  --rename-table [schema.]old=new
                       Declare a table rename (

... [255165 bytes truncated] ...

migrations/.down/0001_init-programs.sql
  create-table: 2
  add-fk: 1
  create-view: 1
meta: migrate: no wrangler.toml found in <tmp>/migrate-d1-cmd-00OJLZ or parents; pass --d1 <binding> to bypass
meta: migrate: --db / DATABASE_URL is not used for dialect 'd1' — wrangler.toml owns connection

test/unit/verify-strict.test.ts:
meta verify — running --codegen --templates (default). Explicit subverbs: --templates (prompt drift), --db/--dialect d1 (schema drift), --codegen (drift of everything `generators` declares, documentation included), --deps (dependency drift), --replay/--replay-snapshot (the committed migration chain replays from empty).
meta verify — codegen gate skipped: no metaobjects.config.ts found, so there is no generated output to diff against
meta: failed to load metadata: ERR_UNKNOWN_ATTR: Unknown attribute '@madeUpAttr' on field.string 'email' — not declared by any registered provider for field.string
  in meta.users.json at $['metadata.root'].children[0]['object.entity'].children[1]['field.string']
meta: meta verify is strict (ADR-0023): every authored @attr must be declared. Fix: register the attr on a metadata provider, OR move arbitrary author-supplied properties into an `attr.properties` bag, OR re-run with `meta verify --lax` to keep the legacy open-attr load.
meta verify — running --codegen --templates (default). Explicit subverbs: --templates (prompt drift), --db/--dialect d1 (schema drift), --codegen (drift of everything `generators` declares, documentation included), --deps (dependency drift), --replay/--replay-snapshot (the committed migration chain replays from empty).
meta verify — codegen gate skipped: no metaobjects.config.ts found, so there is no generated output to diff against
meta verify — no template.* nodes found; the template gate had nothing to check.
meta verify — not run: schema (--db <url>), codegen (--codegen), deps (--deps), replay (--replay) — a bare 'meta verify' runs the codegen and template gates (plus the requirement ledger); name each gate to run it
meta verify — running --codegen --templates (default). Explicit subverbs: --templates (prompt drift), --db/--dialect d1 (schema drift), --codegen (drift of everything `generators` declares, documentation included), --deps (dependency drift), --replay/--replay-snapshot (the committed migration chain replays from empty).
meta verify — codegen gate skipped: no metaobjects.config.ts found, so there is no generated output to diff against
meta verify — running --codegen --templates (default). Explicit subverbs: --templates (prompt drift), --db/--dialect d1 (schema drift), --codegen (drift of everything `generators` declares, documentation included), --deps (dependency drift), --replay/--replay-snapshot (the committed migration chain replays from empty).
meta verify — codegen gate skipped: no metaobjects.config.ts found, so there is no generated output to diff against
meta verify — running --codegen --templates (default). Explicit subverbs: --templates (prompt drift), --db/--dialect d1 (schema drift), --codegen (drift of everything `generators` declares, documentation included), --deps (dependency drift), --replay/--replay-snapshot (the committed migration chain replays from empty).
meta verify — codegen gate skipped: no metaobjects.config.ts found, so there is no generated output to diff against
meta verify — no template.* nodes found; the template gate had nothing to check.
meta verify — not run: schema (--db <url>), codegen (--codegen), deps (--deps), replay (--replay) — a bare 'meta verify' runs the codegen and template gates (plus the requirement ledger); name each gate to run it

test/unit/verify-output.test.ts:
meta verify — running --codegen --templates (default). Explicit subverbs: --templates (prompt drift), --db/--dialect d1 (schema drift), --codegen (drift of everything `generators` declares, documentation included), --deps (dependency drift), --replay/--replay-snapshot (the committed migration chain replays from empty).
meta verify — codegen gate skipped: no metaobjects.config.ts found, so there is no generated output to diff against
meta verify — 1 template(s) clean.
meta verify — not run: schema (--db <url>), codegen (--codegen), deps (--deps), replay (--replay) — a bare 'meta verify' runs the codegen and template gates (plus the requirement ledger); name each gate to run it
meta verify — running --codegen --templates (default). Explicit subverbs: --templates (prompt drift), --db/--dialect d1 (schema drift), --codegen (drift of everything `generators` declares, documentation included), --deps (dependency drift), --replay/--replay-snapshot (the committed migration chain replays from empty).
meta verify — codegen gate skipped: no metaobjects.config.ts found, so there is no generated output to diff against
meta: failed to load metadata: ERR_INVALID_TEMPLATE: template "Broken" @payloadRef "DoesNotExist" does not resolve to an object.value or sourceless object.projection at root
  in meta.ai.json at $['metadata.root'].children[0]['template.output']
meta verify — running --codegen --templates (default). Explicit subverbs: --templates (prompt drift), --db/--dialect d1 (schema drift), --codegen (drift of everything `generators` declares, documentation included), --deps (dependency drift), --replay/--replay-snapshot (the committed migration chain replays from empty).
meta verify — codegen gate skipped: no metaobjects.config.ts found, so there is no generated output to diff against
meta verify — 1 template(s) clean.
meta verify — not run: schema (--db <url>), codegen (--codegen), deps (--deps), replay (--replay) — a bare 'meta verify' runs the codegen and template gates (plus the requirement ledger); name each gate to run it
meta verify — running --codegen --templates (default). Explicit subverbs: --templates (prompt drift), --db/--dialect d1 (schema drift), --codegen (drift of everything `generators` declares, documentation included), --deps (dependency drift), --replay/--replay-snapshot (the committed migration chain replays from empty).
meta verify — codegen gate skipped: no metaobjects.config.ts found, so there is no generated output to diff against
meta: [Welcome] (email/html) ERR_VAR_NOT_ON_PAYLOAD: nonExistentField (prompts/e/html:1)
meta: meta verify — 1 drift error(s) across 1 template(s).
meta verify — not run: schema (--db <url>), codegen (--codegen), deps (--deps), replay (--replay) — a bare 'meta verify' runs the codegen and template gates (plus the requirement ledger); name each gate to run it
meta verify — running --codegen --templates (default). Explicit subverbs: --templates (prompt drift), --db/--dialect d1 (schema drift), --codegen (drift of everything `generators` declares, documentation included), --deps (dependency drift), --replay/--replay-snapshot (the committed migration chain replays from empty).
meta verify — codegen gate skipped: no metaobjects.config.ts found, so there is no generated output to diff against
meta verify — 1 template(s) clean.
meta verify — not run: schema (--db <url>), codegen (--codegen), deps (--deps), replay (--replay) — a bare 'meta verify' runs the codegen and template gates (plus the requirement ledger); name each gate to run it
meta verify — running --codegen --templates (default). Explicit subverbs: --templates (prompt drift), --db/--dialect d1 (schema drift), --codegen (drift of everything `generators` declares, documentation included), --deps (dependency drift), --replay/--replay-snapshot (the committed migration chain replays from empty).
meta verify — codegen gate skipped: no metaobjects.config.ts found, so there is no generated output to diff against
meta: [Doc] (document) ERR_VAR_NOT_ON_PAYLOAD: missingField (prompts/o/x:1)
meta: meta verify — 1 drift error(s) across 1 template(s).
meta verify — not run: schema (--db <url>), codegen (--codegen), deps (--deps), replay (--replay) — a bare 'meta verify' runs the codegen and template gates (plus the requirement ledger); name each gate to run it

 1871 pass
 8 skip
 0 fail
 1 snapshots, 8145 expect() calls
Ran 1879 tests across 198 files. [173.10s]
EXIT=0
  • Outcome: ⚠️ 4 issues (1 error, 3 infos) across 1 run (1h39m42s)

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 2 issues found → auto-fixed (2) ✅
  • ⚠️ scripts/release.mjs:246 - The maintenance-branch docs (docs/RELEASING.md:643-644) name the hazard — "a patch cut after a newer minor shipped would move latest backwards" — but nothing enforces it before the IRREVERSIBLE npm publish. releaseBranchRefusal only checks the version is on the BRANCH's line, never that the line is the newest released line; the sole enforcement (finish-release gate 6, wouldResolve !== tag, scripts/finish-release.mjs:381-392) runs AFTER release.mjs has already published to npm latest (bun publish, default tag latest, scripts/release.mjs:265). Concrete sequence: after v1.3.0 ships, an operator cuts 1.2.4 from release/1.2 for a late 1.2.x fix — a natural use of this very feature — release.mjs passes every preflight and publishes 1.2.4 to latest, regressing it; finish-release then refuses the tag, too late. On main this hazard pre-existed and was unlikely; maintenance branches make it the expected workflow, and the change documents the constraint without gating it. Remedy needs authorization, not the defect: a preflight check in release.mjs that VERSION is not older than the newest resolvable release tag (reusing gate 6's cli-version-match resolution) would close it before publish. This ADDS a new gate beyond the stated intent ("allow cutting from release/<major>.<minor>"), hence ask-user.
  • ℹ️ scripts/release.mjs:81 - On a maintenance branch that was never pushed, git rev-list --count HEAD..origin/&lt;branch&gt; exits non-zero for the unknown ref, and release.mjs's out() (execSync, no catch) aborts with a raw stack trace instead of a die() diagnostic. finish-release deliberately handles the identical case with --verify --quiet origin/&lt;branch&gt; || true (scripts/finish-release.mjs:107) and its own test covers it (scripts/finish-release.test.ts:327-331); release.mjs should mirror that so the empty output reads as "behind/push first" or a dedicated die. Fail-closed either way, and the documented workflow (branch created via merged PR) always has the remote ref — polish, not a blocker.

🔧 Fix applied.
1 warning still open:

  • ⚠️ scripts/lib/release-branch.mjs:79 - The fix-round gate leaves one axis of its own invariant open. latestRegressionRefusal(&#34;1.2.4-rc.1&#34;, &#34;v1.2.4&#34;) compares only the numeric triple, finds them equal at all three positions, and falls through the loop to return null (line 79-80) — allowed. But release.mjs publishes with bun publish's default tag, and npm sets latest to whatever is published with it, so publishing a prerelease of an already-released version moves latest from 1.2.4 backwards to 1.2.4-rc.1. Concrete sequence: v1.2.4 ships; an operator cuts bun run release 1.2.4-rc.1 (typo for 1.2.5-rc.1, or a mistaken re-cut) — the git tag -l v1.2.4-rc.1 check passes (that tag is free), the new latest-regression gate passes (equal triples), and npm latest regresses. The sibling backstop, finish-release gate 6 (scripts/finish-release.mjs:388-392), has the same blind spot: localeCompare numeric sorts v1.2.4-rc.1 after v1.2.4 (longer string with equal prefix), so wouldResolve === tag and it passes too. The JSDoc at line 62 claims the function refuses "an -rc cut on a line a newer release passed" — an rc of the same released version also regresses latest and is not refused; docs/RELEASING.md:644-646 ("refuses ... any version older than the newest release tag") inherits the overstatement. Narrow, recoverable via npm dist-tag add &lt;pkg&gt;@1.2.4 latest, and not reachable in this run's 1.2.2 cut — hence warning, not error. Fix: when the triples are equal, refuse any version carrying a -rc.N suffix (a release candidate for a version that already shipped full is never legitimate); a newer-triple rc (1.3.0-rc.1 vs v1.2.4) must keep passing, which the triple comparison already does.

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

⚠️ **Test** - 4 issues (1 error, 3 infos)
  • 🚨 configured test command failed with exit code 1
  • ℹ️ scripts/ci-local.sh - The original failure of the configured command did not reproduce. The exact command was rerun in full and passed (ts build+typecheck, conformance, ts unit suites, mutation gate). Cause unknown; likely contention from concurrent stryker and ci-local runs in other sessions during the first attempt. Re-run the gate if it recurs and capture the failing step name from its SUMMARY block.
  • ℹ️ docs/RELEASING.md - Operator note for the 1.2.2 cut. release.mjs runs from the current directory's branch, but the new script only exists on main, not on release/1.2 at b2be4d2. Run the new scripts from a main checkout while cwd is release/1.2, or land the change on the maintenance branch first. finish-release.mjs resolves its repo from the script location, so it has the same constraint. Also, on release/1.2 the site payload still states pypi 1.2.1, so finish-release --check for 1.2.2 stops until the NuGet/Maven coordinate bump runs. That is the existing publish-what-changed gate, not a regression from this change.
  • ℹ️ server/csharp/MetaObjects/Meta/MetaData.cs - Part of the reviewed commit range (b2be4d2..b829e49) is the C# change CachedReadConcurrencyTests plus MetaData.cs. No C# lane was run in this step, so that change is untested here. It is outside the stated release-script intent.
  • Live validation: ✅ go - 12 of 12 scenarios driven live against the product
Scenario Result Live Evidence
release/1.2 cuts 1.2.2 from the maintenance branch: release.mjs --dry-run passes every preflight and completes (branch gate, origin sync, latest gate, npm auth, 14-package free check, site payload, ve… ✅ pass live local log release-A-1.2.2-on-release-1.2.log (disposable clone /mo-rel-e2e with local bare origin; real npm read-only registry checks)
release/1.2 refuses 1.3.0 (a different minor) before any network or write ✅ pass live local log release-scenarios-part1.log
release/1.2 refuses 1.1.9 (an older line) ✅ pass live local log release-scenarios-part1.log
Adversarial: release/1.2 refuses 1.2.0-rc.1, an rc of the already-shipped v1.2.0 (review round-3 fix; same triple, not a newer one) ✅ pass live local log release-scenarios-part1.log
release/1.2 allows an rc or patch past the newest release (1.2.1-rc.1, 1.2.1) ✅ pass live local log release-scenarios-part4.log
A feature branch is refused with the generic maintenance-branch diagnostic ✅ pass live local log release-scenarios-part2.log
main still cuts a prerelease of a newer triple (1.3.0-rc.1): full dry run passes; the change does not regress main ✅ pass live local log release-scenarios-part2.log
Adversarial: main refuses 1.1.5, an older patch than the newest release v1.2.0 (latest-regression gate) ✅ pass live local log release-scenarios-part2.log
Adversarial: main refuses 1.2.0-rc.1 (rc of a shipped version, on main) ✅ pass live local log release-scenarios-part2.log
Adversarial: an unpushed maintenance branch (release/1.3, no origin ref) gets a clear diagnostic, not a raw stack trace (review round-1 finding 2 fix) ✅ pass live local log release-scenarios-part2.log
Adversarial: release/1.2 behind origin/release/1.2 is refused before publish ✅ pass live local log release-scenarios-part3.log
finish-release on release/1.2 accepts the branch and refuses a wrong-line version (1.3.0) ✅ pass live local log finish-release-scenarios.log
  • scripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchains
  • scripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchains (exact configured command, full run): ts build+typecheck, conformance ts, ts unit suites, completeness-gate mutation (score 57.17 >= break 35) all PASS, 'LOCAL CI PASSED'. Log: evidence ci-local-ts-fast-ts-unit-rerun.log
  • Per-package ts unit suites, as in gate_ts_unit: bun test --timeout 30000 in metadata, render, runtime-ts, codegen-ts-tanstack, codegen-ts-react, codegen-ts-angular, sdk, ai-runtime, conformance, docs-site, client/web runtime-web, react, tanstack, angular: all pass (log: ts-unit-manual.log)
  • ts conformance gate files (gate_conf_ts): metadata, render, integration-tests, migrate-ts (1120 tests), codegen-ts (2900 tests): all pass (log: conf-ts-manual.log)
  • bun run --filter &#39;*&#39; build and bun run --filter &#39;*&#39; typecheck: exit 0 (log: build-typecheck-manual.log)
  • bun scripts/check-scripts-typecheck.ts: 'scripts-typecheck: OK'
  • bun test --timeout 30000 full cli package suite (1879 tests, 198 files): 0 fail (log: cli-suite.log)
  • bun test scripts/finish-release.test.ts scripts/eject-release-gate.test.ts: 77 pass, 0 fail
  • release-tag gate scripts: node scripts/test-release-branch.mjs, test-maven-coordinate.mjs, test-prerelease-version.mjs, test-check-release-tag.mjs, test-changelog-promote.mjs, bash tools/prerelease/test-prerelease-link.sh: all pass (log: gate-release-tag-subset.log)
  • Live scenarios driven via real node &lt;new-code&gt;/scripts/release.mjs and scripts/finish-release.mjs in disposable clone /mo-rel-e2e (local bare origin, real repo tags, read-only npm registry checks). Logs: release-A-1.2.2-on-release-1.2.log, release-scenarios-part1..4.log, finish-release-scenarios.log. Disposable clone removed afterward.
  • Not run: full scripts/ci-local.sh (java, python, csharp, kotlin lanes, docker integration) and the C# change CachedReadConcurrencyTests/MetaData.cs. Those lanes were out of reach for this phase's time budget, so the C# change is untested here.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

MetaData.Cached stored derived reads in a plain Dictionary. A loaded model
is shared across threads, so two concurrent first reads of one node could
corrupt it, and every later read then threw "Operations that change
non-concurrent collections must have exclusive access". The cache is now a
ConcurrentDictionary; a racing first read keeps the first stored value.

Brought onto release/1.2 from main's fix (a266a51) for the 1.2.2 patch.
… branch

release.mjs and finish-release.mjs refused any branch but main, so a patch
on a line main has moved past could not go through its own guarded scripts.
Both now accept release/<major>.<minor> as well (one shared rule in
scripts/lib/release-branch.mjs): the version must be on that branch's own
line, every push goes to that branch, and finish-release's sync check
compares HEAD with origin/<branch>. Every other gate is unchanged.

docs/RELEASING.md gains the maintenance-branch section, including that the
site deploys from the newest vN.N.N tag wherever it was cut.
@dmealing
dmealing merged commit 8ac93e6 into release/1.2 Nov 14, 2026
9 checks passed
@dmealing
dmealing deleted the fm/mo-release-scripts-maint branch November 14, 2026 02:53
dmealing added a commit that referenced this pull request Nov 14, 2026
…ry port (#581)

* fix: cut long foreign-key index names on Postgres; verify refuses what generate refuses

- migrate.foreignKeyIndexes: a <table>_<columns>_idx name over 63 bytes is cut
  to the 63 bytes Postgres stores (SQLite and D1 keep it whole), in migrate-ts,
  the C# EF context and the Kotlin Exposed tables, so a converged schema
  proposes nothing. The diff also keys a Postgres foreign key by its stored
  name, so a long <table>_<column>_fk is not proposed as a rename every run.
- New shared corpus fixtures/foreign-key-index-conformance/, passed by the
  TypeScript, C# and Kotlin rules; two Postgres migration scenarios with a
  long table and column name.
- mvn metaobjects:verify runs the generate goal's model refusals (output
  package clash, collection-name clash), with a test; Kotlin gets its own
  collection-name clash test.
- docs/CONFORMANCE.md: the clash is per-port unit tests, not the segments
  corpus; the Drizzle identity start is string-tested only.
- ADR-0060 records verify.handEdits as Node-CLI only by design.
- The migration docs say what the code does with view grants (#574).

* feat(release): cut a patch from a release/<major>.<minor> branch; gate a minor on the previous one being merged

Forward-ports #578 from release/1.2: release.mjs and finish-release.mjs accept a
maintenance branch for a patch on its own line, refuse a version that would move npm's
latest backwards, and RELEASING documents the path. A minor or major cut is now refused
while the previous release/<M>.<m> holds a commit that is not on main, and RELEASING
Step 0 carries the same check.

* docs: one owner for the page-size, unknown-field and validation-issue rules; site gate timeout; ts-poet names

- docs/features/api-contract.md owns api.pagination, api.unknownFields and the
  validation issue list; language-differences, the five port pages and the
  CHANGELOG point to it instead of restating them.
- The site-payload gate runs its tests with a 60 s per-test timeout, so a busy
  machine does not read as a red release gate.
- CHANGELOG names def, literalOf, arrayOf, asOneline and Import.fromMaybeString
  among the ts-poet names the vendored printer does not carry.
- site-payload.json counts the new shared foreign-key-index corpus.

* no-mistakes(review): Restore changelog bullets; cut long index names

* no-mistakes(review): Rename case-only layout-collision test resources

* no-mistakes(document): docs: document the declared-index name cut

* fix: generated tables declare a long declared index name as Postgres stores it

meta migrate creates and compares a declared index.lookup / identity.secondary name over 63
bytes under the name Postgres stores (its first 63 bytes). The Drizzle tables, the EF Core
context and the Exposed tables now declare that cut name on Postgres (SQLite and D1 keep the
whole name; MySQL is exempt), so the mapping names the index the database holds. The names
artifacts keep the declared, dialect-neutral name.

The shared corpus fixtures/foreign-key-index-conformance/ gains a long index.lookup and
identity.secondary and declared.<dialect>.json, written by migrate-ts and read by the
TypeScript, C# and Kotlin generator tests. C# ForeignKeyIndexes joins the eject engine
surface, as the schema contract CheckConstraints already is.

* no-mistakes(document): docs: stored index names and verify-goal refusals
dmealing added a commit that referenced this pull request Nov 21, 2026
…gnKeyTargets (#620)

* fix(python): pass only validated input to the repository in generated routes (#566)

* fix(python): generated routes hand the repository only the validated input (1.2.1)

The generated FastAPI create, PATCH and PUT handlers validated the body against
<Entity>Create / <Entity>Patch and then passed the RAW body to the repository.
Pydantic ignores undeclared keys and the input models leave out server-owned
fields, so a client-sent id, a readOnly field and a made-up field such as
isAdmin all reached the write. Security fix.

Each handler (plain and TPH per-subtype) now rebinds dto to the keys the input
model validated, at every depth, before any repository call, as the TypeScript
routes do. Undeclared and non-settable keys are dropped silently, never 400'd,
so a client sending an extra harmless field keeps working; values stay the
body's own, so repositories see the same value types as in 1.2.0.

Python package version 1.2.1 only; CHANGELOG entry under Security.
Regression gate: tests/integration/test_generated_router_validated_input.py.

* no-mistakes(document): python routes pass only validated input

* no-mistakes(lint): regenerate showcase site payload for PyPI 1.2.1

* fix: generated create routes drop server-owned input across ports (1.2.x security) (#568)

* fix: generated create routes store only client-settable fields (1.2.x security)

Python 1.2.1 stopped its generated routes from handing raw request input to
the repository. The same audit found related create-path holes in 1.2.0 in
the other four ports; this closes each in its own idiom. Server-owned values
are dropped silently, never answered with 400.

- Java (codegen-spring): create strips a generated id, readOnly and derived
  fields; a TPH per-subtype create also strips the body discriminator and
  sibling-subtype fields.
- Kotlin (codegen-kotlin): create skips readOnly/derived columns; a TPH
  per-subtype create writes only the route subtype's own columns.
- C# (MetaObjects.Codegen): every readOnly property shape gets a private
  setter; create resets a generated id, the TPH discriminator and M:N
  navigations before Add.
- TypeScript (codegen-ts): the update schema omits primary-key fields, so
  PUT/PATCH can no longer re-key a row with an assigned key.

Proof: new shared api-contract scenarios (core + TPH input-server-owned,
TPH foreign discriminator) and a readOnly `role` field in secret-fields, run
in every port's generated lane and the reference lanes; a new `unset`
assertion key in all five harnesses. In-memory test repositories now store
what they are handed, so the scenarios fail on the 1.2.0 generators.

Proposed versions (not published): npm 1.2.2, NuGet 1.2.2, Maven 8.2.2;
PyPI unchanged at 1.2.1. metamodelVersion unchanged.

* fix: keep a @required readOnly field creatable in C# and Java generated create

Pre-gate review follow-ups to the 1.2.x create-input patch:

- C#: the required-key check skips readOnly fields (the private setter
  never binds them), and create validation ignores a violation naming
  only a @required readOnly member, as Java's SERVER_OWNED_ON_CREATE does.
- Java: the create-validation server-owned set covers every DTO component,
  so a nulled readOnly or derived value-object column no longer 400s.
- TypeScript: drop the now-dead PK guard in the update-schema nullable arm
  and list the PK rule in updateSchemaFields' doc comment.

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

* no-mistakes(review): Kotlin readOnly create fix + C# reset skip

* no-mistakes(document): docs: finish stale corpus counts from input fix

* fix(csharp): make frozen metadata cache thread-safe; allow patch releases from release branches (#578)

* fix(csharp): a frozen node's memoized reads are safe across threads

MetaData.Cached stored derived reads in a plain Dictionary. A loaded model
is shared across threads, so two concurrent first reads of one node could
corrupt it, and every later read then threw "Operations that change
non-concurrent collections must have exclusive access". The cache is now a
ConcurrentDictionary; a racing first read keeps the first stored value.

Brought onto release/1.2 from main's fix (a266a51) for the 1.2.2 patch.

* feat(release): cut a patch from a release/<major>.<minor> maintenance branch

release.mjs and finish-release.mjs refused any branch but main, so a patch
on a line main has moved past could not go through its own guarded scripts.
Both now accept release/<major>.<minor> as well (one shared rule in
scripts/lib/release-branch.mjs): the version must be on that branch's own
line, every push goes to that branch, and finish-release's sync check
compares HEAD with origin/<branch>. Every other gate is unchanged.

docs/RELEASING.md gains the maintenance-branch section, including that the
site deploys from the newest vN.N.N tag wherever it was cut.

* no-mistakes(review): gate latest-regression before npm publish; clean unpushed-branch die

* no-mistakes(review): refuse an rc of an already-shipped version

* no-mistakes(document): docs: fix RELEASING.md main-only release claims

* chore(release): @metaobjectsdev TypeScript packages 1.2.2

* ci: mutate only the changed files in the gate's mutation step (#583)

The ts-fast lane (and so --quick, --only ts and the no-mistakes Test step)
ran the full Stryker pass over all six metadata files on every run: 10-45
minutes of CPU per gate round on a loaded host, most of that step's wall time.

The step now diffs the stryker.conf.mjs `mutate` list against the merge base
with the base branch (MO_CI_MUTATION_BASE, else origin/$GITHUB_BASE_REF, else
whichever of origin/main and origin/release/* HEAD is closest to) and runs
`stryker run --mutate` on only the changed files. When none changed it prints
a SKIP naming the base. When no base resolves, or stryker.conf.mjs itself
changed, it says so and runs the full pass. Thresholds and concurrency are
unchanged; the list stays in stryker.conf.mjs only.

The full pass stays: the flagless run's mutation lane, a new
`--only mutation` section for release prep and on demand, and conformance.yml
(tags, nightly, dispatch) via MO_CI_MUTATION_SCOPE=full. Stryker's sandbox goes
under DEV_SCRATCH when that names a directory, and is removed afterwards.

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

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

- 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.

* test(python): non-prompt targets rewrite nothing and save no manifest 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.

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

* no-mistakes(review): Track unrecorded outputs in the skip key

* no-mistakes(review): Track outside-root outputs in TS skip key

* no-mistakes(review): Store no skip key after refused orphan sweep

* no-mistakes(review): Hash YAML sources when docs-site is wired

* no-mistakes(document): document gen skip and in-memory verify

* no-mistakes(document): document gen skip in llms mirror

* no-mistakes(lint): Update corpora count to 35 in site payload and AGENTS.md

* test(agent-context): regenerate conformance expected copies

The skill references in agent-context/ now describe verify --codegen as
rendering in memory. Refresh the byte-for-byte expected mirrors to match.

* chore(release): @metaobjectsdev TypeScript packages 1.2.3

* chore(release): PyPI, NuGet and Maven Central 1.2.3 (Maven 8.2.3)

* docs(releasing): a squash forward-port is followed by an ancestry-only merge

* fix: a missing C# design-time services line is a generation error; migrate.foreignKeyTargets turns the foreign-key refusal into a report

C#: when dotnet meta gen can see the context's migrations in another project and
that project lacks the DesignTimeServicesReference, a context that declares a
@sequenceStart fails with ERR_DESIGN_TIME_REFERENCE_MISSING instead of warning, since
the next scaffold would write RESTART WITH n.

TypeScript: migrate.foreignKeyTargets (refuse | warn) in .metaobjects/config.json.
warn reports a foreign key onto a non-unique target and carries on; the default
refuse keeps the 1.3.0 refusal, and its hint now names the setting. The offline
migrate path now reports ungoverned and unenforced targets too. The Rust config
reader accepts and validates the key.

* feat(codegen-cs): add CsWriter, a layout check and six small generators written on it (ADR-0063)

CsWriter (usings, braced blocks, doc summaries, hanging continuations) runs the shared
writer-conformance core cases plus six C# cases. The filter allowlist, names, callable,
output-prompt, output-parser and extractor generators now write through it as classes with
overridable per-piece methods; their output is unchanged except that an XML-reply parser loses
the blank line after its opening brace. A Roslyn layout check keeps new hand-typed layout out of
the generator source, with an allowlist that only shrinks.

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

* no-mistakes(review): Record ADR-0063 lint-gate exception in ratchet tests

* no-mistakes(document): Document C# writer, FK targets, eject

* feat(codegen-base): add Java code writer and layout ratchet (#621)

* feat(codegen-java): add the Java writer, its shared cases and a layout ratchet; pin the Spring REST surface

W-JV-1: a JavaWriter on a language-neutral CodeWriter in codegen-base, the
nine Java dialect cases in fixtures/writer-conformance, a runner for the
shared cases, and a layout ratchet that parses generator source with javac's
tree API and fails on hand-typed newlines, indents and joins. The allowlist
only shrinks and tags each unconverted file with the conversion step that
will retire it. The TypeScript runner now skips cases for other dialects.

W-JV-2: byte-exact expected files for the Spring controller, repository,
names and report-export generators over one input model, so the later
conversion to the writer is checked against today's output.

* no-mistakes(document): Update writer-conformance README for Java runner

* docs: correct 1.3.0 changelog and add staged candidate estate run sheet (#623)

* docs(changelog): correct the C# namespace and primary-key entries; add the missing upgrade items

* feat(prerelease): staged-candidate log, full-candidate command and the Rust git pin

* feat(prerelease): the estate run sheet and a script for its mechanical steps

* fix(prerelease): restore the estate to its start commit, check every package version, record partial publishes

* no-mistakes(review): record partial publishes, restore estate on failure

* no-mistakes(review): document gitignore blind spot, test restore flags

* no-mistakes(test): Test cut-short registry rows in candidate log

* no-mistakes(document): Fix Stale C# namespace, candidate log docs

* no-mistakes(document): Fix candidate log header and estate help

* feat(python): ObjectManager split, shared-model generator, generator options (#624)

* test(python): pin router, names and filter-allowlist output byte for byte (W-PY-0)

* feat(python): code writer, layout check and first generators on it (W-PY-1)

* fix(python): accept every expression function and the cast node at load (C2)

* feat(python): per-generator packages, entities and options in metaobjects.config.yaml (L-PY-0)

* fix(python): keep the selection wrapper out of the generator census (L-PY-0)

* feat(python): split ObjectManager into abstract ObjectManager and ObjectManagerDb, transactions, listeners (L-PY-1)

ObjectManager is now the abstract store-neutral contract (validation, @autoset,
report refusal, persistence listeners); ObjectManagerDb is the DB-API
implementation. Value conversion moves to metaobjects.runtime.values, drivers
gain a transaction() API. Clean break: no shim. Upgrade note in
docs/features/migrations/python-object-manager-split.md.

* feat(python): shared-model publisher, all 15 shared-model cases (D6)

metaobjects.shared_model (build_shared_model, render_shared_model_files) and a
shared-model generator wired in metaobjects.config.yaml: name/include (required),
exclude, requirements, files, version. Options gain a list kind and a required
flag; the build context carries the project root, the project's own files and
the run's providers. The Python conformance test now runs publish bytes,
manifest and the six refusals, not only the serializer arm.

* test(python): record the orphan write in the per-package hash manifest, not the legacy file

* no-mistakes(review): Refuse repeated configured generators and empty required lists

* no-mistakes(review): Emit report export columns as a list

* no-mistakes(test): Refuse per-entity gaps in required generators

* no-mistakes(document): Fix stale Python lane docs

* no-mistakes(document): Fix stale Python ledger notes and view scope

* test(python): pin router, names and filter-allowlist output byte for byte (W-PY-0)

* feat(python): code writer, layout check and first generators on it (W-PY-1)

* fix(python): accept every expression function and the cast node at load (C2)

* feat(python): per-generator packages, entities and options in metaobjects.config.yaml (L-PY-0)

* fix(python): keep the selection wrapper out of the generator census (L-PY-0)

* feat(python): split ObjectManager into abstract ObjectManager and ObjectManagerDb, transactions, listeners (L-PY-1)

ObjectManager is now the abstract store-neutral contract (validation, @autoset,
report refusal, persistence listeners); ObjectManagerDb is the DB-API
implementation. Value conversion moves to metaobjects.runtime.values, drivers
gain a transaction() API. Clean break: no shim. Upgrade note in
docs/features/migrations/python-object-manager-split.md.

* feat(python): shared-model publisher, all 15 shared-model cases (D6)

metaobjects.shared_model (build_shared_model, render_shared_model_files) and a
shared-model generator wired in metaobjects.config.yaml: name/include (required),
exclude, requirements, files, version. Options gain a list kind and a required
flag; the build context carries the project root, the project's own files and
the run's providers. The Python conformance test now runs publish bytes,
manifest and the six refusals, not only the serializer arm.

* test(python): record the orphan write in the per-package hash manifest, not the legacy file

* no-mistakes(review): Refuse repeated configured generators and empty required lists

* no-mistakes(review): Emit report export columns as a list

* no-mistakes(test): Refuse per-entity gaps in required generators

* no-mistakes(document): Fix stale Python lane docs

* no-mistakes(document): Fix stale Python ledger notes and view scope

* fix(python): escape a trailing double quote in a one-line docstring; teach the ObjectManagerDb API in the runtime skill

PyWriter.doc wrote four quotes in a row when a one-line docstring ended in a double
quote, which ends the string early. The trailing run is now escaped, pinned by a new
py-doc-trailing-quote writer-conformance case.

The shipped Python runtime reference still taught ObjectManager(root, PostgresDriver(conn)),
which now raises. It teaches ObjectManagerDb and transaction(); the agent-context
conformance golden moves with it.

* no-mistakes(review): Revert TS runner edit; fix stale ObjectManagerDb docs

* feat(codegen-ts): generate without a formatter and make ORM and SQLite driver optional (#622)

* feat(codegen-ts): take Biome out of generation

meta gen no longer formats generated TypeScript with Biome. codegen-ts drops
@biomejs/js-api and @biomejs/wasm-nodejs; each generator writes the layout it
means. formatTs stays exported as a pass-through so an owned 1.2 generator copy
still loads. The Hono routes no longer emit biome-ignore lines. Golden files,
the showcase and advanced-modeling output, owned copies and the site payload
are regenerated.

* test(integration-tests): run report arithmetic and money sums on real databases

* feat(codegen-ts): state this release's API behaviour in the OpenAPI document

A list's limit carries the project's api.pagination default and maximum, a write says an undeclared key is refused (or dropped under api.unknownFields: drop), the error envelope carries issues, fields and maxLimit, and a read-only resource says a write answers 405. Also corrects three CHANGELOG wording points and the protobuf line, and closes the finished exactly-one request.

* feat(codegen-ts): make drizzle-orm and zod optional peers, and hold the install to a size budget

A fresh install of the CLI no longer pulls the ORM. scripts/check-install-size.mjs packs the CLI, installs it, refuses a forbidden package in the tree and keeps the size under a budget that can only move down; it runs in the full CI lane.

* perf(cli): load Biome's WebAssembly build on the first owned-copy comparison

* feat(cli): make the SQLite driver an optional peer, and have meta init declare it

libSQL brought an HTTP client, a stream polyfill and a native binary per libc (about 28 MB) to every install. A SQLite project now declares @libsql/kysely-libsql at the CLI's peer range; others install nothing. The install-size budget drops to 51 MB.

* no-mistakes(review): Test Biome lazy-load by subprocess, not source grep

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

* no-mistakes(document): drop stale Biome and optional-peer docs

* no-mistakes(document): reword Biome reason string

* test(sdk): bring the agent-context conformance golden up to the reworded formatTs note

The document step reworded the formatTs line in the bundled TypeScript codegen reference; the ts-react-tanstack expected file still carried the old line, so the sdk conformance corpus failed in the ts-unit lane.

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

* no-mistakes(document): Four stale facts fixed in their owners; nothing left open. Already-correct branch docs (AGENTS.md, cli README, cli.md, contract-emitters.md, ADR-0063, CHANGELOG) were left as they are. - scripts/check-peer-ranges.ts:60: reason string now says the CLI's owned-copy comparison uses the WASM build (user-approved document-1). - agent-context/skills/metaobjects-codegen/references/typescript.md: Install section now says drizzle-orm and zod are optional peers, installed on demand; points to `meta gen --list --format json` and `meta eject` for the install set. - docs/features/migrations/commit-the-gen-state-hash-manifest.md: dropped "formatter" from two sentences; TS generation runs no formatter. Checked and left unchanged: docs/llms mirrors (their install lines remain accurate), docs/recipes/write-your-own-generator.md, codegen-ts README, docs/ports/typescript.md Zod passage (pre-existing, not changed by this branch), and the Python/Java/C# formatter references (different subsystems).

* test(sdk): bring the agent-context conformance golden up to the new install paragraph

Run 2's document step added an install paragraph to the bundled TypeScript codegen reference and left the ts-react-tanstack expected file behind, so the sdk conformance corpus is red again.

* no-mistakes(document): Fix optional peer claim in TS port doc

* fix: a missing C# design-time services line is a generation error; migrate.foreignKeyTargets turns the foreign-key refusal into a report

C#: when dotnet meta gen can see the context's migrations in another project and
that project lacks the DesignTimeServicesReference, a context that declares a
@sequenceStart fails with ERR_DESIGN_TIME_REFERENCE_MISSING instead of warning, since
the next scaffold would write RESTART WITH n.

TypeScript: migrate.foreignKeyTargets (refuse | warn) in .metaobjects/config.json.
warn reports a foreign key onto a non-unique target and carries on; the default
refuse keeps the 1.3.0 refusal, and its hint now names the setting. The offline
migrate path now reports ungoverned and unenforced targets too. The Rust config
reader accepts and validates the key.

* feat(codegen-cs): add CsWriter, a layout check and six small generators written on it (ADR-0063)

CsWriter (usings, braced blocks, doc summaries, hanging continuations) runs the shared
writer-conformance core cases plus six C# cases. The filter allowlist, names, callable,
output-prompt, output-parser and extractor generators now write through it as classes with
overridable per-piece methods; their output is unchanged except that an XML-reply parser loses
the blank line after its opening brace. A Roslyn layout check keeps new hand-typed layout out of
the generator source, with an allowlist that only shrinks.

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

* no-mistakes(review): Record ADR-0063 lint-gate exception in ratchet tests

* no-mistakes(document): Document C# writer, FK targets, eject

* feat(codegen-cs): EntityGenerator writes through CsWriter (ADR-0063)

Convert the 3,313-line entity generator (mapped entities, TPH subtypes, abstract shapes,
value objects, shared enums, and the decimal, duration and net-validation helper files)
to the code writer. Output matches the previous generator byte for byte over every
model fixture in all four layouts except three layout details the writer owns: an
empty class body has no blank line, a blank before a closing brace is dropped, and a
/// line has no trailing space.

Hooks take a CsWriter instead of a StringBuilder; property emitters are renamed
Write*Property. EntityGenerator.cs leaves the layout ratchet allowlist.

* feat(codegen-cs): DbContextGenerator writes through CsWriter (ADR-0063)

The context, its OnModelCreating and ConfigureModelNN chunks, the enum, map and
duration helpers and the design-time services file are written on a CsWriter.
Output is byte-identical for the 737 model fixtures in all four layouts. The
EmitUsings, EmitDbSetDeclarations and EmitOnModelCreatingBody hooks take the
writer; text hooks return unindented lines. The layout ratchet allowlist loses
the generator's entry.

* feat(codegen-cs): reverse finders, expression indexes, report export and requirement tests write through CsWriter (ADR-0063)

Output is byte-identical on the 737 model fixtures in four layouts, except
that the shared report-export writer now ends with a newline like every
other generated file. The four files leave the layout allowlist.

* feat(codegen-cs): routes and render-helper generators write through CsWriter (ADR-0063)

All generators now write through the writer, so the layout check's unconverted
list is empty. Routes output is byte-identical on the 737 model fixtures in
four layouts. The report-export golden gains its final newline.

* no-mistakes(review): Emit credential result class for M:N targets; fix export usings

* no-mistakes(review): Keep IValidatableObject on header overrides; add tests

* no-mistakes(document): Checked C# lane docs against 48c344a..dcca89d. One stale-risk fact fixed: docs/ports/csharp.md now states the IValidatableObject last-line rule for hook overrides. All other doc facts verified against code: writer defaults, Using/Sorted/Hanging/Braced/DocSummary, ERR_WRITER_IMPORT_CONFLICT, ERR_DESIGN_TIME_REFERENCE_MISSING gating, hook names and signatures, writer-conformance case counts (67 = 31+10+9+6+11), CONFORMANCE matrix column order, eject table, migrate.foreignKeyTargets config and refusal hint. Stale M2mNavProperty comments in DbContextGenerator.cs were already fixed.

* no-mistakes(document): Add C# writer amendment to ADR-0063
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