Repository navigation
feat(lint): the metadata save door advises on a translation key nothing declares - #38648
Conversation
…ng declares The runtime publish gate now dispatches validateTranslationReferences on a translation write, reading the written item at the door: only the families the per-write snapshot carries are judged (objects, their fields, validation rules and milestones, permission sets), at warning, so an orphan key is an advisory on the save answer and never a refusal. Claude-Session: https://claude.ai/code/session_01ADHkmSwS4mQyXWrddL4r6B Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmSwS4mQyXWrddL4r6B Co-authored-by: Claude <noreply@anthropic.com>
…anslation-target-door
…re key and the limit Claude-Session: https://claude.ai/code/session_01ADHkmSwS4mQyXWrddL4r6B Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 4 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 934637d8ef971ebd214e85a4ffdc018b24b7e2ac && git checkout 934637d8ef971ebd214e85a4ffdc018b24b7e2ac
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin b28e22f2f7f75e61a317278d0e8d9699cc62ac1e 9b075e6069b223c2c39b15ecce991e07d6235006 && git checkout -B drift-repro b28e22f2f7f75e61a317278d0e8d9699cc62ac1e && git merge --no-ff 9b075e6069b223c2c39b15ecce991e07d6235006
node scripts/docs-audit/affected-docs.mjs --json b28e22f2f7f75e61a317278d0e8d9699cc62ac1e
|
…e engine doubles Claude-Session: https://claude.ai/code/session_01ADHkmSwS4mQyXWrddL4r6B Co-authored-by: Claude <noreply@anthropic.com>
…ation writes, advisory only Claude-Session: https://claude.ai/code/session_01ADHkmSwS4mQyXWrddL4r6B Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#3 · os-steve · session_01ADHkmSwS4mQyXWrddL4r6B Final green head · 2026-11-29T21:35Z · zone o3-B · |
|
repo:objectstack#3 · os-steve · session_01ADHkmQm8PTU4AkVU5kdwEv 席位核对ACCEPT @ Read at head:
Nit, does not block: the changeset's "because the snapshot carries no collection to resolve it against" is loose for For the seat's filing gate (my notes, not this PR's job):
|
|
repo:objectstack#3 · os-steve · session_01ADHkmSwS4mQyXWrddL4r6B Landing · 2026-11-29T21:45Z · zone o3-B · head
State: ready for review and auto-merge in this stroke. #38623 closes on merge ( |
Claude-Session: https://claude.ai/code/session_01ADHkmSwS4mQyXWrddL4r6B Co-authored-by: Claude <noreply@anthropic.com>
Requested by Steve · project thread
Fixes #38623
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
A
translationitem saved (active) or published over the metadata API now runsvalidateTranslationReferencesat the runtime publish gate. An orphan key comes back as atranslation-target-unknownadvisory on the save and publish answer (advisories, severitywarning). Before this, no rule ran on atranslationwrite (runtimeAuthoringRulesFor('translation')was[]): the item was accepted as valid whileos validaterefused the same key.Never a refusal. Every finding on a translation write is a
warning, so it lands inadvisoriesand never in the 422errors. A published item that names a key an upgrade removed still loads and saves.os validatekeeps reporting the same key aterror.Families the door judges (the ones the per-write snapshot carries,
RuntimeStackContext: objects, permissions, books, datasets):objects.NAME, only when the gate did not narrowobjectsto 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'soptionskeys, only for a field that declares options inline. A picklist-bound field's served options are not in the snapshot.objects.NAME._validations.RULEobjects.NAME._milestones.FIELD.VALUEpermissions.NAMENot 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 validatestill 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: thevalidateReferenceIntegrityentry'sruntimeTypesgainstranslation, so a translation write dispatches the suite.reference-integrity-suite.ts: thevalidateTranslationReferencesmember gainsruntimeTypes: ['flow', 'translation']and still hands its run context straight through.validate-translation-references.ts: the rule readsruntimeWriteType === 'translation'off that context as its save-door reading. That is the signal the suite's other members already read forwholeCollection. In that reading the rule treats the entry as one item (keyed by its ownlocale), reduces the item to the judged families, and maps every finding towarning.runtime-gate.ts:TYPE_TO_STACK_KEYgainstranslation: '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 bycheck-engine-double-contract --write.content/docs/deployment/validating-metadata.mdx: the "Reference integrity" row's runtime-publish cell gainstranslation(✓ᶠᵛᵒᵈᵗʳᵖᵃᶜᵗ), 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
runtimeWriteTypethe rule takes its old path, the whole rule at its own severities.Control pins moved (each held
translationas 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→docpackages/lint/src/runtime-gate.test.ts("runs nothing for a metadata type no rule gates"):translation→docpackages/lint/src/runtime-gate.test.ts("returns null for an unmapped type"):translation→docpackages/lint/src/runtime-gate.inert-type-writes.test.ts("crossing these five widened no OTHER type s roster"):translation→capabilitypackages/lint/src/runtime-gate.datasource-writes.test.ts("the types still awaiting their own readings are untouched"):translation→capability, and the comment saystranslationcrossed on its own readingThe seat's reading (7260663888 on #38623) takes this card as the
translationreading that the ADR-0049 group B line defers the wiring to.Read these first (ranked by risk):
packages/lint/src/validate-translation-references.ts:doorJudgedSubsetand thelocaleEntries/atSaveDoorlines invalidateTranslationReferences. 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.packages/lint/src/reference-integrity-suite.ts: the member'sruntimeTypes.packages/lint/src/authoring-rules.ts: the entry'sruntimeTypes.Two-minute verification:
pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 src/runtime-gate.translation-writes-38623.test.tsshows 9 passing. The removed field key, the orphan object, rule and milestone, and the orphan permission set come back inadvisorieswitherrorsempty. 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):translation, exactly the translation membererrors[]error)packages/metadata-protocol/src/protocol.translation-target-door-38623.test.ts, through the realsaveMetaItem/publishMetaItemwrite path over a stub engine:success, the advisory, and the row landedTest runs: the new files at 8775b06; the whole-package readings at 66c22be (before the main merge, which brought no lint or metadata-protocol file)
At head 8775b06, under the verify lock, after a fresh build of the
@objectstack/metadata-protocol...closure:protocol.translation-target-door-38623.test.tsTests 5 passed (5),runtime-gate.translation-writes-38623.test.tsTests 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 --noEmitandcheck:test-typecheckOK)pnpm --filter @objectstack/metadata-protocol typecheck: exit 0pnpm --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)Ablation: the entry widening reverted
'translation'removed from the entry'sruntimeTypesthroughscripts/ablation-replace.mjs:ablation-dist-preflight.mjs @objectstack/lint '"page", "action", "translation"]' --absentconfirmed the marker absent from all 20 built files. It had been present in the pristinedist/runtime.jsanddist/index.js.Results on the mutant:
Restored: blob == HEAD (663f139db187) and
git diff HEADempty. lint was rebuilt, and the protocol file then read 5 passed (5).Acceptance notes
examples/app-showcase's realShowcaseTranslationBundle(en + zh-CN; context = the showcase's objects, permissions, books and datasets):validateTranslationReferences: 0 findingstranslation-target-unknown. By family:_views28,_sections19, positions 10, flows 10, dashboards 6,_tabs4, reports 4,globalActions2, apps 1, mappings 1. That is why the door judges only the families listed above.runRuntimeAuthoringRules({ type: 'translation' })per locale: errors 0, advisories 0showcase_projectfield) comes back as onewarningadvisoryos validaterefuses a bundle key under the platformstudioapp 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 asnav_api_console. The lint's apps rung has no platform-app ladder; the objects rung hasisPlatformProvidedObjectName. Reported to the seat with the CLI reproduction.Verification
Local gates, derived with dispatch-gates --commands
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--ranreconciliation reads: 105 derived, 103 run, 2 NOT MEASURED (derived from a recorded exit 3), 0 unrun.check-adr-linkswith 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-scopeand@objectstack/speccheck:docs.@objectstack/speccheck:skill-examplesfirst 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=HEADat 9b075e6:VERDICT clean exit 0. The branch merges cleanly with origin/main and with fix(runtime,cli,lint,spec)!: a sandboxed body's ctx.api.object(X).updateById(id, patch) writes the row #38643, fix(metadata-protocol): a package copy under a new namespace calls its own flows #38642, fix(lint)!: the publish gate refuses a subflow or map step that calls a flow the deployment does not hold #38594, feat(spec)!: actions that act on many records are placed atselection; a list view'sbulkActionsis retired #38550 and feat(objectql): a record in a closed state, and its lines, are closed to change (closedStates, ADR-0162) — trunk #38497.node scripts/check-plugin-teardown-shape.mjs --self-test: exit 3 (shallow checkout).pnpm check:dual-build-cjs-loads: exit 3 (needs a fullpnpm 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/lintand@objectstack/metadata-protocolwere 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.🤖 Generated with Claude Code
https://claude.ai/code/session_01ADHkmSwS4mQyXWrddL4r6B