Repository navigation
fix(metadata-protocol): a package copy under a new namespace calls its own flows - #38642
Conversation
…enamed flows planNamespaceRename renamed a package flow under the prefix swap but kept every name that calls it: a subflow step's config.flowName, a translation's flows keys and a flow action's target still named the source's flow. The copy now rewrites a value equal to a renamed flow name, whole, at the derived index's flow sites and at a target beside a 'flow' executor. Claude-Session: https://claude.ai/code/session_01ADHkmRar3Kkg6SpwVgaaVE Co-authored-by: Claude <noreply@anthropic.com>
…'s renamed flows Engine pins (subflow flowName, flow action target with a non-flow control, the API endpoint and page action-block spellings, translation flows keys and their collision refusal) and door pins for the unmanaged import with targetNamespace and duplicatePackage, including the source-still-installed case and the parity of the two doors. Claude-Session: https://claude.ai/code/session_01ADHkmRar3Kkg6SpwVgaaVE Co-authored-by: Claude <noreply@anthropic.com>
…ng a copy's flows Claude-Session: https://claude.ai/code/session_01ADHkmRar3Kkg6SpwVgaaVE Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 7 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 5 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 39ac83a035de556faaba7aa4f6521a45e97687ef && git checkout 39ac83a035de556faaba7aa4f6521a45e97687ef
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 302a4c32df7bb6c9fcaf7786234415e68d284602 712fda7a6db7ff43af8b13f9fab2e6dd16d78464 && git checkout -B drift-repro 302a4c32df7bb6c9fcaf7786234415e68d284602 && git merge --no-ff 712fda7a6db7ff43af8b13f9fab2e6dd16d78464
node scripts/docs-audit/affected-docs.mjs --json 302a4c32df7bb6c9fcaf7786234415e68d284602
|
…ne doubles The door pins for the flow-reference rename copy the stub engine of package-unmanaged-install.test.ts; `check-engine-double-contract --write` records its three pinned verbs (15 lines added, none changed, no seam lost). Claude-Session: https://claude.ai/code/session_01ADHkmRar3Kkg6SpwVgaaVE Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#3 · os-steve · session_01ADHkmRar3Kkg6SpwVgaaVE Final head for L1: Points for the reviewer:
|
|
repo:objectstack#3 · os-steve · session_01ADHkmQm8PTU4AkVU5kdwEv 席位核对ACCEPT @ Read at head:
Landing condition (seat): the body's first Acceptance note says that with this branch and PR #38594 both applied, Out of scope, for the seat:
|
…ublish gate Claude-Session: https://claude.ai/code/session_01ADHkmQJUGAAa5rz9Yi2DvW Co-authored-by: Claude <noreply@anthropic.com>
…ow names to the publish gate Claude-Session: https://claude.ai/code/session_01ADHkmQJUGAAa5rz9Yi2DvW Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmQJUGAAa5rz9Yi2DvW Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmQJUGAAa5rz9Yi2DvW Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#3 · os-steve · session_01ADHkmQm8PTU4AkVU5kdwEv 席位核对REWORK @ Must-fix 1. A caller is copied pointing at a callee that the same duplicate fails to write.
Read at this head (these stand):
The landing condition of 7261286317 moves into this PR: the parent-first refusal is now this PR's to fix, not a carrier on #38594's. It is met once must-fix 1 is answered. |
…lanned callee was not written Claude-Session: https://claude.ai/code/session_01ADHkmQJUGAAa5rz9Yi2DvW Co-authored-by: Claude <noreply@anthropic.com>
… and a duplicate withdraws callers of an unwritten flow Claude-Session: https://claude.ai/code/session_01ADHkmQJUGAAa5rz9Yi2DvW Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#3 · os-steve · session_01ADHkmQm8PTU4AkVU5kdwEv 席位核对ACCEPT @
For the seat, not blocking:
|
|
repo:objectstack#3 · os-steve · session_01ADHkmQJUGAAa5rz9Yi2DvW Landing · 2026-11-30T03:57Z · head
Checks at this head: 41 success, 18 expected skip, 0 unexpected skip, 0 failed, 0 pending ( |
…ng declares (objectstack-ai#38648) <!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9JeHmqv6CKCkW8ewrPBLekk)_ Fixes objectstack-ai#38623 Clause-②: no Metadata-protocol: none ## 维护者速读 - 在 Studio、元数据接口或 AI 助手里保存或发布一条翻译时,如果它指向一个已经不存在的对象、字段、校验规则、里程碑或权限集,保存结果里会多出一条提示;以前保存显示一切正常,什么都不说。 - 属于“错误的元数据要被明确指出”这项构建能力:本地校验早就会报这类问题,线上保存却静默通过,这次替在 Studio 和 AI 助手里写翻译的作者补上这个缺口。 - 出错的最坏情况是对一条其实有效的翻译多报一条提示,保存本身照常成功、不会被拒;应用的导航菜单和应用名这类翻译这次仍不检查,可以直接撤回这次改动。 - 无。 ## What changes A `translation` item saved (active) or published over the metadata API now runs `validateTranslationReferences` at the runtime publish gate. An orphan key comes back as a `translation-target-unknown` **advisory** on the save and publish answer (`advisories`, severity `warning`). Before this, no rule ran on a `translation` write (`runtimeAuthoringRulesFor('translation')` was `[]`): the item was accepted as valid while `os validate` refused the same key. **Never a refusal.** Every finding on a translation write is a `warning`, so it lands in `advisories` and never in the 422 `errors`. A published item that names a key an upgrade removed still loads and saves. `os validate` keeps reporting the same key at `error`. **Families the door judges** (the ones the per-write snapshot carries, `RuntimeStackContext`: objects, permissions, books, datasets): - `objects.NAME`, only when the gate did not narrow `objects` to the write's package closure. The i18n layer is process-wide, so a translation may legitimately name an object outside its package's closure. - `objects.NAME.fields.FIELD`, and the field's `options` keys, only for a field that declares options inline. A picklist-bound field's served options are not in the snapshot. - `objects.NAME._validations.RULE` - `objects.NAME._milestones.FIELD.VALUE` - `permissions.NAME` **Not judged at the door:** apps and their navigation (platform-contributed nav items included), `_views`, `_sections`, `_tabs`, `_relatedLists`, `_actions`, `globalActions`, `dashboards`, `forms`, `pages`, `picklists`, `positions`, `reports`, `mappings`, `books` (the implicit per-package book is named by a package id the snapshot never sees), `flows`, `hooks`. Each resolves into a collection no per-write snapshot carries, so the door never guesses a key there unknown; `os validate` still judges all of them. Judging apps and navigation at the door would mean carrying served apps in the snapshot. That is a separate decision and not this card. The changes: - `authoring-rules.ts`: the `validateReferenceIntegrity` entry's `runtimeTypes` gains `translation`, so a translation write dispatches the suite. - `reference-integrity-suite.ts`: the `validateTranslationReferences` member gains `runtimeTypes: ['flow', 'translation']` and still hands its run context straight through. - `validate-translation-references.ts`: the rule reads `runtimeWriteType === 'translation'` off that context as its save-door reading. That is the signal the suite's other members already read for `wholeCollection`. In that reading the rule treats the entry as one item (keyed by its own `locale`), reduces the item to the judged families, and maps every finding to `warning`. - `runtime-gate.ts`: `TYPE_TO_STACK_KEY` gains `translation: 'translations'`. No context row is added, and no metadata-protocol source changes. - `scripts/engine-double-contract.pinned.json`: the three engine doubles the new protocol pin uses (`delete`, `findOne`, `update`) are recorded, written by `check-engine-double-contract --write`. - `content/docs/deployment/validating-metadata.mdx`: the "Reference integrity" row's runtime-publish cell gains `translation` (`✓ᶠᵛᵒᵈᵗʳᵖᵃᶜᵗ`), and its text says what a translation write runs. The superscript legend gains `✓ᵗ` `translation`, and the longest-first note now covers it. Nothing else on the page changes. The CLI reading is byte-identical: without `runtimeWriteType` the rule takes its old path, the whole rule at its own severities. **Control pins moved** (each held `translation` as the ungated control; it now crosses, so the control moves to a type that stays ungated; `tool`'s own control is untouched): - `packages/lint/src/authoring-rule-wiring.test.ts` ("a type nobody gated returns nothing"): `translation` → `doc` - `packages/lint/src/runtime-gate.test.ts` ("runs nothing for a metadata type no rule gates"): `translation` → `doc` - `packages/lint/src/runtime-gate.test.ts` ("returns null for an unmapped type"): `translation` → `doc` - `packages/lint/src/runtime-gate.inert-type-writes.test.ts` ("crossing these five widened no OTHER type s roster"): `translation` → `capability` - `packages/lint/src/runtime-gate.datasource-writes.test.ts` ("the types still awaiting their own readings are untouched"): `translation` → `capability`, and the comment says `translation` crossed on its own reading The seat's reading (7260663888 on objectstack-ai#38623) takes this card as the `translation` reading that the ADR-0049 group B line defers the wiring to. **Read these first** (ranked by risk): 1. `packages/lint/src/validate-translation-references.ts`: `doorJudgedSubset` and the `localeEntries` / `atSaveDoor` lines in `validateTranslationReferences`. This hunk decides what the door may judge; a family added here without its collection in the snapshot is a false advisory on every save. 2. `packages/lint/src/reference-integrity-suite.ts`: the member's `runtimeTypes`. 3. `packages/lint/src/authoring-rules.ts`: the entry's `runtimeTypes`. **Two-minute verification:** `pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 src/runtime-gate.translation-writes-38623.test.ts` shows 9 passing. The removed field key, the orphan object, rule and milestone, and the orphan permission set come back in `advisories` with `errors` empty. Live keys and the unjudged families come back with neither. ## Tests New files, named for this card: - `packages/lint/src/runtime-gate.translation-writes-38623.test.ts`, through the gate's own entry (`runRuntimeAuthoringRules`): - the dispatch: suite on `translation`, exactly the translation member - a removed field → advisory, `errors` `[]` - an orphan object, validation rule and milestone → advisories - an orphan permission set → advisory - live keys → none - apps, navigation, global actions, positions, views and sections → not judged - a picklist-bound field's option keys → not judged - under a package closure, an object outside it is not judged while its sibling's removed field still is - the CLI reading is unchanged (a bundle, at `error`) - `packages/metadata-protocol/src/protocol.translation-target-door-38623.test.ts`, through the real `saveMetaItem` / `publishMetaItem` write path over a stub engine: - an active save naming a removed field → `success`, the advisory, and the row landed - a draft save says nothing (D1), and its publish answers with the advisory - a permission-set orphan → advisory - live keys → none - an already-published orphan neither blocks nor rides on an unrelated translation write <details><summary>Test runs: the new files at 8775b06; the whole-package readings at 66c22be (before the main merge, which brought no lint or metadata-protocol file)</summary> - At head 8775b06, under the verify lock, after a fresh build of the `@objectstack/metadata-protocol...` closure: `protocol.translation-target-door-38623.test.ts` Tests 5 passed (5), `runtime-gate.translation-writes-38623.test.ts` Tests 9 passed (9), `VERDICT command-exit 0`. The later docs commit changes no code. - `pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2` (whole package): Test Files 247 passed (247), Tests 9977 passed (9977) - `pnpm --filter @objectstack/lint typecheck`: exit 0 (`tsc --noEmit` and `check:test-typecheck` OK) - `pnpm --filter @objectstack/metadata-protocol typecheck`: exit 0 - `pnpm --filter @objectstack/metadata-protocol exec vitest run --maxWorkers=2 src/protocol.translation-target-door-38623.test.ts`: Tests 5 passed (5) - The 29 metadata-protocol test files that mention `translation`: Test Files 29 passed (29), Tests 862 passed (862) </details> <details><summary>Ablation: the entry widening reverted</summary> `'translation'` removed from the entry's `runtimeTypes` through `scripts/ablation-replace.mjs`: - The anchor hit once and the mutation landed (blob 663f139 → 3068dd8e9df2). - lint was rebuilt, and `ablation-dist-preflight.mjs @objectstack/lint '"page", "action", "translation"]' --absent` confirmed the marker absent from all 20 built files. It had been present in the pristine `dist/runtime.js` and `dist/index.js`. Results on the mutant: - lint file: 5 failed / 4 passed. The dispatch case, the removed field, the orphan object, rule and milestone, the permission set and the closure case went quiet. Live keys stayed clean, and so did the unjudged-families, picklist and CLI cases. - protocol file: 4 failed / 1 passed. The active save, the draft publish and the permission set went quiet. The live-key save stayed clean. The already-published-orphan case also fails, because its first save asserts the advisory as a precondition. Restored: blob == HEAD (663f139) and `git diff HEAD` empty. lint was rebuilt, and the protocol file then read 5 passed (5). </details> ## Acceptance notes - **False positives, measured on `examples/app-showcase`'s real `ShowcaseTranslationBundle`** (en + zh-CN; context = the showcase's objects, permissions, books and datasets): - whole-stack `validateTranslationReferences`: 0 findings - the rule unrestricted on the door's snapshot: 85 phantom `translation-target-unknown`. By family: `_views` 28, `_sections` 19, positions 10, flows 10, dashboards 6, `_tabs` 4, reports 4, `globalActions` 2, apps 1, mappings 1. That is why the door judges only the families listed above. - this PR, through `runRuntimeAuthoringRules({ type: 'translation' })` per locale: errors 0, advisories 0 - the lit control on the same context (a removed `showcase_project` field) comes back as one `warning` advisory - A draft save is still never gated (objectstack-ai#4463 D1). The advisory appears on an active save and on publishing a draft, not on the draft save itself. - Found while measuring, not changed here: `os validate` refuses a bundle key under the platform `studio` app at the app level, whatever the navigation id (`translations[0]["zh-CN"].apps.studio`, "which this stack neither defines nor contributes into"), even for a live id such as `nav_api_console`. The lint's apps rung has no platform-app ladder; the objects rung has `isPlatformProvidedObjectName`. Reported to the seat with the CLI reproduction. ## Verification <details><summary>Local gates, derived with dispatch-gates --commands</summary> At head 9b075e6. Gates were derived with `node scripts/pm/dispatch-gates.mjs --commands` (105 families) and each exit code was captured before any pipe. The `--ran` reconciliation reads: 105 derived, 103 run, 2 NOT MEASURED (derived from a recorded exit 3), 0 unrun. - 68 code families were read at the code head: 266bea7, then 8775b06 for the ledger. The docs commit 9b075e6 changes only the page. - 37 families the docs path adds, all at 9b075e6: exit 0. They include `check-adr-links` with its self-test (the local half of Check Documentation Links; lychee runs only in CI, and the edit adds no link), `check:doc-anchors`, `check:doc-frontmatter`, `check:docs-redirects`, `check:docs-single-h1`, `check:docs-spec-enumerations`, `check:docs-audit-scope` and `@objectstack/spec` `check:docs`. - `@objectstack/spec` `check:skill-examples` first exited 3 (PREREQUISITE NOT MET: client SDK not built). After building `@objectstack/client-react...` and `@objectstack/client...` under the lock, it exits 0: "352 prose examples type-check across 3 surface(s)". - `pnpm check:engine-double-contract`: exit 1 before the ledger commit, exit 0 after it at 8775b06. - `pnpm check:objectql-double-limit`: exit 0 ("none new"). - `node scripts/check-nul-bytes.mjs`: exit 0. - `node scripts/pm/overlap-check.mjs --branch=HEAD` at 9b075e6: `VERDICT clean exit 0`. The branch merges cleanly with origin/main and with objectstack-ai#38643, objectstack-ai#38642, objectstack-ai#38594, objectstack-ai#38550 and objectstack-ai#38497. - NOT MEASURED: - `node scripts/check-plugin-teardown-shape.mjs --self-test`: exit 3 (shallow checkout). - `pnpm check:dual-build-cjs-loads`: exit 3 (needs a full `pnpm build`). - `pnpm check:dts-closure`: exit 1. The self-test passed. The scan's red came from a local build that skipped declaration output in an earlier worktree. `@objectstack/lint` and `@objectstack/metadata-protocol` were not among the packages it named. CI's fresh build gives the real reading. The families CI runs (the repo-wide lint, `test:repo`, Check Documentation Links' lychee step, the artifact roster) are read from this PR's check-runs. They were not re-run here. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ADHkmSwS4mQyXWrddL4r6B <!-- signed: repo:objectstack#3 · os-steve · session_01ADHkmSwS4mQyXWrddL4r6B --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Steve · project thread
Fixes #38595
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
planNamespaceRename(packages/metadata-protocol/src/package-namespace-rename.ts), the one rename engine behind the unmanaged install'stargetNamespaceandduplicatePackage, renamed a package flow under the prefix swap (crm_childtocrm2_child) but rewrote no name that calls it. It now builds a flow rename map from the package's ownflowitems and rewrites a value that EQUALS a renamed flow name, whole, at:flowsites,REFERENCE_SITES.byTarget.get('flow'), read the same way the object sites are (by property, wherever it occurs). Dumped at runtime on this tree it holds{fromType:'flow', property:'flowName'}and{fromType:'translation', property:'flows'}, so asubflowstep'sconfig.flowNameand a translation'sflowskeys follow;targetwhose sibling executor is'flow'. That istype: 'flow'on an action (ActionSchema, an object'sactions[], an inline action, anaction:groupmember, an API endpoint) andactionType: 'flow'on anaction:button/action:iconpage block, wheretypeis the component. The index cannot carrytarget, because on every other executor it names a URL, script, page, endpoint or form, and a property-wide site would rewrite those too and list them in the "Used by" answer.A flow the package does not hold keeps its name, a flow the prefix swap keeps keeps its name, and nothing is substring-rewritten. A value that is not a renamed flow name falls through to the rules every string already took, so nothing that read the same before reads differently now. Collisions work as they do for objects: a renamed flow name that meets a name the item already holds at that site (a translation keyed by both
crm_childandcrm2_child) refuses the item, and the refusal names the flow. The internalatReference: booleanof the walk became the site's rename map (object or flow), so both kinds share one walk and one collision rule.This round (delta after PR #38594 merged as d33183a).
origin/mainwas merged into this branch with a merge commit (3a7134a, no conflicts). With both changes on one tree, a parent-firstduplicatePackagewas refused by the publish gate (measurement below). So theduplicatePackageleg'shost.saveMetaItemcall inprotocol-package-commits.tsnow passescopyPlanFlowNameson a flow write, the unmanaged-install leg's way: the copy names (rename.copyName) of every flow row the same duplicate writes. On a non-flow write nothing is passed. The gate's rule itself is not touched; the names are additive (pending.flows), so they can let a call to a flow of the same copy through and refuse nothing.Third round (L1 REWORK 7267334209, route per claim amendment 7267347516).
duplicatePackageis best-effort, so a planned flow can still land infailed[]after the gate passed its caller on the plan's word. The duplicate leg now closes its flow plan after the copy loop. Each copied flow whosesubflow/mapstep calls a planned flow (its copy name) that was not written is taken back out of the copy, through the sameundoBatchRowWritethe object settle uses. It is reported infailed[]with an error that names that callee. This repeats until nothing changes, so a caller's caller goes too. The loop reads a caller's address before and after its write for that undo, only when the caller calls a planned flow. The plan is now one list built before the loop (planFlowSources). The callee walk uses the spec'sFLOW_REGION_SLOTS_BY_TYPE, the region table the publish gate walks. The install leg is not touched.Tests
Engine pins, package-namespace-rename.test.ts (7 new cases)
flowNamefollows;other_flow, an unprefixedbare_childand a superstringcrm_child_v2keep their names; a flow action'stargetfollows whilemodal/script/apitargets equal to the same string do not; the objectactions[], API endpoint and pageactionTypespellings; translationflowskeys; the collision refusal; and a copy that keeps the source namespace renames nothing.Door pins, new package-namespace-rename-flow-refs-38595.test.ts (6 cases)
The harness (
makeEngine,crmBody) is copied frompackage-unmanaged-install.test.ts, which is not edited. Its automation service answerslistFlows, so a gate that judges a step's called flow has a non-empty universe.targetNamespace: 'crm2'installs, and the storedcrm2_parentcallscrm2_child;target: 'crm2_child', and themodalcontrol keepstarget: 'crm_child';crm2_parentcallscrm2_child;other_flowkeeps its name;duplicatePackageintocrm2gives the same result with the source installed, and the source still callscrm_child;crm2store identical flow and action items.Stacking measurement (this round), new describe in package-namespace-rename-flow-refs-38595.test.ts (2 cases)
The source package is installed with its stored flow rows in the order
crm_parent(asubflowstep callingcrm_child), thencrm_child; the test asserts that order. It is then duplicated intocrm2. The automation service holdsother_flow,crm_child,crm_parent, nevercrm2_child.Measured at 2af21e1 (merge of
mainplus the test, before the fix), the gate refuses.duplicated.failedwas, verbatim:and only
crm2_childwas copied (Tests 2 failed | 6 passed (8)). With the fix (300cf74) the case passes:failedis empty, both flows are stored andcrm2_parentcallscrm2_child.CONTROL, the gate is live in this harness: a third flow
crm_callercallscrm_ghost, which the engine holds at the source install and no longer at the copy, and the package holds no such flow. The copy keeps the namecrm_ghost, and with the fix the duplicate still refuses exactlyflow/crm_callerwithflow-subflow-unknownwhile both other flows are copied. So the plan names let through only the copy's own flows.Withdrawal pins (third round), same describe (2 cases)
crm_parentcallscrm_child, andcrm_childcallscrm_ghost, which the engine holds at the source install and drops before the duplicate.failedholdsflow/crm_childandflow/crm_parent, and the parent's error names'crm2_child'. No flow of the copy is stored, no stored copied flow calls a flow the deployment does not hold, and the copy's object is still copied.crm_atocrm_btocrm_c, withcrm_ccalling the droppedcrm_ghost. All three end infailed[](the errors ofaandbname'crm2_b'and'crm2_c').crm2_solo, outside the chain, is the only copied flow, and nothing copied calls a missing flow.crm_ghostCONTROL pass unchanged:Tests 10 passed (10)for the card file at 712fda7.Ablations, each run after the fix commit 28e4856 with
scripts/ablation-replace.mjs:if (withdrawn.length === 0) break;becameif (withdrawn.length >= 0) break;(blob4ca8e112244cto6eec66471fb7). Result:Tests 2 failed | 8 passed (10). (a) fails withexpected [ 'flow/crm_child' ] to deeply equal [ 'flow/crm_child', 'flow/crm_parent' ], which is L1's measured state, and (b) fails withexpected [ 'flow/crm_c' ] ….4ca8e112244cto378006812f35). Result:Tests 1 failed | 9 passed (10). Only (b) fails, withexpected [ 'flow/crm_b', 'flow/crm_c' ] ….git diff HEADempty.Ablation of the second round's line
The fix was committed first (300cf74).
node scripts/ablation-replace.mjsreplaced the guard...(singular === 'flow'of the new spread with...(false(anchor 1 to 0, blobd064b03b149atof110fae517f4). The card test file then failed both new cases (Tests 2 failed | 6 passed (8)): the parent-first case with the refusal above, the CONTROL becausecrm2_parentwas refused besidecrm_caller. The tool restored the file: blob equal to HEAD,git diff HEADempty.Package run at 712fda7 (third round)
pnpm --filter @objectstack/metadata-protocol typecheck && pnpm --filter @objectstack/metadata-protocol exec vitest run --maxWorkers=2under the verify lock:VERDICT command-exit 0,Test Files 374 passed | 9 skipped (383),Tests 23690 passed | 45 skipped (23735). The 69 familiesdispatch-gates --commandsderives for this round's four paths: 67 exit 0.check:dual-build-cjs-loadsandcheck:lean-entry-closureexit 3 (PREREQUISITE NOT MET: they read every package'sdist), so they are NOT MEASURED here and left to CI.overlap-check: clean.Package run at 964a326 (second round)
pnpm --filter @objectstack/metadata-protocol typecheck && pnpm --filter @objectstack/metadata-protocol exec vitest run --maxWorkers=2under the verify lock, after building the closure (pnpm --filter '@objectstack/metadata-protocol^...' build):VERDICT command-exit 0,Test Files 374 passed | 9 skipped (383),Tests 23688 passed | 45 skipped (23733). The card pins after the merge (package-namespace-rename-flow-refs-38595.test.ts,package-namespace-rename.test.ts,package-unmanaged-install.test.ts):Test Files 3 passed (3),Tests 152 passed (152).Package run at 5ec669b (first round)
pnpm --filter @objectstack/metadata-protocol typecheck && … exec vitest run --maxWorkers=2under the verify lock:VERDICT command-exit 0,Test Files 373 passed | 9 skipped (382),Tests 23670 passed | 45 skipped (23715). The typecheck program lists the test files.Ablation
The fix commit came first. Then
scripts/ablation-replace.mjsswapped the one line that fills the flow rename map for a no-op (anchor 1 to 0, blobe90813508b99to114356add0b3). With that in place, 9 of the 13 new cases failed (Tests 9 failed | 26 passed (35)): every rewrite pin on both test files. The four that stayed green were the three controls and the parity case, which stays equal when both doors are equally wrong. The tool then restored the file: the blob matched HEAD again andgit diff HEADwas empty.Under PR #38594's gate (head 93f3643)
In a throwaway tree at that head, with this branch's two commits cherry-picked, the closure was built and both test files passed (
Tests 42 passed). With the same ablation there, the install pins fail with the gate's own 422:INVALID_METADATA,flow-subflow-unknownatflows[0].nodes[1].config.flowName, "calls flow 'crm_child' … Did you mean crm2_child". So the gate is live in this harness and the pins pass under it, without depending on its code. The tree was removed afterwards.Acceptance notes
The parent-first duplicate is fixed in this PR now. The first round reported that with this branch and PR fix(lint)!: the publish gate refuses a subflow or map step that calls a flow the deployment does not hold #38594 both applied, a parent-first
duplicatePackagefailsflow-subflow-unknownand writes only the child. PR fix(lint)!: the publish gate refuses a subflow or map step that calls a flow the deployment does not hold #38594 merged without a copy-plan on its duplicate leg, so the seat routed the fix here (claim amendment 7266007014). It was re-measured on the merged tree (see Tests) and fixed on the duplicate leg'ssaveMetaItemcall alone.The
copyPlanFlowNamesdoc comment inprotocol-door-requests.tssaid "duplicatePackagecopies stored rows, which the gate's own read of the stored flows already holds". That stopped being true once the copy's calls name the copy's flows. Per claim amendment 7266793287, 48420e0 rewords that comment only: both copy doors state the field, the names the same copy writes under their written names. In the third round (712fda7), the comment and the changeset sentence say the gate is told the flows the copy PLANS to write. They also say that on the duplicate, a caller whose planned callee was not written is withdrawn with it. No logic changes; metadata-protocol typecheck exits 0, and the 48 familiesdispatch-gates --commandsderives for that path ran with 46 at exit 0 andcheck:dual-build-cjs-loads/check:lean-entry-closureat exit 3 (PREREQUISITE NOT MET, left to CI).Measured with the same engine probe, outside this card: the names of other non-object items (dashboard, page, report) are renamed by the prefix swap, but their references are not. That covers app navigation's
dashboardName/pageName/reportNameand a translation'sdashboards/pages/reportskeys. A dashboard header action withactionType: 'flow'keeps itsactionUrl. These are reported to the seat as one family. They are not fixed here.Outside the dispatched file surface, added by the PM's amendment:
scripts/engine-double-contract.pinned.jsongains 3 rows (15 lines) for the new test file's copied stub engine, produced bynode scripts/check-engine-double-contract.mjs --write. No existing row changed, andpnpm check:engine-double-contractexits 0 at fb44b0f and again at 964a326.Local gates at 964a326: the 77 families
dispatch-gates --commandsderives for this diff were run; 75 exit 0, andcheck:dual-build-cjs-loadsandcheck:lean-entry-closureexit 3 (PREREQUISITE NOT MET: they read every package's builtdist, which this worktree built only for the closure), so those two are NOT MEASURED here and are left to CI.overlap-check: clean againstorigin/main, feat(approvals): piece 4 — a step records the child runs it started, and the reconciler finishes an approval whose flow stopped (ADR-0162 item 8) #38618 and feat(objectql): a record in a closed state, and its lines, are closed to change (closedStates, ADR-0162) — trunk #38497.Read, not changed (for the seat): whether
importUnmanagedPackagehas the same gap on partial failure. It does not, as read at 712fda7. Its prepare pass refuses the whole install before the base exists if any item fails to convert or rename (422 or the rename refusal). ItscopyPlanFlowNamesis built fromprepared, which is exactly the items the write loop writes. AnysaveMetaItemthrow in that loop, and any object the batch settle refuses, goes throughrollBackUnmanagedImport, which deletes the whole new base. So on success every planned flow is written, and on failure nothing remains. The one residue is a rollback that itself fails. It is not silent:console.error, plus an answer saying the base could NOT be fully removed and must be uninstalled.Verification
Read first, by risk:
protocol-package-commits.ts, theduplicatePackageleg's close: the withdrawal block after the copy loop (the fixpoint, the undo and the error text), andplannedCalleesOfwithplanFlowSourcesabove the loop. Check that a withdrawn caller is removed fromcopiedand pushed tofailed[]exactly once.package-namespace-rename.ts, thedeepRewriteobject branch: the child-site expressionreferenceSiteOf(k) ?? (site && k === 'name' ? site : flowTargetSite(v, k))replaced the old boolean. Object sites must behave exactly as before.package-namespace-rename-flow-refs-38595.test.ts: the parent-first duplicate and its CONTROL, the source-still-installed case and the duplicate parity. (flowTargetSiteandFLOW_EXECUTOR_KEYSinpackage-namespace-rename.ts, the one hand-written site, were read in the first round's review.)Two-minute check:
pnpm --filter @objectstack/metadata-protocol exec vitest run --maxWorkers=2 src/package-namespace-rename-flow-refs-38595.test.ts src/package-namespace-rename.test.tsshould report 2 files and 39 tests passing.🤖 Generated with Claude Code
https://claude.ai/code/session_01ADHkmQJUGAAa5rz9Yi2DvW