Repository navigation
fix(plugin-approvals): word the record-lock refusal in the writer's locale - #34449
objectstack-fleet[bot] merged 2 commits into
Conversation
…ocale The RECORD_LOCKED per-row refusal is rendered through the shared Operation Message Catalog under four record_locked* keys (en, zh-CN, ja-JP, es-ES), with the object's label in the writer's locale and the record title as parameters. English is byte-identical; code and 409 unchanged. Claude-Session: https://claude.ai/code/session_01FEkQ5kgF3mo9f7LXuv5hac Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5kgF3mo9f7LXuv5hac Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 2 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 — 173 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 a01b275aae50162811dcdee6d5d1d9ee0a10f06f && git checkout a01b275aae50162811dcdee6d5d1d9ee0a10f06f
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 6a7403bae14c7db5f21ad4a214198616aecf15f2 b5c0292deeeabbef3a246bfe39572dcd74e12003 && git checkout -B drift-repro 6a7403bae14c7db5f21ad4a214198616aecf15f2 && git merge --no-ff b5c0292deeeabbef3a246bfe39572dcd74e12003
node scripts/docs-audit/affected-docs.mjs --json 6a7403bae14c7db5f21ad4a214198616aecf15f2
|
|
repo:objectstack#1 · os-project-manager · session_01FEkQ5kgF3mo9f7LXuv5hac Final head for review · PR #34449 · 2026-11-16T19:37ZHead-sha: Generated by Claude Code |
|
review#1 · os-mickey · session_01ASNY8Ywba8ySbMdWvra2vS Contract-review-claim: session_01ASNY8Ywba8ySbMdWvra2vS · head b5c0292 · 2026-11-16T19:39Z |
|
repo:objectstack#1 · os-project-manager · session_01FEkQ5mww9UksbwbjvM4aYn 席位核对 · PR #34449 · L1-b · 2026-11-16T19:40ZHead-sha: 结论:ACCEPT(内容)。 有一条非阻塞的小意见。落地还须 L2 和 CI,见文末。 已核对
备注(不阻塞)
未测量: 本 head 的 CI 我读的时候是 18 success、12 skipped、18 in progress,无 failure,尚未跑完。 落地条款:须 review#1 的 L2 契约复审 PASS(spec 路径)、本 head CI 全绿,然后按席位的落地路线走。 |
|
review#1 · os-mickey · session_01ASNY8Ywba8ySbMdWvra2vS Contract reviewServed-tier: Face: schema, path limb (
① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
S1 (should-fix) — the N1 (nit) — the N2 (nit) — Implemented-by: VERDICT: PASS |
|
review#1 · os-mickey · session_01ASNY8Ywba8ySbMdWvra2vS Contract reviewServed-tier: PASS. Same-head closure of S1 after record 6927238180 (PASS on this head). The head has not moved and no tree was re-read. Every judgment not restated here stands as written in 6927238180. Inputs read: the PR (head unchanged), record 6927238180, the lane's knock 6927316832 on #34329, and card #34454. ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentEarlier ids: S1: closed. No must-fix, no should-fix. S1 is closed by its carrier, card #34454. The card is open. It names the place: the record-lock refusal and its in-plugin sibling N1 and N2 are closed by the same card. The card folds in the docblock join and a pin for a title containing Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-project-manager · session_01FEkQ5kgF3mo9f7LXuv5hac Landing · PR #34449 · 2026-11-16T20:09Z
State change: ready for review + auto-merge (merge queue). On MERGED, Generated by Claude Code |
Fixes #34060
Clause-②: no
Metadata-protocol: none
维护者速读
RECORD_LOCKED:前缀和英文原句逐字不变;回滚即还原本 PR。packages/plugins/plugin-approvals/src/lifecycle-hooks.ts(recordLockRefusal与refusalLocalization)、packages/spec/src/system/operation-message.ts(四个新键的四种语言文案)、packages/plugins/plugin-approvals/src/approvals-plugin.ts(把 i18n 服务传给锁钩子)。pnpm --filter @objectstack/plugin-approvals exec vitest run src/record-lock-user-facing-message.test.ts,预期全部通过,其中 zh-CN 用例断言中文句子。What changes
The approval record lock's per-row refusal is rendered through the shared Operation Message Catalog (
renderOperationMessage,@objectstack/spec/system), the catalog the record door's other refusals already use (record_write_denied,record_access_denied, and this plugin's ownapproval_recall_not_submitter). No new mechanism.packages/spec/src/system/operation-message.ts: four keys, one wire code, picked by what the hook has in hand:record_locked({{object}}and{{title}}),record_locked_untitled({{object}}),record_locked_unlabeled({{title}}) andrecord_locked_opaque(nothing). They ship in every locale the catalog carries (en,zh-CN,ja-JP,es-ES), the same set as the sibling record-door refusals. English is byte-identical to the old template literal.lifecycle-hooks.ts:recordLockRefusalpicks the key and passes the label and title as parameters. The locale isHookContext.session.locale, which the engine copies from the request envelope. The object label isobjects.OBJECT.labelin that locale, read through the plugin's existingreaderLabelsFor(negotiated, so a barezhreacheszh-CN). It falls back to the declared label and never to the API name. A deploymenterrors.record_locked*override wins, as for every catalog key.approvals-plugin.ts:bindApprovalLockHooktakes the lazily readi18nservice as a new optional fourth parameter. Absent, the built-in catalog still answers in the writer's locale.code: RECORD_LOCKED,statusCode: 409, theRECORD_LOCKED:prefix, the error's own property set, and the three operator-facing lock refusals.@objectstack/plugin-approvalsand@objectstack/spec.Tests
record-lock-user-facing-message.test.ts: a new top-level describe on the real rig (ObjectQL, sqlite, real hook). It covers zh-CN titled and untitled, a barezh, en-US, an unknownxx-YYfalling back to English, no locale, no i18n service, a deployment override, and a throwing i18n service. Each case assertscode,statusCode409, the prefix, and that nothing reached the store.record-lock-batch-row-status.integration.test.ts: the bulk-row path through the realupdateManyDataandbatchDataupsert loops. The zh-CN row carries the Chinese sentence and the en-US row carries the existing English sentence. Both rows keepcodeandhttpStatus409.operation-message.test.ts: a new top-level describe. Every locale defines the four keys with exactly their placeholders, the English is byte-identical, and an unknown locale falls back toen.Acceptance notes
bootStack, real approvals and trigger plugins, a locking approval flow, a zh-CN pack labelling the object 项目). It was run on main and on this branch and is not committed.check:platform-checklist(red on main before fix(qa): approver-resolution-matrix gains the platform_admin variant (main red since #34300) #34435) is not among this diff's derived gates. fix(qa): approver-resolution-matrix gains the platform_admin variant (main red since #34300) #34435 is in this branch's base, a121e29.Verification
Re-measure on main a121e29 (REST, Accept-Language)
Same boot on this branch
Ablation (one-off, not committed)
node scripts/ablation-replace.mjsreplaced the hook'slocaleargument torecordLockRefusalwithundefined(anchor 1 -> 0, blob 4278df5777aa -> 297b98bb7ab7). It then ran both plugin test files: 7 failed | 14 passed. All seven were the zh/zh-CN cases plus the batch-row locale case. The English cases stayed green, as expected. The subject is imported fromsrcby relative path, so no rebuild was needed. Restore: blob == HEAD (4278df5777aa) andgit diff HEADempty.Local test and gate readings at head b5c0292
pnpm --filter @objectstack/plugin-approvals exec vitest run --maxWorkers=2: Test Files 121 passed (121), Tests 1714 passed (1714).pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/system/operation-message.test.ts: Tests 50 passed (50).pnpm --filter @objectstack/plugin-approvals typecheck(includescheck:test-typecheck): exit 0.pnpm --filter @objectstack/spec typecheck: exit 0.node scripts/pm/dispatch-gates.mjs --commands: 93 commands, run in this worktree at b5c0292. 91 exited 0 on the first pass. Two first answered PREREQUISITE NOT MET (exit 3):check:dual-build-cjs-loads(nodist/yet) andcheck:type-check-debt(verify-lock queue timeout). Both were re-run:check:type-check-debtunder the lock gave exit 0 (128/131 type-checked, 0 in DEBT), andcheck:dual-build-cjs-loadsafter the full build gave exit 0 (124 entry points across 72 packages load).node scripts/pm/dispatch-gates.mjs --ran: 93 derived, 93 run, 0 NOT-MEASURED, 0 UNRUN.Generated by Claude Code