Repository navigation
fix(approvals): name an unstaffed position by its label on the timeline; system rows read as the system's - #36030
Conversation
…ne; system rows read as the system's The admin_rescue note a reader is served names an unheld position by the reader's pack label (positions.<name>.label), else its declared label (new optional ApprovalServiceOptions.positionLabelSource, wired to the metadata service), else its name. The stored English keeps the name. The console timeline names a row with no actor "System", and a comment row with no actor "System note" instead of "Commented · —". Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgT9mNgD8oKM93bFzg5
📓 Docs Drift CheckThis PR changes 1 package(s): 2 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 2 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 6 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 bc6aafdbc8f7ff0972552bb7c924149e0b5c6eef && git checkout bc6aafdbc8f7ff0972552bb7c924149e0b5c6eef
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 9a98a4675683a405aa911cd6c3e31f88bfe24151 064e714dfb19a7caed674bab07df13922349bf53 && git checkout -B drift-repro 9a98a4675683a405aa911cd6c3e31f88bfe24151 && git merge --no-ff 064e714dfb19a7caed674bab07df13922349bf53
node scripts/docs-audit/affected-docs.mjs --json 9a98a4675683a405aa911cd6c3e31f88bfe24151
|
…aming the position by its label Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgT9mNgD8oKM93bFzg5
|
repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob Posted 2026-11-21T09:10Z. The brief handed to the isolated declaration-face reviewer for PR #36030 (owed by the changeset's Contract review brief — PR #36030 @
|
|
repo:objectstack#1 · os-sales · session_01L6bhgXtcSJVbw8Gny1ERbP 维护者速读
席位核对 — ACCEPT (L1-c) · repo:objectstack#1 · head
|
|
repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob Contract reviewServed-tier: Inputs read: card #35418 (body, triage comment, claim comment), PR #36030 (body, 23-file list, the net diff ① Derived judgments
② Semver level
③ Boundary flags
Graded findings (none is must-fix or should-fix):
Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob Seat landing · 2026-11-21T09:18Z · The b1-CX thread's PR for #35418: a routing note names an unstaffed position by its label (the reader's pack, then the declared label, then the internal name) without touching the stored audit text, and the console names rows with no actor "System" and actorless comment rows "System note". |
…bjectstack-ai#36306) <!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XP3RHGWUG7UH3fNa4tBa9UC)_ repo:objectstack#4 · os-project-manager · session_01FEkQ5okniknzVVR3KTSVr1 Fixes objectstack-ai#36035 Clause-②: no Metadata-protocol: none ## 维护者速读 - 审批动态里「无人可审」那条系统说明不再显示岗位内部名:中文读者看到岗位的中文名(如「销售经理」),没有翻译时用岗位自己的显示名,都没有才退回内部名;英文审计原文不变。 - 接着上一轮「转交给管理员说明用岗位显示名」的修复,补上它留下的「无人可审」说明,属于控制台核心业务操作体验专题。 - 只改读取时的显示,库里存的审计原文和旧请求的说明都原样保留,转交规则不动;出问题可直接撤回。 - 无。 ## What changes 1. **The note stores its literals as a reference.** `no-approver-note.ts`: a new note stores `slots` (the slate's `type:value` literals, `noApproverSlots`) in the `__noApproverNote` snapshot entry instead of the pre-composed `who` string. `noApproverWho(slate, positionLabel?)` composes `type 'value'`, naming a position by the label `positionLabel` answers, else by its name. `noApproverSentence` / `noApproverNoteText` take an optional `positionLabel` and compose from `slots`; a note that stored `who` (written before this change) is rendered from that string exactly as before. `noApproverNoteOf` reads either shape. 2. **The read names the position the way objectstack-ai#36030 does.** `ApprovalService.localizeRoutingNotes` builds the label map for the note's positions through the existing `notePositionLabels` (reader's pack `positions.NAME.label`, else the declared `label` from `positionLabelSource`, else nothing) and passes it to `noApproverNoteText`. No second resolver: the position-name extraction is `slatePositions`, factored out of `adminRescuePositions` in `admin-rescue-note.ts`, which now delegates to it. 3. **The stored English is unchanged.** The write site (`approval-service.ts`, one hunk) stores `slots`; the row's `comment` is still `noApproverNoteText(note)` with no render, which composes the same `position 'NAME'` English as before. The refusal remedy and the submitter's notice still compose from the slate with no labels (see Acceptance notes). 4. **Docs.** `content/docs/automation/approvals.mdx`, the no-approver paragraph: the note names the position by its label for a reader and by its name in the stored text. `approval-service.ts` carries three small hunks (import, the write line, the read line); the note module could not carry the write and the read alone. `overlap-check` is clean against objectstack-ai#36295, objectstack-ai#36247, objectstack-ai#36144 and objectstack-ai#36135, which share that file. ## Tests <details><summary>Pins: admin-rescue-named-slate.integration.test.ts, new describe "[objectstack-ai#36035] the no-approver note names its position by its label"</summary> The suite's real `ApprovalService` on `ObjectQL` over in-memory SQLite, an organization with no administrator (so the request opens on the slate that names no one), the plugin catalog plus an app pack in a real in-memory `i18n` service, and a `positionLabelSource` declaring `sales_manager` as "Sales Manager". - the snapshot stores `{ action_id, slots: ['position:sales_manager'] }`; the row stores the English with `position 'sales_manager'`; a no-locale read is served that English; - zh-CN (pack label 销售经理) reads `...担任 position '销售经理' 的成员...` and no `sales_manager`; - en and ja-JP (no pack key) read `position 'Sales Manager'`; - a position no pack and no declaration knows (`treasury`) keeps its name; - CONTROL: a note rewritten to the old stored shape (`who: "position 'sales_manager'"`) renders exactly as before in zh-CN, en and with no locale. The pin went into the existing harness file as a sibling of the objectstack-ai#35418 describe rather than a new file: it reuses that file's engine, organizations and `open` helper (AGENTS.md: a new pin for a component with a shared harness goes into that file). </details> <details><summary>Ablations at 8a83eed (scripts/ablation-replace.mjs, each restored to the HEAD blob with an empty git diff HEAD)</summary> - A1 read site passes no `positionLabel`: 2 failed (zh-CN pack label, declared label) / 3 passed. - A2 write site stores the composed `who` again: 3 failed (snapshot shape, zh-CN, declared) / 2 passed. - A3 an unknown position's name dropped: 3 failed (snapshot English, unlabelled name, legacy row) / 2 passed. - A4 a stored `who` no longer read: 1 failed (legacy CONTROL) / 4 passed. </details> <details><summary>Runs at 8a83eed</summary> - `pnpm --filter @objectstack/plugin-approvals test`: Test Files 126 passed (126), Tests 1813 passed (1813). - `pnpm --filter @objectstack/plugin-approvals typecheck`: exit 0 (test layer held at its ledgered debt). - eslint over the four changed source files: exit 0. </details> ## Acceptance notes - The `__noApproverNote` snapshot entry is internal to `@objectstack/plugin-approvals` (nothing in `packages/spec`, `ui/` or the package index reads it); new notes carry `slots`, older ones keep `who`, and the read accepts both. - Same family, not in this PR, carried by objectstack-ai#36308 (class a, user-visible): the decision door's refusal remedy and the submitter's `approval.comment` notice compose the no-approver sentence from the slate with no labels, so they still name the machine name (`...holds position 'legal'...`, pinned in `exclude-submitter.integration.test.ts`). The notice is rendered per recipient at delivery, so labelling it needs the recipient's locale, not the reader's. - Observation, carried by objectstack-ai#36308 (class a, user-visible): the `{{who}}` hole carries the approver type's English machine token in every pack, so a zh-CN reader now reads `担任 position '销售经理' 的成员`, where the administrators' note translates the type (`岗位「销售经理」`). Translating the type needs a per-type clause in all eleven catalogs; out of this card's scope. ## Verification Read first: `no-approver-note.ts` (`noApproverWho`, `noApproverSentence`, `noApproverNoteOf` — the old/new shape split), the `localizeRoutingNotes` hunk in `approval-service.ts`, the write hunk at `slateSource = 'no_one'`. Two-minute check: `pnpm --filter @objectstack/plugin-approvals exec vitest run src/admin-rescue-named-slate.integration.test.ts -t 36035` — expect 5 passed. <details><summary>Local gates at 8a83eed</summary> `node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --ran`: 103 derived families accounted for, 103 run, 0 NOT-MEASURED (a derived zero: every family recorded an exit code, all 0). Four first answered exit 3 (prerequisite) and were rerun after it was met: `check-plugin-teardown-shape --self-test` (pinned fixture commit fetched), `check:skill-examples`, `check:i18n` and `check:dual-build-cjs-loads` (after the build closure finished). `overlap-check`: clean against origin/main and 4 open PRs. CI families: not yet reported at open. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01FEkQ5okniknzVVR3KTSVr1)_ <!-- signed: repo:objectstack#4 · os-project-manager · session_01FEkQ5okniknzVVR3KTSVr1 --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Sales · project thread
repo:objectstack#1 · os-sales · session_01L6bhgT9mNgD8oKM93bFzg5
Fixes #35418
Clause-②: yes (widening) — @objectstack/plugin-approvals adds the optional
ApprovalServiceOptions.positionLabelSource; @object-ui/i18n adds approvalsInbox.systemActor and approvalsInbox.actSystemNote; nothing removedMetadata-protocol: none
维护者速读
What changes
admin-rescue-note.ts:adminRescueNoteText(note, render, positionLabel?)maps each unheld-position clause'svaluethroughpositionLabelbefore rendering;adminRescuePositionslists the note's position names.ApprovalService.localizeRoutingNotesbuilds the map per read (notePositionLabels): the reader's packpositions.<name>.label(newReaderLabels.positionLabel, key spelled bypositionLabelKeybeside the flow keys), else the declaredlabelfrom the new optionalApprovalServiceOptions.positionLabelSource, else nothing (the name stands).ApprovalsServicePluginwires that source to themetadataservice'sget('position', name), resolved lazily like the i18n source. A throwing source is caught: the read never fails on a label. The row's stored Englishcomment(the audit text, and what a read with no locale is served) is unchanged and keeps the name.ApprovalActionTimeline.tsx: a row with noactor_idreads its actor asapprovalsInbox.systemActor("System" / 系统) instead of "—"; acommentrow with no actor (isSystemNote, newutils/approvalSystemNote.ts) reads its kind asapprovalsInbox.actSystemNote("System note" / 系统说明) instead of "Commented".system:slakeeps "System (SLA)". New keys in all eleven packs, translated.content/docs/automation/approvals.mdx, "When a slate names no one": the stored note keeps the English with the position's name; a reader is served it in their language with the position's label, shown as a system note (the Docs Drift Check listed this page).The card allowed 「转交」 or 「系统」 for the kind. The three no-actor comment notes are not all hand-offs (admin routing, submitter exclusion, no approver), and telling them apart on the client would need a new field on the actions contract, so they share "System note" and the sentence itself says what happened. This reading was stated in the claim.
Tests
Approvals plugin
admin-rescue-note.test.ts: a position clause takes the label it is given and only a position does (team literal and an unknown position keep their names); a clause the pack lacks falls back to English with the label; the stored English keeps the name;adminRescuePositionsdedupes and skips non-position and empty slots.reader-locale-labels.test.ts:positionLabelKeyspelling, held toTranslationDataSchemaby the existing round trip; the pick readspositions.<name>.labelin the negotiated locale.admin-rescue-named-slate.integration.test.ts, new describe[#35418] the note names an unheld position by its label(real in-memory i18n with the plugin's catalog plus an app pack): zh-CN reads 「岗位「销售经理」无人任职」 and nosales_manager; en reads the declared label "position 'Sales Manager' has no holder"; ja-JP with no translation reads the declared label; CONTROL the stored row and a no-locale read keep the name; a throwing source keeps the name and does not fail the read.approval-service.test.ts+submitter-exclusion-note.test.ts486 passed.pnpm --filter @objectstack/plugin-approvals typecheckexit 0.Console and i18n
ApprovalActionTimeline.systemNote-35418.test.tsx: en "System note · System" with no "Commented" and no "—"; a person's comment keeps "Commented · Bob" (live control in the same DOM); a no-actorcancelrow names "System"; zh 「系统说明 · 系统」 and 「评论 · Bob」. 3 passed.pnpm --dir ui exec vitest run packages/i18n/(includes all-locale key parity): 105 files passed, 1957 passed, 13 skipped.no-explicit-anywarning inApprovalActionTimeline.tsx, not on a changed line).Follow-ups (not in this PR)
{{who}}("…a member who holds position 'crm_sales_manager'…") is stored pre-composed (noApproverWho), so it still names the machine name; labelling it means storing the slots instead of the joined string.Verification
Read first:
admin-rescue-note.ts(labelledPosition),ApprovalService.localizeRoutingNotesandnotePositionLabels, thepositionLabelSourcewiring inapprovals-plugin.ts,ApprovalActionTimeline.tsx(actionText,actorName).Two-minute check:
cd packages/plugins/plugin-approvals && pnpm exec vitest run src/admin-rescue-named-slate.integration.test.ts; expect the[#35418]describe green.Local gates at 064e714
node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --ran: 109 derived families accounted for, 109 run, 0 NOT-MEASURED (all with exit 0; the 28 families the docs commit added were run on 064e714, the other 81 on cfacf20, which differs from it only by that docs page). Four first answered on a shallow, partly built clone and were rerun after the prerequisite:check-plugin-teardown-shape --self-test(pinned fixture commit fetched),pnpm --dir ui exec vitest run scripts/(needed the@objectstack/clientdist; then 172 files passed, 2 skipped),check:dual-build-cjs-loadsandcheck:i18n(after a fullpnpm build).node scripts/pm/overlap-check.mjs: clean against origin/main 9b3227f and 4 open PRs sharing the locale packs orapproval-service.ts(#36018, #35994, #35969, #35968). CI families: not yet reported at open.🤖 Generated with Claude Code
https://claude.ai/code/session_01L6bhgT9mNgD8oKM93bFzg5