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