Repository navigation
Commit 1bf90a0
feat(spec): BulkActionResultSchema, the per-row outcome an aggregate bulk handler may resolve with (#34267)
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9GPcRQy7taMdH7c7xqkajGg)_
Fixes #34216
Reader: #34269 (the grid's bulk reader). Until it lands this shape is
`[PLANNED — not enforced]`, and a handler that cannot cover the whole
selection must still reject.
Clause-②: yes (widening) — a new optional public shape and its three
exports (`BulkActionResultSchema`, `BulkActionResult`,
`BulkActionResultParsed`) from `@objectstack/spec/ui`; nothing an author
writes is accepted or refused differently
Metadata-protocol: added
Skills-docs: follow-up #34268 — skills/objectstack-ui/rules/actions.md
(teach a handler to resolve with the per-row result once the grid reads
it; teaching it now would advertise an answer the console does not yet
render)
## 维护者速读
- **改了什么**:在动作契约里先声明一个可选的逐行结果结构 `BulkActionResultSchema`(`{ succeeded:
[id], failed: [{ id, message }] }`),给「整体执行」(`execution:
'aggregate'`)批量动作的处理器作为返回值用。标为 `[PLANNED — not enforced]`:控制台还不读它,读取方是
#34269;在那之前处理器覆盖不了整批时仍须拒绝。只改 spec,界面和运行时都没动。
- **为什么改**:HotCRM
实测,批量改阶段时一条被拒、另一条其实已改,控制台没法知道是哪条动了。这个结构让处理器能如实说明每一行的结果。
- **风险与回滚**:纯新增导出,现有元数据和处理器不受影响。读取方 #34269
落地前,返回这个结构也会被当成整批成功,所以说明里写明处理器仍须拒绝。回滚即 revert 本 PR。
-
**先看**:`packages/spec/src/ui/bulk-action.zod.ts`(新结构和它的说明);`packages/spec/src/ui/bulk-action.test.ts`(新的
describe);`docs/audits/2026-07-unknown-key-strictness-ledger.md`(该文件那一行改成
mixed)。
- **两分钟验证**:`pnpm --filter @objectstack/spec exec vitest run
src/ui/bulk-action.test.ts`,预期全绿,新 describe「BulkActionResultSchema — the
per-row outcome…」。
- **需要你做的**:无,席位落地。
## What changes
Seat ruling 6905490575 on the card, option A: the per-row result travels
as the resolve value only, and the change is spec-only. Round 2 answers
review#2 record 6906386763.
- `packages/spec/src/ui/bulk-action.zod.ts`: `BulkActionResultSchema`
beside `BulkActionExecutionSchema`, with types `BulkActionResult`
(input) and `BulkActionResultParsed` (output). Members `{ succeeded:
string[], failed: { id: string, message: string }[] }`.
- **[PLANNED — not enforced]** in the TSDoc, the describe and the
reference page (the #34078 marker). The console does not read the value
yet; its reader is #34269. Until that lands a resolved aggregate call
counts as covering every selected row, so a handler that cannot cover
the whole selection must still reject.
- It is declared as the handler's whole resolve value, not a reserved
key (so once #34269 lands, a top-level `succeeded` / `failed` member
that does not parse is reported unreadable; #34269 declares that
change), and never attached to a rejection: the `/actions` door carries
no structured body on a script or flow handler's throw (measured in
report 6905466421).
- Not `BatchUpdateResponse` (there `succeeded` / `failed` are counts,
rows under `results`) and not `BulkWriteResult` (`errors[].error`): here
they are the row lists and the reason is `message`.
- How the reader (#34269) will read it, only on an `execution:
'aggregate'` dispatch: a value with neither member keeps the one-outcome
report; a value with either member that does not parse is reported as
unreadable, never as full success; members beyond the two lists carry no
meaning.
- How it will count ids: an id outside `params._selectedIds` is dropped;
a duplicate counts once; an id in both lists counts as failed; a
selected id in neither list is reported as not confirmed, never as
succeeded.
- `z.looseObject` at both levels, on purpose: a wire shape a handler
writes, not an author.
- It is exported through the `ui` barrel (`export * from
'./bulk-action.zod'`, unchanged).
- Regenerated: `api-surface/ui.json`, `export-origins/ui.json`,
`declaration-map/ui.json`, `json-schema.manifest/ui.json`,
`authorable-surface/ui.json`,
`content/docs/references/ui/bulk-action.mdx` and `index.mdx`, and the
strictness-ledger counts shard `ui.md`.
- Strictness ledger: the `bulk-action.zod.ts` row moves from
`authorable` to `mixed` (two wire-class `looseObject` sites, the
`PicklistServedFieldSchema` precedent), says the shape is planned with
#34269 as its reader, and corrects a stale sentence:
`BulkActionParamSchema` is `strictObject`, not `.passthrough()`. Strip
sites are unchanged (5 of 223 in `ui/`).
- Changeset `.changeset/34216-bulk-action-result.md`:
`@objectstack/spec` minor. It declares the shape and its reader #34269,
and says a handler must still reject until then; there is no
present-tense "resolve instead of throwing" instruction.
## Tests
`packages/spec/src/ui/bulk-action.test.ts`, new top-level describe
`BulkActionResultSchema — the per-row outcome an aggregate handler may
resolve with`:
- Accepts the full shape; empty lists (all written, none written, both
empty); members beyond the two lists, kept as written.
- Refuses a non-string id in either list (`invalid_type` at
`succeeded.0` / `failed.0.id`), a `failed` entry without `message`, a
value missing either list, and the two neighbouring shapes:
`BatchUpdateResponse`'s counts and `BulkWriteResult`'s `errors[].error`
(and a `failed` entry spelled with `error`).
- The shape admits a duplicate id and an id in both lists; the counting
rules are the reader's (#34269).
- CONTROL, no per-row result: nothing, null, scalars, an array, and a
handler's own `{ ok: true }` or `{ summary }` are not a per-row result.
The showcase aggregate def still parses as before.
- `a rejection stays the one-outcome report (documents the ruling; not
coverage: no reader exists yet)`: the refusal envelope is not a per-row
result, even with the shape inside `error.details`.
No existing test was edited.
## Acceptance notes
- File surface beyond the claim, declared:
`docs/audits/2026-07-unknown-key-strictness-ledger.md`. Its
`bulk-action.zod.ts` row class moves to `mixed`, because the file now
holds a wire shape beside its authoring half. `check:strictness-ledger`
checks the row covers the file; the class is the human verdict.
- `authorable-surface/ui.json` gains `ui/BulkActionResult:failed` and
`:succeeded`. The generator lists every exported object schema's keys;
no metadata type carries this shape, so no author writes it into stored
metadata; a handler author writes it as a return value.
`check-changeset-no-major` reads that shard as an authorable key added,
so this PR declares `Metadata-protocol: added` where the claim said
`none` (the delta allowed it: "unless the measurement says otherwise").
Declared as a deviation.
- The ui reader is #34269 (filed by the seat). Still noted for after
merge: the action invocation audit row records `succeeded` for a 200
that carries `failed` rows.
## Verification
Round 2 readings on head eb69975 (base main 7be32d3; main is 8
first-parent commits ahead, no file in common with this diff, so not
merged: K under 15).
<details><summary>Spec suite, typecheck and generated artifacts (round
2)</summary>
- `pnpm --filter @objectstack/spec test` (locked): Test Files 844 passed
(844), Tests 27017 passed, 1 todo. VERDICT command-exit 0.
- `pnpm --filter @objectstack/spec typecheck` (locked): VERDICT
command-exit 0.
- `bulk-action.test.ts`: 51 passed (51).
- `check:generated --fix` after the describe change rewrote only
`content/docs/references/ui/bulk-action.mdx` (the reference page now
opens with the planned marker).
- `check-changeset-no-major --base 7be32d3 --event` on this body,
`check-partof-closing-keyword` on this body, `check-empty-changeset`,
`check-adr-0087-registration`: exit 0.
</details>
<details><summary>Ablation (round 1, schema code unchanged
since)</summary>
Committed first (ea22bdd); each leg red, restored clean:
`failed[].message` optional reds the missing-message pin; `succeeded`
items `z.unknown()` reds the non-string-id pin; outer `looseObject` to
`object` reds the extra-members pin. Round 2 changed only prose and
added pins, not the schema's code.
</details>
<details><summary>Derived gates: 109 of 109, exit 0 (round 2)</summary>
`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` on eb69975 derived the same 109 families as
round 1; all 109 exit 0. `--ran`: 109 derived, 109 run, 0 NOT-MEASURED,
0 UNRUN. `check:dev-prereqs` (local-only) stays NOT MEASURED: `ui/` is
unbuilt in this container.
</details>
Dogfood battery: not run, because the title has no `!` and there is no
`(narrowing)` arm.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01ADHkmNf3y1gdYzp1F6sSLY)_
---
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01ADHkmNf3y1gdYzp1F6sSLY
<!-- signed: domain:spec#2 · os-steve · session_01ADHkmQjrEpxMVxEiDUJHqC
-->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent bdd5176 commit 1bf90a0
12 files changed
Lines changed: 247 additions & 14 deletions
File tree
- .changeset
- content/docs/references
- ui
- docs/audits
- 2026-07-unknown-key-strictness-ledger.counts
- packages/spec
- api-surface
- authorable-surface
- declaration-map
- export-origins
- json-schema.manifest
- src/ui
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | | - | |
| 36 | + | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
388 | | - | |
| 388 | + | |
389 | 389 | | |
390 | 390 | | |
391 | 391 | | |
| |||
394 | 394 | | |
395 | 395 | | |
396 | 396 | | |
397 | | - | |
| 397 | + | |
398 | 398 | | |
399 | 399 | | |
400 | 400 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
| 28 | + | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
0 commit comments