Skip to content

Commit c9741f4

Browse files
fix(approvals): the Approval Actions list names the step and the platform's own notes in the reader's language (#37623)
<!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuQVQdf3PvoJbKFFCUA4gwJB)_ Fixes #37531 ## What changes `sys_approval_action` read through the generic data door (Setup's Approval Actions list, views `recent` / `by_actor` / `all_actions`; an action's record page; the export) now serves a reader with a locale the text the approvals door's timeline serves: - **`step_label`**: the step's label from the app's pack, `flows.<flow>.approvals.<step_name>.label`, the flow named by the parent request's `process_name` — the key the Approval Requests list is already translated by (#27041). - **`comment` on the rows the platform writes** (no actor): - the administrators' routing note, the submitter exclusion note and the no-approver note, already stored as data on the request's node-config snapshot and already rendered on the timeline; - the record-deleted cancellation ("Auto-cancelled: the … record '…' this request is about was deleted"), now the catalog sentence `approvalAutoCancelledRecordDeleted` (all eleven shipped `messages` locales), composed from the request's own `cancel_reason`, `object_name` and `record_id`. No stored shape moves: the row's `comment` is the sentence's `en` rendering with the object's name, byte-identical to what it stored before. One render serves both doors: `ApprovalService.localizeActionRows` replaces the timeline's `localizeRoutingNotes`, and the new engine middleware `action-locale-middleware.ts` (bound beside `reader-locale-labels-middleware.ts`, same shape) hands the generic door's rows to it. A list that selects `step_label` or `comment` without the columns their text is picked by borrows them for the read and is served exactly the columns it selected. Unchanged: storage (the stored step label stays the authored snapshot, the stored comment the English); a system read, a reader with no locale and a language the pack does not hold are served the stored text; a comment a person wrote is served as written. **Out of scope, by the seat's claim (7196522515):** four other platform-written comments are still composed as English prose with parameters nobody stores as data — the revision-limit auto-reject, the dead-run abandon, the SLA escalation and the out-of-office substitution. The seat files the follow-up card at ACCEPT. ## Why The card: in a zh-CN console the Approval Requests list shows 销售经理审核, the Approval Actions list the same step as "Sales Manager Review", and the system notes as English sentences. The approvals door already localized the notes on its timeline (#25576 deliberately left the generic door on the stored English); this extends the same render to the generic door, the way #27041 did for the request's labels. ## Verification - New `action-locale-data-door.integration.test.ts` (real `ObjectQL` over SQLite, real `AutomationEngine`, real plugin, real in-memory `i18n` with a zh-CN pack holding the flow's labels and this plugin's zh-CN `messages`; the door is `ObjectStackProtocolImplementation.findData` / `getData`): 8 tests green. zh-CN reader: step label and exclusion note in zh-CN on the `recent` projection, a person's comment as written, borrowed columns not served; a `step_label,comment`-only projection; the by-id read; the record-deleted cancellation in zh-CN with its stored English unchanged; parity with the approvals door's timeline. Fences: ja-JP / en / no-locale readers and a system read get the stored text; storage untouched. - Ablation: with the middleware unbound, 5 of 8 red (every zh-CN pin on the data door), 3 green (the fences). - `@objectstack/plugin-approvals` whole suite: 130 files / 1964 tests green after classifying the new `actor_id` presence test in `approver-address-readers.test.ts` (it replaced the `localizeRoutingNotes` entry, same role and reason). - `typecheck` (incl. `check:test-typecheck`) exit 0; eslint on the changed files 0 problems; `overlap-check` clean against `origin/main` 54d6726 and 0 PR heads. Clause-②: no Metadata-protocol: none Owed: L1 (seat). L2: none named by me — no contract surface; the served text of a generic-door read changes for localized readers only, the same direction #27041 took. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes. - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: its generated artifacts are regenerated and committed. (not touched) - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. - [x] The *Before Submitting* list in CONTRIBUTING.md is done. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgU7eeqHgQrtv5CeJK6 --- _Generated by [Claude Code](https://claude.ai/code/session_01L6bhgU7eeqHgQrtv5CeJK6)_ <!-- signed: repo:objectstack#2 · os-sales · session_01L6bhgU7eeqHgQrtv5CeJK6 --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2eadf56 commit c9741f4

10 files changed

Lines changed: 597 additions & 47 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@objectstack/plugin-approvals': patch
3+
---
4+
5+
fix(approvals): the Approval Actions list and an action's record page name the step and the platform's own notes in the reader's language
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`sys_approval_action` read through the generic data door (Setup's Approval Actions list, an action's record page, the export) now serves, to a reader with a locale, the same text the approvals door's timeline serves:
11+
12+
- `step_label`: the step's label from the app's language pack (`flows.<flow>.approvals.<step>.label`), as the Approval Requests list already did. Before, the stored authoring-language snapshot was served to every reader.
13+
- `comment` on the rows the platform writes itself: the administrators' routing note, the submitter exclusion note and the no-approver note, which are stored as data on the request, and the cancellation written when the record a pending request is about is deleted ("Auto-cancelled: the … record '…' this request is about was deleted"), now a catalog sentence (`approvalAutoCancelledRecordDeleted`, in all eleven shipped languages) composed from the request's own columns. The approvals door's timeline serves that cancellation in the reader's language too.
14+
15+
A comment a person wrote is served as written. A list that selects `step_label` or `comment` without the columns their text is picked by is served exactly the columns it selected. Storage is unchanged: the stored step label stays the authored text and the stored comment the English, which is what a system read, a reader with no locale and a language the pack does not hold are served. Nothing to migrate.

‎content/docs/automation/approvals.mdx‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,8 @@ the run that opened the request still write the lines. Children joined by a plai
417417

418418
**Deleting the record while it is pending** is not refused: the delete lands and
419419
its pending request is cancelled (`status: 'cancelled'`, with `cancel_reason` on
420-
the row). The delete removes the record's `master_detail` lines with it. In the
420+
the row), and the request's timeline says so in a system note, in the reader's
421+
language. The delete removes the record's `master_detail` lines with it. In the
421422
cases below the server refuses the whole delete with `409 RECORD_LOCKED` instead, and
422423
the record, its lines and its pending request all stay:
423424

@@ -750,6 +751,12 @@ side, and both objects declare `schemaReadDelegate: 'approvals'`, so
750751
`GET /api/v1/meta/object/sys_approval_action` (and the object list) serves it
751752
to a caller who can see at least one request by the rule above. A member who
752753
can see none is answered `404` for it.
754+
755+
Whoever reads `sys_approval_action` rows on the data side (Setup's Approval
756+
Actions list, an action's record page, an export) is served each row's step
757+
label and system note in their own language, by the same render as the
758+
request's timeline. The row itself keeps the authored step label and the
759+
English note.
753760
</Callout>
754761

755762
<Callout type="info">

‎content/docs/permissions/system-context.mdx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ bugs — it is the protection or the side effect that silently does not happen.
120120
| 13 | Per-request performance timings disclosed | observability | Get: timing headers a normal caller cannot pull | `isPerfDisclosurePrincipal` |
121121
| 15 | MCP stdio bridge skips the object API-exposure gate | mcp | Get: the bridge reaches objects whose `apiEnabled` / `apiMethods` would refuse an external caller | `enforceApiExposure` |
122122
| 16 | **Read-audit rows are not written** | plugin-audit | Lose: the "a person opened this record" trail. `sudo()` keeps the caller's `userId`, so this flag is the only thing separating a human read from a platform one | `installReadAuditWriter` |
123-
| 17 | Approval snapshot payload redaction skipped, and so is the snapshot query guard and the reader-locale label overlay | plugin-approvals | Get: the whole snapshot on `find` / `findOne` — the audit/replay channel — and a filter, sort or grouping by it on any read; a request's `process_label` / `current_step_label` as stored, and an approval entry's `sys_activity.summary` as stored (its English line), never in a locale the context carries, so nothing the platform reads back and writes again holds a reader's language. Lose: field-visibility redaction over approval payloads, the refusal of a query over the snapshot for a reader withheld a field of the objects it can reach, and the flow and step labels and the approval entry's line in the reader's language | `bindSnapshotRedactionMiddleware`, `bindSnapshotPredicateGuard`, `bindReaderLocaleLabelsMiddleware`, `bindApprovalActivityLocale` |
123+
| 17 | Approval snapshot payload redaction skipped, and so is the snapshot query guard and the reader-locale label overlay | plugin-approvals | Get: the whole snapshot on `find` / `findOne` — the audit/replay channel — and a filter, sort or grouping by it on any read; a request's `process_label` / `current_step_label` as stored, an approval action's `step_label` and platform-written `comment` as stored, and an approval entry's `sys_activity.summary` as stored (its English line), never in a locale the context carries, so nothing the platform reads back and writes again holds a reader's language. Lose: field-visibility redaction over approval payloads, the refusal of a query over the snapshot for a reader withheld a field of the objects it can reach, and the flow and step labels, an action's step label and system note, and the approval entry's line in the reader's language | `bindSnapshotRedactionMiddleware`, `bindSnapshotPredicateGuard`, `bindReaderLocaleLabelsMiddleware`, `bindActionLocaleMiddleware`, `bindApprovalActivityLocale` |
124124
| 18 | REST anonymous-deny seam satisfied | rest | Get: `enforceAuth` passes with no `userId`. Not reachable from the wire — `isSystem` is never set on an inbound request | `enforceAuth` |
125125
| 18b | Settings namespace read scope not applied | service-settings | Get: a read of `sys_setting`, `sys_setting_audit` or `sys_platform_setting` across every namespace, whatever each namespace's `readPermission` names — the settings service's own reads of its stores take this path. Lose: the per-namespace read gate the generic data API applies to every other caller, the same rule the settings routes enforce | `settingsReadDoorMiddleware` |
126126
| 18c | **Credential-column filter / sort refusal not applied** — a `where`, `orderBy`, per-aggregation `filter` or `expand` entry naming a `password` / `secret` column is evaluated | objectql | Get: the server's own match on a stored credential value, a lookup that never returns it. Every other caller, administrators included, is refused `400 INVALID_FIELD` for anything but a has-a-value check (ADR-0100). Lose: nothing a wire caller reaches — `isSystem` is never set on an inbound request | `rejectCredentialEvaluation` |
@@ -572,6 +572,7 @@ and CI refuses one that differs from what the tree produces.
572572
| `packages/objectql/src/stored-metadata-type-read-gate.ts#storedMetadataTypeReadFilter` | 1 | 18d |
573573
| `packages/observability/src/perf-timing.ts#isPerfDisclosurePrincipal` | 1 | 13 |
574574
| `packages/plugins/organizations/src/organizations-plugin.ts#start` | 1 | 62 |
575+
| `packages/plugins/plugin-approvals/src/action-locale-middleware.ts#bindActionLocaleMiddleware` | 1 | 17 |
575576
| `packages/plugins/plugin-approvals/src/approval-activity-feed.ts#bindApprovalActivityLocale` | 1 | 17 |
576577
| `packages/plugins/plugin-approvals/src/approval-service.ts#assertAttachmentsUploadedByCaller` | 1 | 43 |
577578
| `packages/plugins/plugin-approvals/src/approval-service.ts#comment` | 1 | 43 |

0 commit comments

Comments
 (0)