Repository navigation
fix(spec,metadata-protocol): a view's packaged translation catalog yields to a published org overlay (#20731) - #20770
Conversation
…elds to a published org overlay Claude-Session: https://claude.ai/code/session_01DEvba2nBuD4tWzfq8r8NFY Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DEvba2nBuD4tWzfq8r8NFY Co-authored-by: Claude <noreply@anthropic.com>
…ew-catalog-override
…uble-contract ledger Claude-Session: https://claude.ai/code/session_01DEvba2nBuD4tWzfq8r8NFY Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 2 package(s): 10 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 3 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 138 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 1d5dcc10a9e972aaeb43a8377400cd597d9d9d04 && git checkout 1d5dcc10a9e972aaeb43a8377400cd597d9d9d04
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 7053333e1e2194cea2e21d8b2e1c9b6f081fcfa6 64f47976620529c3d3938a3240eab5233c10e248 && git checkout -B drift-repro 7053333e1e2194cea2e21d8b2e1c9b6f081fcfa6 && git merge --no-ff 64f47976620529c3d3938a3240eab5233c10e248
node scripts/docs-audit/affected-docs.mjs --json 7053333e1e2194cea2e21d8b2e1c9b6f081fcfa6
|
Contract reviewServed-tier: Head re-read twice this act and unmoved. Inputs, and nothing else: card #20731 (body; triage 5901376430; claim 5903072480; os-dev-report 5903655620), PR #20770 (body, its 7-file list, the net diff against Check-runs on the head, read at 2026-09-30T04:40Z: 35 in all; 32 completed ① Derived judgmentsAccept-set: unchanged — right. No Zod schema, authorable key, conversion or migration registry is in the diff; Public surface,
Public surface,
Ledger. Shipped prose, sentence by sentence.
② Semver level
③ Boundary flagsDev flags, from the os-dev-report deviations and the PR body:
Implemented-by: VERDICT: PASS Generated by Claude Code |
Part of #20731. This PR lands the two producer halves that triage (5901376430) assigned to this card: the translator rule in
@objectstack/specand the packaged-view accessor in@objectstack/metadata-protocol. The card should stay open after this merges, because the/metaview arm inpackages/reststill hands no base (see "Not in this PR"). Triage routes that arm onto #20730's per-type base resolver as one more arm. It is filed as a per-layer child, or added to #20730's PR, whichever the seats agree.Clause-②: yes
Reproduced first, at the translator and protocol layer
Harness. A scratch vitest file in
packages/objectql(not committed). It builds a realSchemaRegistryand registers adefineViewcontainer the way the boot does: the container under the bare object key, then eachexpandViewContaineritem under its qualified name with a package id. It uses the realObjectStackProtocolImplementationover a read-only in-memorysys_metadatathat holds one published org overlay row:type: view,name: showcase_task.in_progress,package_id: null, the org,state: active, labelIn Progress (edited-20731). The catalog is keyed the way the showcase ships it (objects.showcase_task._views.in_progress.label, zh-CN进行中). I did not run a real/metaboot. The HTTP reading is the #20680 dev's probe3 (os-dev-report5900307018), and this probe reproduces it one layer down.origin/main33e4a5609c)dist)protocol.getMetaItemlabel (org read)In Progress (edited-20731)protocol.getMetaItemslabel (org read)In Progress (edited-20731)_packageIdcom.example.showcase(the artifact envelope)typeof protocol.getPackagedViewBaseundefinedfunctiontranslateView(served, zh-CN), no base进行中进行中(unchanged, by design)translateView(served, zh-CN), handed the packaged view进行中(the base was ignored)In Progress (edited-20731)translateMetadataDocument('view', …)zh-CN, with base进行中In Progress (edited-20731)In Progress (edited-20731)showcase_task.urgent, zh-CN紧急紧急In Progress,进行中So the write and both protocol reads agree on one identity, and the protocol serves the edit. The catalog applied over it because
translateViewtook no base: onorigin/mainits third parameter wasResolveOptions, and it never readpackagedBase, even when the generic dispatcher passed one.Hypotheses (the dispatch's zone 2), and which held
translateViewwas ati18n-resolver.ts:906andtranslateDashboardat:1407. The comparison is not written inline intranslateDashboard. PR fix(spec,metadata-protocol): a dashboard's packaged translation catalog yields to a published org overlay (#20680) #20728 already made it one private function,valueOverridesPackagedBase, behind the exportedscalarOverridesPackagedBase, so there was nothing to extract.translateViewnow calls that same function, so there is no second comparison. The dashboard-specific piece was the part finderpackagedDashboardPart, the lookup that finds the packaged counterpart of a widget, filter or option by key. It is renamed topackagedPart, its key union is widened, and both translators share it.translateDashboard's behaviour is unchanged (its 9 pins and the whole spec suite are green).getPackagedDashboardBasewas atprotocol.ts:7194. The view base comes from the same source,lookupArtifactItem. Views are top-level registry items. The objectql boot loop registers each view that adefineViewcontainer expands to as its ownviewitem, under the qualified nameOBJECT.VIEW_KEY, with the package id; it also keeps the container under the bare object key.objects.OBJECT._views.VIEW_KEYis only the catalog's layout, not a registry shape. The base mirrors the registry item, which is also the shape the overlay row and both reads carry. A view has no extension fold, so the artifact item is the packaged declaration.objects.OBJECT._views.VIEW_KEY.label, derived from the served name byviewTranslationKey, which strips theOBJECT.prefix. The base is matched by the served view's registry identity, the qualifiedOBJECT.VIEW_KEYname, never by the bare key. The bare key is unique only within one object; the showcase shipsin_progressviews on more than one object. Pinned inprotocol-packaged-view-base.test.ts:showcase_task.in_progressandshowcase_project.in_progresseach answer their own base, and the barein_progressanswersundefined. At the translator, every pin hands a qualified-name served document whose catalog sits under the bare key. I did not enumerate the example apps for a view whose registered name differs from its container key beyond the prefix. The only producer of that shape isexpandViewContainer's collision rename, which the build-time view-ref lint turns into a hard error.GET /api/v1/meta/view/:nameandGET /api/v1/meta/viewthroughRestServer's real route handlers, against this branch's rebuilt@objectstack/spec. The protocol double served the overlaid view and implementedgetPackagedViewBase. Results: item and list, zh-CN,进行中;getPackagedViewBasecalled 0 times.packagedObjectBaseOfinmeta-item-read-gate.tsreturnsundefinedfor every type butobject. So the defect stays observable over HTTP until the/metaview arm lands.What changes
translateViewtakesTranslateDocumentOptions; it previously tookResolveOptions, and the new type only adds the optionalpackagedBase. When a base is supplied, the catalog replaces a string only while that string still equals its packaged counterpart. The rule is ADR-0029 D9.2a's, and it is the same onetranslateObject(The i18n catalog is resolved ahead of the document, so a tenant's own Studio rename never reaches either/meta/objectread — and neither do extension scalar overrides #8284) andtranslateDashboardfollow. It covers:labelanddescription;label,confirmTextandconfirmLabel;label,helpandplaceholder.A def or param is matched by the
namethe bundle addresses it by. One that the base does not carry counts as authored ("a base that declares no such scalar"). With no base, the output is byte-identical to before.Why the bulk-action copy is included:
translateViewtranslates those strings too, and the rule belongs to the translator, not to one attribute. Leaving them out would mean that when the base is handed, an edited view label wins while an edited bulk-action label on the same view still loses. The measured reading is the label. The bulk-action cases are pinned but were not measured on a running app.ObjectStackProtocolImplementation.getPackagedViewBase(name)is the view twin ofgetPackagedDashboardBase. Both now delegate to one privatepackagedArtifactBase(type, name):lookupArtifactItemand nothing wider. It is shadow-immune to an overlay hydrated under the plain registry key. It answersundefinedfor a view no code package ships, for an unknown or empty name, and for a registry that cannot answer.getPackagedDashboardBaseanswers exactly as before (its 8 pins are green).Readers of the changed functions, and which served answers move
translateViewis reached throughtranslateMetadataDocument('view', …). In the serving path, that meanspackages/rest/src/meta-item-read-gate.ts, wheretranslateMetaDocument(item) andtranslateMetaList(list) passpackagedBase: packagedObjectBaseOf(…). That isundefinedforview, so no serving path supplies a view base today, and the new branch does not run in production until the/metaview arm lands. Measured: H4 above. The CLI'si18n-bulk-action-coveragetest drivestranslateViewwithout a base and is green (17 of 17).getPackagedViewBasehas no caller yet; the/metaview arm will be its first reader.packagedPartandvalueOverridesPackagedBaseare private.Published surface (for the Clause-② line)
@objectstack/spec: no export is added, removed or renamed (check:api-surface: "public API surface + factory signatures unchanged"). One exported function's parameter type is widened:translateView'soptsgoes fromResolveOptionstoTranslateDocumentOptions, and every existing call still compiles.@objectstack/metadata-protocol: one new public method,getPackagedViewBase, on the exportedObjectStackProtocolImplementation.minor, as the dispatch ordered:.changeset/20731-spec-view-catalog-override.mdand.changeset/20731-metadata-protocol-packaged-view-base.md.No documented rule is reversed
A value equal to the packaged declaration still gets the catalog, and so does a label written as an inline locale map, because only a string counts as an override (pinned). That keeps the case
content/docs/ui/translations.mdxdescribes: a package's own label against its own bundle. ADR-0029 D9.2a is applied one type further; nothing is reversed.Tests
The code and pins below are at
a3f753cead, which is the fix plus a merge oforigin/maina51920f5fb. The only later commit,64f4797662, adds one ledger row toscripts/engine-double-contract.pinned.json. The gates are at64f4797662.packages/spec/src/system/i18n-resolver.test.tsgains a block of 12 tests:en;The whole spec
localproject: 576 files, 17003 passed, 1 todo.packages/objectql/src/protocol-packaged-view-base.test.tshas 10 tests against a realSchemaRegistryand the real protocol:undefined);undefinedanswers;en, on item and list;The objectql
localproject: 339 files, 6714 tests, all green.@objectstack/metadata-protocol: 190 files passed (3 skipped); 2792 tests passed (19 skipped).typecheckis green for:check:scripts-typecheckand its test layer;tsconfig.scripts.jsonand its test layer.Reverse verification A (spec, source-resolved,
scripts/ablation-replace.mjs). The mutation fedtranslateViewno base:asRecord(opts?.packagedBase)becameasRecord((opts as any)?.ABLATION_20731). The anchor went from 1 to 0, and the blob went from1e7995c1148dto2f0943d33e2a.-t 20731turned 5 of 12 red: the edited label, every string kind, the tenant-added def or param, reset, and the dispatcher. It was restored with blob equal to HEAD andgit diff HEADempty. The per-string test stays green under this mutation by construction: it guards the other direction, withholding too much.Reverse verification B (the same mutation, through
dist). The spec was rebuilt, andablation-dist-preflightfound the marker in 4 built files. The objectql protocol pins turned 2 of 10 red: translation with the base (item and list, zh-CN and en), and reset. Restore leg: restore, rebuild,--absentover 230 built files, tree clean, 10 of 10 green.Reverse verification C (accessor, through metadata-protocol
dist).getPackagedViewBasewas made to answer the plain registry read, which is the shadow trap. After the rebuild the marker was in 2 built files, and 2 of 10 turned red: plain-key overlay immunity, and the no-code-package case. Restore leg: rebuild,--absentover 24 built files, tree clean, 10 of 10 green.Gates:
node scripts/pm/dispatch-gates.mjs --commandsderived 96 families at64f4797662, and I ran all 96. Three first answeredPREREQUISITE NOT METbecause they needed built output:check:dual-build-cjs-loads,check:lean-entry-closureandcheck:type-check-debt. They exited 0 afterturbo run buildover./packages/*and./packages/*/*.--ranreconciliation: "96 derived, 96 run, 0 NOT-MEASURED, 0 UNRUN".check:engine-double-contractasked for the new double to be recorded, soscripts/engine-double-contract.pinned.jsongains onefindOnerow, written by the gate's--write.Narrowed lint:
eslint --no-inline-config --format jsonover the 4 TypeScript files in the diff reported 4 files, 0 errors and 0 warnings. That population comes from the config's ownfilesglob,**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}; the other 3 changed paths are.mdand.json. The config never enables type-aware linting (its own comment says so: noparserOptions.project), so this diff cannot move the verdict for an untouched file.Not in this PR
/metaview arm (H4).packages/rest's item and list reads still pass no view base, soGET /api/v1/meta/view/showcase_task.in_progressandGET /api/v1/meta/viewinzh-CNkeep serving进行中over a published overlay until that arm lands. Triage routes it onto rest: the /meta dashboard item and list reads pass no packaged base to translateDashboard, so a published org overlay on a translated dashboard keeps the shipped widget title — per-layer child of #20680 #20730's per-type resolver as one more arm, callinggetPackagedViewBase(name)with the served qualified name. It is not a second resolver. rest: the /meta dashboard item and list reads pass no packaged base to translateDashboard, so a published org overlay on a translated dashboard keeps the shipped widget title — per-layer child of #20680 #20730 is not addressed here.content/docs/ui/translations.mdxshould state the view rule once the rule is observable, next to rest: the /meta dashboard item and list reads pass no packaged base to translateDashboard, so a published org overlay on a translated dashboard keeps the shipped widget title — per-layer child of #20680 #20730's dashboard sentence._viewslabels client-side over the served label (the dashboard twin's acceptance notes flag that shape for widget titles). Its carrier is the/metaview arm's browser verification.Acceptance notes
/metaarm. With this PR alone, no served answer changes. Measured at the REST route layer (H4), not in a real boot.origin/mainata51920f5fbbefore this PR opened. Since then,mainhas taken 3 commits (cba417a8f2,0d9349fea0,7053333e1e), and none of them touches these packages. The merge queue rebuilds on the currentmain.Generated by Claude Code