Repository navigation
Commit 84e6bbb
feat(app-shell): the action result dialog draws table answer fields, and Import Users shows its result per row (#34647)
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi99ewj5JRWXTB3u38E9HLhnj)_
Part of #33187. This PR draws the per-row import result. One part stays
open: the Add User result still does not say that an email-only re-add
was already pending. The renderer contract cannot hide a `false` row on
a fresh add, so that half moves to #34651 (see Acceptance notes).
Clause-②: yes (widening)
Metadata-protocol: none
Skills-docs: follow-up #34648
Ruling-ref: 6915677641
## 维护者速读
- 改了什么:控制台的动作结果弹窗和预读面板现在能画 `table` 格式,按列逐行显示;托管环境「设置 → 用户 → 导入用户」的结果从一大块
JSON 变成逐行表格(邮箱、是否成功、是否已待激活、是否已通知托管方及原因、未添加原因、未生效的列、上级未关联)。
- 为什么改:您在本卡选了 A(记录 6915677641);spec 半边(#34500)已落地,这是渲染半边。
- 风险与回滚:只加不减。其他五种格式照旧;唯一行为变化是 `code-list` 只在值为字符串数组时按代码列表画,否则画
JSON(契约本来就这么写)。回滚即撤本 PR。
-
先看:`ui/packages/app-shell/src/views/ActionResultDialog.tsx`(`TableBlock`
/ `TableCellValue`,`null`
画空格;`ui/packages/core/src/actions/ActionRunner.ts` 的 `columns`
类型从契约派生)、`packages/platform-objects/src/identity/sys-user.object.ts`(导入结果的列)、`packages/spec/liveness/action.json`(`columns`
转 live)。
- 两分钟验证:`cd ui && pnpm exec vitest run
packages/app-shell/src/views/__tests__/ActionResultDialog.test.tsx`,预期
25 例全绿。
- 需要你做的:本 PR 改了 `packages/spec/src`
的描述文字,席位会请您批一次。「加用户」重加一个待激活的人时仍不显示「已待激活」,已另立 #34651(排在 PR #34531 之后)。
## What changes
- **Console renderer**
(`ui/packages/app-shell/src/views/ActionResultDialog.tsx`).
`ResultField` gains a `table` branch, following the `table` bullet of
the `resultDialog` renderer contract in
`packages/spec/src/ui/action.zod.ts`:
- an array value draws as a table, one row per element and one cell per
entry of `columns`, in order; the header is the column's `label` (an
inline locale map is resolved), falling back to its `path`;
- a cell reads the column's dot `path` in the element; a missing key and
a `null` both draw an empty cell, never the text `null` (renderer note 1
of 6934494528);
- a present value draws in the column's `format` (omitted: `text`) when
it fits it (`qrcode` / `secret` / `text` a string, `code-list` an array
of strings); any other value, and every `json` cell, draws as one line
of JSON;
- an element that is not a plain object (an array, `null`, a scalar)
draws as compact JSON in its row's first cell, the other cells empty;
- `[]` draws the header over the existing `table.noRows` line ("No rows
to display"); no new UI string, so no `@object-ui/i18n` pack is touched;
- a value that is not an array draws as `json`; a missing value is
skipped, as for any field.
The dialog widens from `max-w-lg` to `max-w-3xl` when it draws a table.
The preflight panel draws its `fields` through the same exported
`ResultField` (`ActionParamDialog.tsx#PreflightPanel`), so
`preflight.fields` gets the table with no further change.
- **`@object-ui/core` (r2, review nit N2).** `ResultDialogFieldSpec` in
`ui/packages/core/src/actions/ActionRunner.ts` gains `columns?:
SpecResultDialogField['columns']`, derived from the contract row as its
`label` and `format` already are; no hand-written copy. The renderer now
reads `columns` off the runner's own type, so its local intersection
type is gone and the test casts (`as never`) are dropped.
- **`code-list` fit test** (renderer note 2). The field-level fit test
is now the contract's: an array of strings. Before, any array drew as a
code list. One shared `valueFitsFormat` serves the field and the cell.
- **`sys_user.import_sso_users`**
(`packages/platform-objects/src/identity/sys-user.object.ts`). The
`rows` field changes from `json` to `table`. Its columns are read off
the door's row answer (`ImportSsoUserRowResult` in
`packages/plugins/plugin-auth/src/pending-sso-users.ts`, unchanged):
Row, Email, Succeeded (`ok`), Already pending, told again
(`alreadyPending`), Hosting organization told (`host.notified`), Why not
told (`host.reason`), Not added because (`error.message`), Not applied
(`notApplied`, a code list) and Manager (`managerError`). The three
summary counts are unchanged.
- **Spec wrap-up** (prose and ledger only; no key, format value or
refusal changes):
- `columns`' describe loses `[PLANNED — not yet rendered]` and the
"draws its label alone" sentence; the field `format` describe loses the
marker too;
- N3: the `table` bullet now says "not a plain object (an array, `null`
or a scalar)";
- the bullet and the column `format` describe now say that a `null` cell
value draws an empty cell. This writes renderer note 1 into the
contract, so the renderer and the text agree. It goes one sentence past
the delta's list, and the contract review should read it;
- (r2, S1 of the contract review 6939815806) the `table` bullet and the
column `format` describe now say that inside a cell `text` and
`code-list` draw the value alone with no copy control, while `secret`
keeps its mask, reveal and copy and `qrcode` keeps its code and copy.
Prose only: no key, value or behaviour moves;
- `packages/spec/liveness/action.json`: `preflight.fields.columns` and
its three children go `planned` → `live`, with evidence anchored on
`ResultField`, `TableBlock`, `TableCellValue` and `PreflightPanel`. The
`resultDialog` row's note is updated, and
`liveness/state-counts/action.md` is regenerated (live 79 → 82, planned
5 → 2).
- **Docs (r2)**: `content/docs/protocol/objectui/actions.mdx` lists
`table` among the answer-field formats, with its `columns` and the
refusals, in the contract's wording (the item both #34500 contract
records left to the renderer half).
- **Changeset**: `.changeset/33187-action-answer-table-renderer.md`,
patch for `@object-ui/app-shell`, `@object-ui/core`,
`@objectstack/platform-objects` and `@objectstack/spec`.
## Tests
-
`ui/packages/app-shell/src/views/__tests__/ActionResultDialog.test.tsx`
has two new top-level `describe`s in the shared harness, 13 cases. They
cover: the header (label, else path) and column order; one row per
element, read at each path; the empty cell for a missing key and for
`null`; a misfit value drawn as compact JSON (a boolean under `text`, an
object, a non-string array under `code-list`, a number under `secret`);
a `secret` cell staying masked; a non-plain-object element (array,
`null`, string, number) in the first cell; `[]` drawn as header plus
empty line; a non-array value drawn as `json`; a missing `table` field
skipped; an inline locale-map column label; the preflight path through
`ResultField`; and the `code-list` string-array fit with its CONTROL.
The 12 existing cases are the CONTROL for the five formats. They pass
unchanged.
-
`packages/platform-objects/src/identity/cloud-managed-visibility.test.ts`
has a new top-level `describe` (2 cases): `rows` is a `table` whose
column paths are the door's row members, in order, and the summary
fields stay as they were (CONTROL).
- (r2)
`ui/packages/core/src/actions/__tests__/ActionRunner.resultDialog.test.ts`
has a new top-level `describe` with compile-time pins, compiled by the
package's `tsconfig.test.json` (chained off `type-check`):
`ResultDialogFieldSpec['columns']` is structurally `Equal` to the
contract row's `columns`, is not `any`, and is optional.
- No existing assertion changed.
## Acceptance notes
- **Add User `alreadyPending` (the owed should-fix) is not delivered
here, so this PR says `Part of`.** The door answers `alreadyPending:
false` on every fresh add (`runAddSsoUser`). The dialog skips only a
path that resolves to `undefined`, and a boolean fits no format, so it
would draw as `false`. A field reading `alreadyPending` would therefore
draw the misleading "false" row on every fresh add that ruling A turned
down (option C). The contract offers no condition on a field. The seat
chose the door route (a key present only on a re-add, widening only): it
is #34651, sequenced after PR #34531, together with the real-answer
alignment pin.
- **The #33186 changeset sentence cannot be corrected in this
changeset.** `.changeset/33186-managed-add-people-actions.md` has been
released. It shipped in `@objectstack/platform-objects` 18.5.0 (entry
`2e1e3b9`, `packages/platform-objects/CHANGELOG.md`), and #34042 removed
it from `.changeset/`. Under AGENTS.md (Documentation Guardrails,
`CHANGELOG.md` row), a released entry is amended in a dedicated
docs-only PR, never by an erratum in a later changeset. The sentence
becomes true when #34651 lands; that card's Done when carries the
docs-only fallback.
- **Column headers are not translated from bundles.** The i18n extractor
(`packages/lint/src/i18n-walk.ts`) keys `resultDialog.fields.PATH` to a
field's label alone, and the console overlay keys the same way, so a
column `label` gets no bundle key. The import table's headers are
therefore English in every locale. The field label "Result per row"
above the table is still translated. Filed as #34652 (a bundle-key
convention for column labels).
- **Cell chrome.** In a cell, `text` and `code-list` draw the value
alone, with no per-cell copy button, because a 500-row import with a
copy button in every cell is unusable. `secret` keeps its mask, reveal
and copy, and `qrcode` keeps its code and copy. Since r2 the contract
says so in the `table` bullet and the column `format` describe (S1).
- **Known limitation: `readPath` reads inherited members (review nit
N1).** The dot-path reader is plain property lookup, shared by fields
and cells, so a path naming a member the value does not own
(`constructor`, `toString`, `email.length`) resolves to it rather than
to nothing. It predates this PR, the field-level read on `main` behaves
the same, and no declared path reaches it. Not changed here.
- **Booleans draw as `true` / `false`.** No format draws a boolean any
other way, so Succeeded, Already pending and Hosting organization told
show `true` / `false`. This is the table-wide status that ruling A
accepted, not a stray `false` row.
- **The alignment pin does not use a real door answer.** Only
`plugin-auth`'s `pending-sso-users.test.ts` can produce one while also
reading the `sys_user` declaration, and this run may not edit
`packages/plugins/plugin-auth/**`. So the platform-objects pin holds the
column paths, the renderer pins use a sample in the door's documented
row shape, and the real-answer pin rides with #34651.
- **Skills text.** The `skills/objectstack-ui/rules/actions.md` sentence
for `resultDialog` / `table` is governed (Tier H) and goes in #34648,
after this lands.
- No `ui/packages/i18n` change, so the `git merge-tree` check against PR
#34531 does not apply.
## Verification
Readings at head `82f384a572`.
<details><summary>Ablations (each mutation landed on disk via
scripts/ablation-replace.mjs, then restored to the HEAD blob)</summary>
On `ui/packages/app-shell/src/views/ActionResultDialog.tsx`, against
`ActionResultDialog.test.tsx` (the test imports the source file, not
`dist/`):
- A1, `table` branch removed (`format === 'table'` returns `json`): 9
failed, 16 passed.
- A2, `null` handling removed (only `undefined` draws empty): 1 failed,
the `null` empty-cell case.
- A3, `code-list` fit reverted to `Array.isArray`: 2 failed, the
misfit-cell case and the field-level non-string array case.
Each leg restored: the blob after restore equals HEAD (`eea0d1ad0638`),
and `git diff HEAD` is empty.
</details>
<details><summary>Local runs</summary>
- `vitest run
packages/app-shell/src/views/__tests__/ActionResultDialog.test.tsx`: 25
passed.
- NOT MEASURED: the full `@object-ui/app-shell` suite (2284 test files).
Stopped unfinished after about 49 minutes at `--maxWorkers=2` on the
shared box, with no failure line printed by then. This is a declared
narrowing, and the `Test UI` check carries it.
- `pnpm --filter @object-ui/app-shell type-check` (src and
`tsconfig.test.json`): exit 0.
- `pnpm --filter @objectstack/platform-objects test`: 123 files, 2046
passed. `typecheck`: exit 0.
- `pnpm --filter @objectstack/spec test`: 847 files, 27134 passed, 1
todo. `typecheck`: exit 0.
- Targeted spec run (`action-answer-table-format`, `action-preflight`,
`component`, `action` tests): 616 passed.
- `pnpm --filter @objectstack/spec check:generated`: all 14 artifacts
current after a rebuild on the merged tree. `check:liveness`: exit 0
(action: live 82, dead 1, planned 2).
- `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived 98 commands on head 82f384a; each
was run with stdin closed and its exit captured before any pipe. All 98
exit 0. Three needed a second run: `check-plugin-teardown-shape
--self-test` first exited 3 (shallow clone; its fixture commit was
fetched), `check:dual-build-cjs-loads` first exited 3 (no full build; it
was rerun after `turbo run build`), and `pnpm --dir ui exec vitest run
scripts/` was killed by the OOM killer while sharing the box, then
passed alone (171 files passed, 2 skipped). `--ran` reconciliation: 98
derived, 98 run, 0 NOT-MEASURED, 0 UNRUN.
- Not run locally: a browser pass of the dialog on a managed
environment.
</details>
<details><summary>Round r2 (head d854d10)</summary>
Old head `82f384a572` → new head `d854d108bd`. Commits: `02ecb823` (S1
prose and the actions page), `d4a79d7f` (core `columns` derived;
renderer and tests use it), `d854d108` (changeset names core and the
cell sentence), plus merge `6dbbf712` of `origin/main` (PR #34531
included).
- Ablations of the derivation, via `scripts/ablation-replace.mjs` on
`ActionRunner.ts`, each read by `tsc -p tsconfig.test.json` in
`ui/packages/core`: B1, the derived `columns` member deleted → exit 2,
TS2339/TS2353 at the new pins; B2, `columns` restated by hand as an
array of `{ path: string; label?: string }` → exit 2, TS2344
(`_IsTheSpecColumns` false) and TS2353. Both legs restored: blob equals
HEAD (`f47c1e3b9716`), `git diff HEAD` empty. A first B1 attempt passed
an empty `--replacement`; the tool refused it (count rose 0, not 1) and
nothing ran, so it was rerun with `--delete`. The S1 and docs edits are
prose only, so they get no ablation.
- `@object-ui/core` type-check and `@object-ui/app-shell` type-check:
exit 0. `ActionResultDialog.test.tsx` and
`ActionRunner.resultDialog.test.ts`: 2 files, 40 passed.
- Spec: `action-answer-table-format`, `action-preflight`, `component`,
`action` and `check-liveness` tests: 5 files, 699 passed.
`check:generated`: all 14 current. A first run reported
`check:test-typecheck` stale because `tsc` exited without diagnostics on
the shared box; rerun alone under the lock: all current, nothing
regenerated.
- `dispatch-gates --commands` derived 119 commands on `d854d108bd` (the
merge brought docs families). Each was run with stdin closed and its
exit captured before any pipe: all 119 exit 0. `--ran`: 119 derived, 119
run, 0 NOT-MEASURED, 0 UNRUN.
</details>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01ADHkmSYVw1sqCsaHSJS9JC
<!-- signed: repo:objectstack#2 · os-steve ·
session_01ADHkmSYVw1sqCsaHSJS9JC -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent a1082f3 commit 84e6bbb
11 files changed
Lines changed: 481 additions & 37 deletions
File tree
- .changeset
- content/docs/protocol/objectui
- packages
- platform-objects/src/identity
- spec
- liveness
- state-counts
- src/ui
- ui/packages
- app-shell/src/views
- __tests__
- core/src/actions
- __tests__
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
480 | 480 | | |
481 | 481 | | |
482 | 482 | | |
483 | | - | |
| 483 | + | |
484 | 484 | | |
485 | 485 | | |
486 | 486 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
548 | 548 | | |
549 | 549 | | |
550 | 550 | | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
551 | 557 | | |
552 | 558 | | |
553 | 559 | | |
554 | 560 | | |
555 | | - | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
556 | 577 | | |
557 | 578 | | |
558 | 579 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
280 | | - | |
| 280 | + | |
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
| |||
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
330 | | - | |
331 | | - | |
332 | | - | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
333 | 334 | | |
334 | 335 | | |
335 | | - | |
336 | | - | |
337 | | - | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
338 | 339 | | |
339 | 340 | | |
340 | | - | |
341 | | - | |
342 | | - | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
343 | 344 | | |
344 | 345 | | |
345 | | - | |
346 | | - | |
347 | | - | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
348 | 349 | | |
349 | 350 | | |
350 | 351 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
873 | 873 | | |
874 | 874 | | |
875 | 875 | | |
876 | | - | |
| 876 | + | |
877 | 877 | | |
878 | 878 | | |
879 | 879 | | |
| |||
935 | 935 | | |
936 | 936 | | |
937 | 937 | | |
938 | | - | |
939 | | - | |
| 938 | + | |
| 939 | + | |
940 | 940 | | |
941 | 941 | | |
942 | 942 | | |
| |||
1809 | 1809 | | |
1810 | 1810 | | |
1811 | 1811 | | |
1812 | | - | |
1813 | | - | |
1814 | | - | |
1815 | | - | |
1816 | | - | |
1817 | | - | |
1818 | | - | |
1819 | | - | |
1820 | | - | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
1821 | 1825 | | |
1822 | 1826 | | |
1823 | 1827 | | |
| |||
0 commit comments