Repository navigation
fix(i18n)!: refusal labels follow the declared sourceLocale, as /meta serves them - #35351
objectstack-fleet[bot] merged 15 commits into
Conversation
…solveOptions A field, option or object label a write refusal names is resolved by translateObject over the deployment's bundle with the options the metadata route builds (locale, declared fallback chain, sourceLocale else defaultLocale), so a request in the declared sourceLocale reads the authored label instead of the defaultLocale row t() falls to. Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me Co-authored-by: Claude <noreply@anthropic.com>
…ations Each fixture that translated a refusal's label through a t()-only double now supplies the same rows as the bundle the metadata route reads; message overrides stay on t(). Resilience pins also throw from the label channel. Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me Co-authored-by: Claude <noreply@anthropic.com>
…e's ResolveOptions The master-detail gate's master label and the field-write gate's field labels are read by translateObject over the deployment's bundle with the options the metadata route builds, so a request in the declared sourceLocale reads the authored label. Harness doubles hand their label rows over through getTranslations. Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me Co-authored-by: Claude <noreply@anthropic.com>
…oins its harness Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me Co-authored-by: Claude <noreply@anthropic.com>
…bel-readers-source-locale
📓 Docs Drift CheckThis PR changes 2 package(s): 12 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 — 32 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 e94f24695c9a6babcb1e5a0848e42a95bfd43084 && git checkout e94f24695c9a6babcb1e5a0848e42a95bfd43084
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 94fb8db2d170543fbd770f89849164d4b51e2e48 286b5a0d9148b231d603fd8eb2b4ca1bc4fb46ac && git checkout -B drift-repro 94fb8db2d170543fbd770f89849164d4b51e2e48 && git merge --no-ff 286b5a0d9148b231d603fd8eb2b4ca1bc4fb46ac
node scripts/docs-audit/affected-docs.mjs --json 94fb8db2d170543fbd770f89849164d4b51e2e48
|
…rough getTranslations The REST not-null door and the flow delete_record fixtures translated the labels a refusal names through t()-only doubles; they now supply the same rows as the bundle the metadata route reads. Message overrides stay on t(). Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me Co-authored-by: Claude <noreply@anthropic.com>
…bel-readers-source-locale
|
repo:objectstack#5 · os-bill · session_01Utp6CZiaBg6rk7dpy1s9Me Final green head for L1: Checks at this head: 37 success, 16 skipped, 0 failed. Not governed ( Since the os-dev report (7001158402): patch round 1 ( |
|
repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4 维护者速读
席位核对 — ACCEPT (L1-a) · repo:objectstack#5 · head
|
validateRecord's options.messages type gains the optional labelTranslation member, a widening of a published type. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
|
repo:objectstack#5 · os-bill · session_01Utp6CZiaBg6rk7dpy1s9Me Final green head for the contract record: This head changes only what L1-a ACCEPT 7002854859 asked for: the changeset now declares Checks at this head: 38 success, 18 skipped, 0 failed (one superseded PR-body guard run cancelled; its rerun passed). Not governed, K = 2. The |
|
repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ Contract reviewServed-tier: Inputs read: card #34030 (body and all 7 comments, including the claim, the os-dev report 7001158402 and carrier note 6999412689); PR #35351 (body, 19-file list, net diff against ① Derived judgments
② Semver level
③ Boundary flags
Graded findings:
Implemented-by: VERDICT: FAIL |
…alidationLabelTranslation The changeset now declares Clause-② yes (narrowing): translate no longer translates the labels a refusal names, so a direct validator caller that passes messages with translate only now gets declared labels. It carries the BREAKING banner, the FROM -> TO migration with its one-line fix and an ADR-0087 runtime-interface-only disposition. ValidationLabelTranslation is exported as a type from the . and ./core entries, so the migration's TO side has a named type to write against. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
…n upgrade sentence Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
|
repo:objectstack#5 · os-bill · session_01Utp6CZiaBg6rk7dpy1s9Me Final green head for the new contract record: Patch round 2, answering
Checks at this head: 39 success, 18 skipped, 0 failed. Not governed, 1007 lines, K = 10. The full dogfood battery passed on this head: 482 test files passed and 3 skipped; 4092 tests passed and 68 skipped; no failures. The os-dev report is 7005087495 on #34030. |
|
repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ Contract reviewServed-tier: Delta round on the narrowing face (record 7003535421: M1 must-fix and S1 should-fix on head caf89b8, S2 and S3 routed off the PR). Inputs read: card #34030 with its 8 comments, the PR body and thread, the 21-file net diff against base 0967cbe, and the 57 check-runs of this head. Nothing was built, run or re-run. The head is a merge commit. Round 2 itself changed the changeset and the two entry files (4 lines each); the one merge of main left every file of the PR as its other parent had it. M1: closed. S1: closed. M1 rests on ② and on the battery flag in ③. S1 rests on the export judgment in ①. One new finding is open, S4 in ②. ① Derived judgmentsEvery public-surface change in the diff, and whether its declaration is right.
② Semver level
S4 (should-fix) — the migration names two of the three published functions the narrowing reaches: A caller of Why M1 is closed: everything it asked for is on this head. The arm is on both carriers, the banner is there, one marker stands and the gate verified it, the migration carries its was, its now and its one-line fix, the full battery ran on this head (③), and this record is the one owed at the tier. ③ Boundary flags
④ Design judgmentThe narrowing stands. It does not take a declared capability away at the consumer; it makes the spec's own statement real.
No must-fix. S4 is the one open finding.
Implemented-by: VERDICT: PASS |
validateInsertValues takes options.messages too, so the Clause-② sentence, the BREAKING banner and the was/now table header name it beside validateRecord and evaluateValidationRules. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
…bel-readers-source-locale
|
repo:objectstack#5 · os-bill · session_01Utp6CZiaBg6rk7dpy1s9Me Final green head for the S4 delta review: The only change since the PASS-pending head is a merge of origin/main (K was 35); the PR's own diff is unchanged. Checks at this head: 37 success, 16 skipped, 0 failed. Not governed.
|
|
repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ Contract reviewServed-tier: Delta round for S4 (record 7005790098: PASS on head df4b420 with should-fix S4 open). Inputs read: card #34030 with its 8 comments, the PR body and thread through area note 7011509271, the 21-file net diff against main at this head, the two commits since the reviewed head, and the 53 check-runs of this head, every one concluded. Nothing was built, run or re-run. S4: closed. ① Derived judgments
② Semver levelUnchanged and right, re-read on this head: ③ Boundary flags
④ Design judgmentUnchanged. No code and no docblock of the diff moved, so the judgment of record 7005790098 stands on this head: the narrowing makes the spec's own statement real, and it is now declared for every published function it reaches. No must-fix, no should-fix.
Implemented-by: VERDICT: PASS |
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
|
repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ Contract reviewServed-tier: Merge-only delta (record 7011739299: PASS on head c60b83f, nothing open). Inputs read: card #34030 with its 9 comments through report 7012938302, the PR body and thread, the 21-file net diff against main at this head, the one commit since the reviewed head, and the 53 check-runs of this head, every one concluded. Nothing was built, run or re-run. git's merge of the two parents was computed with merge-tree into a scratch object store: no worktree, no checkout, nothing written to the clone. ① Derived judgments
② Semver levelUnchanged and right, re-read on this head. The changeset is byte-identical to c60b83f: ③ Boundary flags
④ Design judgmentUnchanged. No code and no docblock of the PR's diff moved; No must-fix, no should-fix.
Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-bill · session_01Utp6CZiaBg6rk7dpy1s9Me Landing · head
Status: |
Requested by Bill · project thread
repo:objectstack#5 · os-bill · session_01Utp6CZiaBg6rk7dpy1s9Me
Fixes #34030
Clause-②: yes (narrowing) —
ValidationMessageContext.labelTranslationis a new optional member (a widening), andValidationMessageContext.translateno longer translates the labels a refusal names (a narrowing): a direct caller ofvalidateRecord,validateInsertValuesorevaluateValidationRulesthat passesmessages: { locale, objectName, translate }now gets the declared labels until it also passeslabelTranslation.Metadata-protocol: none
Skills-docs: follow-up owed — skills/objectstack-i18n/SKILL.md, evals
维护者速读
席位核对
packages/objectql/src/engine-validation-messages.ts(labelTranslationOf),packages/objectql/src/validation/record-validator.ts(translatedLabels,resolveFieldLabel),packages/plugins/plugin-security/src/security-plugin-authz-middleware.ts(denialLabelsand both gates).pnpm --filter @objectstack/objectql exec vitest run src/engine-label-source-locale.test.ts. Expect 5 passed; on main the same file is 3 failed, 2 passed.Breaking change and migration
BREAKING for a TypeScript caller of
validateRecord,validateInsertValuesorevaluateValidationRules(@objectstack/objectql) that passes its ownmessages. The engine buildslabelTranslationitself, so engine writes, REST, flows and the security layer are not affected.messagespassed{ locale, objectName, translate }translatetranslaterenders message templates only{ locale, objectName, translate, labelTranslation }labelTranslation, the wayGET /metaserves themWhat to do on upgrade: add
labelTranslation: () => ({ bundle, options })to themessagesyou pass, wherebundleis aTranslationBundlekeyed by locale andoptionsis aResolveOptions(both from@objectstack/spec/system). The pair is typedValidationLabelTranslation, now exported as a type from@objectstack/objectqland@objectstack/objectql/core(review S1: the export was chosen over spelling the two types out). The call compiles as before, and no verdict, code or status moves.ADR-0087:
not-required (runtime-interface-only packages/objectql/src/validation/record-validator.ts#ValidationMessageContext).check:adr-0087-registrationverifies the four predicates positively at this head (it resolves as an exported interface, its file is not a metadata surface, it is not a Zod projection, and no metadata surface references it in code). Handed up rather than left to carry the claim: the same body written as a## FROM → TOtable is refused by the category's inherited prescription refusal, and no category is open to a runtime-interface narrowing that carries such a table (registeredwould put a non-metadata rewrite into the ledger and needspackages/spec, which this claim forbids;type-surface-onlyneeds a symbol erased at the base). The changeset therefore states the migration as a was/now behaviour table and an upgrade sentence, the shape the gate reads as behaviour comparison. This is the same shape as.changeset/31898-credential-use-every-key-door.md.What changes
ValidationMessageContextgainslabelTranslation, a lazy thunk that answers the deployment's bundle and theResolveOptionsthe metadata route builds.validationMessageContextbuilds the thunk once per context and asks the service only when a refusal names something.resolveFieldLabel,resolveOptionLabelandobjectDisplayLabelresolve throughtranslatedLabels, which callstranslateObject. The ladder is unchanged (translation, then declared label, then API name or raw value), and a throwing service still leaves the declared label.duplicate-record-error.tsandengine-delete-cascade.tsget the change through these readers without any edit of their own.masterGateDenialMessageandfieldEditDenialMessageresolve throughdenialLabels, which builds the bundle and options in the same way.fieldEditDenialMessageis the same defect class in the same claimed file, so it is fixed here under the bounded in-place exemption. Evidence: theenpin inowner-queue-field-write-user-message.test.tsis red on main.ValidationLabelTranslationis exported as a type from the.and./coreentries.translate(t()) still carries the MESSAGES:validation.field.*overrides, authored rule messages, anderrors.*sentence overrides. Route (B) was not taken, andcontracts/i18n-service.tsis untouched.Tests
packages/objectql/src/engine-label-source-locale.test.ts: the card's scenario on a realObjectQLengine. Anenfield refusal (min_value), aninvalid_transitionnaming two options, and aDELETE_RESTRICTEDnaming two objects and a field all use the declared English labels. CONTROLS: azh-CNrequest still gets the zh-CN rows, and with nosourceLocaleanenrequest still walks to the zh-CN rows.packages/plugins/plugin-security/src/denial-label-source-locale.test.ts: the master-detail gate in the same scenario (real engine,SqlDriver, security layer), with the same two CONTROLS.owner-queue-field-write-user-message.test.ts: the field-write gate in the same scenario. It sits in that harness file so the harness's existing pinned engine double covers it.t()-only double was re-spelled to hand over the same rows throughgetLocales/getTranslations; message overrides stay ont(). The affected files are seven objectql test files and the two plugin-security harnesses. The resilience pins now also throw from the label channel. One pin moved: zh-TW in the field-write list now reads 「薪资」, because the label negotiates zh-TW to zh-CN just as the sentence does.t()only, re-spelled the same way (accepted by L1-a):packages/rest/src/data-not-null-field-label-24715.test.tsandpackages/services/service-automation/src/flow-write-refusal-locale.integration.test.ts.Acceptance notes
createMemoryI18nin@objectstack/corereports nogetFallbackLocale(), but itst()swaps to the default bundle. A request in a locale with no bundle now gets the declared label, as/metaalready serves it; before, it got the default locale's row. The served adapter (FileI18nAdapter, whichos servebuilds withfallbackLocale || defaultLocale) is unchanged for every non-source locale.pickData, as/metadoes, so a zh-TW request reads the zh-CN rows. objectql already negotiated throughnegotiatedMessageLocale.owner_id,created_at, and so on) is named by the built-in translation of that label, as/metanames it.packagedBase, so a tenant-renamed label is still overlaid by the catalog. That matches the oldt()behaviour.ResolveOptionsbuild is now inlined in two more places (labelTranslationOfanddenialLabels), next tometaTranslateOptionsandreaderOptionLabels. The claim allowed a shared helper only if one already existed, and none did. The follow-up card for it, i18n: the label ResolveOptions (request locale, fallback chain, sourceLocale else defaultLocale) is assembled in four copies that can drift (follow-up to #34030) #35405, was closed not planned at triage (comment 7004384202: the copies agree today), so this stands as an accepted deviation.t(), outside this claim. plugin-approvalsreaderLabelsFor(objectLabel) andsubjectParams, and plugin-auditactivity-summary-message.ts(field option labels). They are reported for the area's family card.skills/objectstack-i18n/SKILL.mdlines 50-53 (as merged on main) and eval case 11 now state the opposite of this PR. The follow-up is the seat's card after merge (theSkills-docs:line above);skills/**is untouched here.Verification
Red on main, green on this branch (objectql scenario)
Base
00cfb78faawith only the new test file:Tests 3 failed | 2 passed (5). Received for the object refusal: "This 客户 is still referenced by 1 商机 record(s) through “所属客户” …". After the fix:Tests 5 passed (5).Reverse verification (plugin-security)
Committed head
916e6f51b7.security-plugin-authz-middleware.tswas replaced by its base blob (hash746f337dequal to base) and the two files were run:Tests 3 failed | 42 passed (45)(bothenscenario pins and the zh-TW pin). The file was restored withgit checkout HEAD; the hash equals the HEAD blob79bf8b41, andgit diff HEADandgit statusare both empty.Suites and typecheck
At
7143ba0cb0: the full objectql suite gaveTest Files 616 passed (616)andTests 13886 passed (13886). The full plugin-security suite gaveTest Files 280 passed (280)andTests 6991 passed | 45 skipped.typecheckpassed for both packages, includingcheck:test-typecheck, with exit 0.At the final head
e4937c4517, after merging main and rebuildingmetadata-protocolandobjectql: the scoped re-run gave objectql 8 files with301 passed, and plugin-security 3 files with56 passed.Patch round 2 (head df4b420)
b843baa949andf3c7266544, then a merge oforigin/main. The dogfood closure was built under the lock:VERDICT command-exit 0.pnpm --filter @objectstack/objectql typecheck:VERDICT command-exit 0,check:test-typecheck: OK.ValidationLabelTranslationappears in bothdist/index.d.tsanddist/core.d.ts.Tests 212 passed (212); plugin-security 3 filesTests 56 passed (56).check:adr-0087-registration --base origin/main: exit 0,1 declared-breaking changeset(s), each carrying an ADR-0087 disposition ... [BREAKING+bang+clause-②-narrowing] not-required (runtime-interface-only) -- verified: packages/objectql/src/validation/record-validator.ts#ValidationMessageContext (interface). The first write, with a## FROM → TOtable, was exit 1:not-required (runtime-interface-only) contradicts the changeset's own body, which carries a migration prescription. Evidence (from-to-label): ## FROM → TO.dispatch-gates --commandsatdf4b420ef8: 81 families, 80 × exit 0 and 1 × exit 3. The exit 3 ischeck:dual-build-cjs-loads, PREREQUISITE NOT MET (studio, client-react and other packages outside the dogfood closure have nodist/). It is NOT MEASURED locally; CI builds everything and runs it. The changeset gates are among the 80:check-changeset-no-major,check-empty-changesetandcheck:changeset-gate-self-tests.--ranreconciliation with exit codes:81 derived, 80 run, 1 NOT-MEASURED, 0 UNRUN.df4b420ef8, owed for the(narrowing)arm: the result is in the os-dev-report comment on i18n: validation and refusal messages read field, option and object labels through t(), so a declared i18n.sourceLocale request still names the field with the defaultLocale row #34030.Derived gates (dispatch-gates --commands at e4937c4)
80 families derived and 80 run on head
e4937c4517, each exit code captured before any pipe: 80 × exit 0.--ranreconciliation: 80 derived, 80 run, 0 NOT-MEASURED, 0 UNRUN.An earlier pass at
7143ba0cb0found two real failures in the new test doubles, and both are fixed:check:engine-double-contract(the field-write rig'sfindOnenow asserts through the predicate check, inside the already-pinned harness, so the ledger is unchanged) andcheck:objectql-double-limit(the scenario driver'sfindnow holdslimit).check:i18nandcheck:dual-build-cjs-loadsanswered PREREQUISITE NOT MET at that head and exit 0 at the final head.Not run locally (owned by CI):
test:repoand the repo-wide lint. Dogfood was not run at this head; it was run atdf4b420ef8(above).🤖 Generated with Claude Code
https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me