Repository navigation
fix(csharp): make frozen metadata cache thread-safe; allow patch releases from release branches - #578
Merged
Merged
Conversation
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.
… unpushed-branch die
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
MetaData.Cached(server/csharp/MetaObjects/Meta/MetaData.cs) now stores memoized reads in aConcurrentDictionaryand keeps the first value added by a racing read (GetOrAdd), so concurrent first reads of a frozen node no longer corrupt the cache. NewCachedReadConcurrencyTests.cscovers it. CHANGELOG gets a "Fixed" entry.release/<major>.<minor>maintenance branches. The branch rule lives in a new shared module,scripts/lib/release-branch.mjs, used byscripts/release.mjsandscripts/finish-release.mjs. Both acceptmainor a maintenance branch. A maintenance branch cuts only versions on its own line, and all pushes and the sync check targetorigin/<branch>, neverorigin/main.release.mjsrefuses unsafelatestmoves. It refuses any version older than the newest npm-line release tag, and any-rcof a version that has already shipped.docs/RELEASING.mdgains a "Patch from a maintenance branch" section.scripts/test-release-branch.mjstests the rules and is wired into thegate_release_taggate inscripts/ci-local.sh.tsconfig.scripts.jsonincludes 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-toolchainspassed 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.2cuts 1.2.2 throughrelease.mjsto 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.mainstill works.finish-releaseacceptsrelease/1.2and 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.Evidence: Configured command rerun log (ts-fast + ts-unit, PASSED)
Evidence: Live: release.mjs 1.2.2 dry-run from release/1.2 (full preflight pass)
Evidence: Live: release.mjs refusal and allow scenarios, release/1.2 (part 1)
Evidence: Live: release.mjs scenarios, feature branch, main, unpushed branch (part 2)
Evidence: Live: release.mjs behind-origin refusal (part 3)
Evidence: Live: release.mjs --preflight-only allow scenarios (part 4)
Evidence: Live: finish-release --check on release/1.2
Evidence: Release-tag gate scripts (subset)
Evidence: Full cli package suite
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 movelatestbackwards" — 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 npmlatest(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 tolatest, regressing it; finish-release then refuses the tag, too late. Onmainthis 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/<branch>exits non-zero for the unknown ref, and release.mjs'sout()(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/<branch> || 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("1.2.4-rc.1", "v1.2.4")compares only the numeric triple, finds them equal at all three positions, and falls through the loop toreturn null(line 79-80) — allowed. Butrelease.mjspublishes withbun publish's default tag, and npm setslatestto whatever is published with it, so publishing a prerelease of an already-released version moveslatestfrom 1.2.4 backwards to 1.2.4-rc.1. Concrete sequence: v1.2.4 ships; an operator cutsbun run release 1.2.4-rc.1(typo for 1.2.5-rc.1, or a mistaken re-cut) — thegit tag -l v1.2.4-rc.1check passes (that tag is free), the new latest-regression gate passes (equal triples), and npmlatestregresses. The sibling backstop, finish-release gate 6 (scripts/finish-release.mjs:388-392), has the same blind spot:localeComparenumeric sortsv1.2.4-rc.1afterv1.2.4(longer string with equal prefix), sowouldResolve === tagand it passes too. The JSDoc at line 62 claims the function refuses "an-rccut on a line a newer release passed" — an rc of the same released version also regresseslatestand is not refused; docs/RELEASING.md:644-646 ("refuses ... any version older than the newest release tag") inherits the overstatement. Narrow, recoverable vianpm dist-tag add <pkg>@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.Nsuffix (a release candidate for a version that already shipped full is never legitimate); a newer-triple rc (1.3.0-rc.1vsv1.2.4) must keep passing, which the triple comparison already does.🔧 Fix applied.
✅ Re-checked - no issues remain.
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.mjsruns from the current directory's branch, but the new script only exists onmain, not onrelease/1.2at b2be4d2. Run the new scripts from amaincheckout while cwd isrelease/1.2, or land the change on the maintenance branch first.finish-release.mjsresolves its repo from the script location, so it has the same constraint. Also, onrelease/1.2the site payload still states pypi 1.2.1, sofinish-release --checkfor 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# changeCachedReadConcurrencyTestsplusMetaData.cs. No C# lane was run in this step, so that change is untested here. It is outside the stated release-script intent.scripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchainsscripts/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.logPer-package ts unit suites, as in gate_ts_unit:bun test --timeout 30000in 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 '*' buildandbun run --filter '*' typecheck: exit 0 (log: build-typecheck-manual.log)bun scripts/check-scripts-typecheck.ts: 'scripts-typecheck: OK'bun test --timeout 30000full 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 failrelease-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 realnode <new-code>/scripts/release.mjsandscripts/finish-release.mjsin 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: fullscripts/ci-local.sh(java, python, csharp, kotlin lanes, docker integration) and the C# changeCachedReadConcurrencyTests/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.