You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9b622bb
Browse filesBrowse the repository at this point in the historyBrowse files
feat(service-messaging): a keyed notification param can be a list, read in the recipient's language (#37701)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuQVQdf3PvoJbKFFCUA4gwJB)_Fixes#36853
## What changes
- **`@objectstack/service-messaging`, `notification-text.ts`.**
`EmitInput.keyedText.params` accepts a list-shaped value, `{ list,
separator }` (`NotificationListParam`).
- Each `list` item is `{ key, params?, fallback }`: a catalog sentence
with its own `{{hole}}` params, which are scalar only
(`NotificationScalarParam`: text, `{ key, fallback }` or `{ object,
fallback }`).
- The renderer fills each item per recipient through the same scalar
resolution a top-level hole uses. An item with no entry falls back to
its `fallback`.
- The items are joined by the `separator` entry, else its `fallback`.
`lookupSeparator` keeps a whitespace or punctuation answer such as `、`,
which `lookup` would treat as a blank sentence.
- `problemOf` is split into `scalarParamProblem`, `keyedParamProblem`
and `listParamProblem`. `emit()` refuses an empty list, a list over
`NOTIFICATION_LIST_PARAM_MAX_ITEMS` (100), an undeclared member, a
malformed separator or item, and a list nested in an item. A stored
malformed row reads back as `undefined` and is delivered as its literal,
as any malformed row is.
- New exports: `NotificationListParam`, `NotificationListItem`,
`NotificationScalarParam` and `NOTIFICATION_LIST_PARAM_MAX_ITEMS`. Every
existing param shape renders byte for byte as before.
- **`@objectstack/plugin-approvals`.**
- `noApproverNotice` spells a slate of two or more slots as
`approvalNoApproverHolding` with `who` the list param: one
`approvalNoApproverSlot` per slot with its `type` / `value` params,
joined by `approvalNoApproverSlotSeparator`. Each item falls back to the
English clause the row stores.
- `approval-notification-text.ts` mirrors the new shapes structurally
(`ApprovalListParam`, `ApprovalScalarParam`), because the plugin keeps
no runtime dependency on the messaging package. `interpolate` renders a
list's literal from its items' fallbacks.
- A one-slot slate keeps `approvalNoApproverHoldingSlot`.
- Tests and a changeset (both packages `patch`).
## Why
A `{ key }` param resolves through `t(key, locale)` with no params, so a
hole held one text or one hole-free key. #36463 (PR #36846) spelled
slates of 2 to 8 slots with one derived sentence per size. A slate of
more than 8 slots still named its slots in English inside a zh-CN, ja-JP
or other non-English submitter's sentence.
## Verification
- `admin-rescue-named-slate.integration.test.ts` adds a 9-slot slate
opened by the real service. It is rendered through the real
`NotificationTextRenderer` in zh-CN, and the body is entirely Chinese,
with `not.toMatch(/[A-Za-z]/)`. The `en` render equals the literal the
row stores. This is the card's acceptance test.
- `notification-text-list-param-36853.test.ts` drives the real renderer
over the kernel's in-memory `i18n`, with 9 tests:
- nine items in zh-CN, joined by `、`, and the same list in `en`
- per-item and separator fallback
- an object-label param and a plain-text param inside an item
- every refusal `emit()` makes, and a stored row read back
- `no-approver-note.test.ts`:
- the two-slot notice shape is now the list
- "every slate size reads the timeline's sentence in every pack" now
runs from 2 to 12 slots, past the 8 #36463 spelled
- the old "more than 8 keeps English" pin is replaced by "nine slots
name no English approver type in any pack but `en`"
- `vitest run`: `service-messaging` 82 files, 1107 passed;
`plugin-approvals` 130 files, 1965 passed.
- `pnpm typecheck` passes in both packages. `plugin-approvals`
`check:test-typecheck` is OK, with no change to its ledger.
- `eslint` is clean on every changed file. `check-test-source-alias` is
OK, and `overlap-check` is clean against `origin/main`.
## Small decisions
- The `approvalNoApproverHoldingSlots2` to `…Slots8` sentences are
**not** retired. Notices already delivered carry those keys in their
stored `keyedText`, and the inbox renders them again at every read
(`renderForReader`). Retiring them would turn those rows back into
English. New notices no longer emit them.
- A list item's params are scalar only, never another list. One level
covers the card. A nested list would need a second separator and a depth
bound for no current producer.
- An item or separator that misses falls back alone, the way every other
keyed param falls back. The rest of the list stays in the reader's
language.
- The list is capped at 100 items, because it is rendered item by item
at every delivery and every inbox read. An approval slate is a handful
of slots.
Clause-②: yes (widening)
Metadata-protocol: none
The widening is the published `keyedText.params` value shape of
`@objectstack/service-messaging`: a new accepted shape, with every
existing shape unchanged. No metadata author writes it.
## Owed
- L1 (seat). Clause-② widening of a service package's exported emit
contract, so the seat rules whether a contract review is owed.
## 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>
feat(service-messaging): a keyed notification param can be a list, each item rendered in the recipient's language; the approval "no one can approve" notice names a slate of any size in the reader's language
7
+
8
+
Clause-②: yes (widening)
9
+
Metadata-protocol: none
10
+
11
+
-`EmitInput.keyedText.params` accepts a new value shape, `{ list, separator }`. Each `list` item is `{ key, params?, fallback }`: a catalog sentence with its own `{{hole}}` params, rendered per recipient. An item param can be text, `{ key, fallback }` or `{ object, fallback }`, but not another list. A sentence with no entry falls back to the item's `fallback`. The rendered items are joined by the `separator` entry (`{ key, fallback }`), so a list of any length reads in one language. A list holds 1 to `NOTIFICATION_LIST_PARAM_MAX_ITEMS` (100) items, and `emit()` refuses a malformed one before it writes anything. The new exports are the types `NotificationListParam`, `NotificationListItem` and `NotificationScalarParam`, and the constant `NOTIFICATION_LIST_PARAM_MAX_ITEMS`. Every existing param shape renders as before.
12
+
- The widening reaches the read side too. `NotificationTextParam` is now `NotificationScalarParam | NotificationListParam`, so the exported channel contract `Notification.keyedText` can carry a list param. A channel that reads `keyedText.params` must handle the list shape.
13
+
- An older reader does not understand a list row. After a rollback to a version before this one, it reads the row's keys as malformed and delivers or shows the whole notice as its stored English literal, title and body alike. Nothing fails. Within one install this cannot otherwise happen, because the two packages always release together.
14
+
- The approval submitter's notice for a request no one else can approve now names a slate of two or more slots through this list param, one `approvalNoApproverSlot` clause per slot, joined by `approvalNoApproverSlotSeparator`. Before, a slate of more than 8 slots named its slots in English inside a zh-CN, ja-JP or other non-English sentence. Now every slot reads in the recipient's language. The literal English body is unchanged. A slate of more slots than a list param holds (more than 100) is sent with the slots as one English clause list instead, as before, so `emit()` does not refuse the notice and the submitter is still told.
15
+
- The `approvalNoApproverHoldingSlots2` to `…Slots8` sentences stay in the packs, because notices already delivered carry those keys and are rendered again whenever the inbox is read.
0 commit comments