Skip to content

fix(core, plugin-grid): show the handler's userMessage on the failure toast and a per-record failed row - #34313

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-pgje9l
Nov 16, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-pgje9l

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #34215

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:单条记录动作失败时,提示条先用动作作者写的 errorMessage,没有就用处理器写给用户的 userMessage,再没有才用平台报错原文。逐条执行的批量动作(bulkActions: ['NAME'])结果框里,失败那一行也显示 userMessage;下载的错误 CSV 仍保留整句平台报错,便于排查。
  • 为什么改:处理器明明写了给用户看的话(如「商机 B 已赢单,未改阶段」),单条失败提示和批量逐行结果却只显示内部报错句子。整体执行(aggregate)那一半已由 fix(plugin-grid): report a rejected aggregate bulk action as one outcome and refresh the list #34213 修好,这是剩下的两处。
  • 风险与回滚:只改失败时显示哪段文字;声明了 errorMessage 的动作显示不变,没有 userMessage 的拒绝显示不变。BulkRowError 多一个可选字段 userMessage。回滚即 revert 本 PR。
  • 先看:ui/packages/core/src/actions/ActionRunner.ts(失败提示的取字顺序);ui/packages/plugin-grid/src/hooks/useBulkExecutor.ts(逐行拒绝带上 userMessage);ui/packages/plugin-grid/src/components/BulkActionDialog.tsx(行显示 userMessage,CSV 仍写整句)。
  • 两分钟验证:pnpm --dir ui exec vitest run packages/core/src/actions/__tests__/ActionRunner.test.ts packages/plugin-grid/src/__tests__/objectBulkActionDispatch.test.tsx -t 34215,预期 7 条全绿。
  • 需要你做的:无,席位落地。

What changes

  • Failure toast (ActionRunner, @object-ui/core): the message is the action's authored errorMessage, else the refusal's producer-marked ActionResult.userMessage, else result.error (seat ruling on the card's delta: authored first, because the spec declares errorMessage the override of the raw error). A blank userMessage is no marking, the same non-empty rule declaredUserMessage and @objectstack/client apply; the existing non-string coercion is unchanged.
  • Per-record bulk run (@object-ui/plugin-grid):
    • ObjectGrid's per-record runner (runBulkActionRecord) attaches the refusal's userMessage to the rejection, as the aggregate runner below it already does.
    • useBulkExecutor reads declaredUserMessage off each per-record rejection of the custom runner and sets it on that row as a new optional BulkRowError.userMessage; error stays the whole text. The shared executeBulkBatch (bulkFastPath.ts) is untouched.
    • BulkActionDialog lists userMessage for the row when present, else error; the error CSV still writes error.
  • Docs (surface amended by the seat on the card): content/docs/ui/actions.mdx states the toast's order; content/docs/ui/views.mdx states what a per-record run's row and error CSV show.
  • Changeset .changeset/34215-failure-toast-row-user-message.md (patch: @object-ui/core, @object-ui/plugin-grid).

Why

A handler that refuses with a userMessage wrote that sentence for the end user. #34213 carried it to ActionResult.userMessage and showed it on the aggregate outcome; the single-record toast and the per-record failed row still showed the platform text.

Tests

New block in ui/packages/core/src/actions/__tests__/ActionRunner.test.ts, "the failure toast shows the refusal's userMessage (objectstack#34215)":

  • shows the userMessage of a refusal that carries one;
  • carries it from the /actions door: a real createServerActionHandler over a refusal envelope reaches the toast;
  • CONTROL: a refusal without a userMessage keeps the error;
  • a blank userMessage is no marking;
  • an authored errorMessage keeps its text even when the refusal carries a userMessage.

New block in ui/packages/plugin-grid/src/__tests__/objectBulkActionDispatch.test.tsx, "a per-record failed row shows the refusal's userMessage (objectstack#34215)", driving the real ObjectGrid through createServerActionHandler:

  • the row lists userMessage (not the platform text), and the downloaded error CSV's row keeps the platform text (not the userMessage);
  • CONTROL: a refusal without a userMessage keeps the platform text on the row.

Declared forced test edit: the #34213 CONTROL "a per-record dispatch with one failing row still lists that row" asserted PLATFORM_TEXT on bulk-error-row-r2 for a refusal carrying userMessage; it now asserts USER_TEXT, which is the behaviour this card asks for. Its comment says so.

Ablations (each read removed, its pin red; every leg restored to the HEAD blob)

Run through scripts/ablation-replace.mjs under the verify lock, -t 34215, on head e19178c (before the main merge; the merge touched none of these files):

# Mutation Red
A1 toast: authored || declared || result.error to authored || result.error "shows the userMessage…", "carries it from the /actions door…" (2 failed / 3 passed)
A2 toast: declared ahead of authored "an authored errorMessage keeps its text…" (1 failed)
A3 toast: .trim() to .length > 0 "a blank userMessage is no marking…" (1 failed)
A4 runBulkActionRecord throws the bare error row pin (1 failed / 1 passed)
A5 executor no longer records the rejection's userMessage row pin
A6 executor no longer attaches it to the row error row pin
A7 dialog row reads e.error row pin
A8 CSV writes e.userMessage ?? e.error row pin, at the CSV assertion (the CSV row lost the platform text)

ui tests resolve @object-ui/* from src, so no dist leg applies.

Acceptance notes

  • The per-record userMessage read is scoped to the promoted custom runner (the card's surface). A data-door update/delete row whose rejection carried a userMessage still shows its message; no producer of that shape was measured, so it is noted here, not filed.

Verification

All on head dcc5978a (this branch with origin/main a00b422 merged in), after pnpm install --frozen-lockfile --offline and a full pnpm build --concurrency=2 (lock VERDICT command-exit 0).

  • Affected packages' tests: pnpm --dir ui exec vitest run packages/core/ packages/plugin-grid/ — Test Files 521 passed (521), Tests 6882 passed, 27 skipped; lock VERDICT command-exit 0.
  • Type-check: pnpm --filter @object-ui/core type-check && pnpm --filter @object-ui/plugin-grid type-check (each runs tsc --noEmit and tsc -p tsconfig.test.json) — VERDICT command-exit 0.
  • Derived gates: node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack listed 72 families for the 9 changed paths; all 72 ran, each exit 0; --ran reconciliation: 72 derived, 72 run, 0 NOT-MEASURED, 0 UNRUN.
  • pnpm --dir ui run check:new-line-citations: 0 new citations.
  • CI-owned families (repo-wide lint, Test UI shards, Build and E2E UI, dogfood) are read from this PR's check-runs, not re-run here. No dogfood battery: no ! in the title and no (narrowing) arm.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes. (No formatter ran; the repo-wide lint is CI's run, read from this PR's checks.)
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed. (not touched)
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

Generated by Claude Code

… toast and a per-record failed row

The failure toast reads the action's authored errorMessage, then the
refusal's userMessage, then the error. The per-record bulk runner carries
userMessage on its rejection; the executor attaches it to the row as
BulkRowError.userMessage, the dialog lists it, and the error CSV keeps the
whole message.

Claude-Session: https://claude.ai/code/session_01ADHkmSKHw9YYY8V6nVNVFk
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 16, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#2 · os-steve · session_01ADHkmSzhXR4yUAgwq1bQRi

维护者速读

席位意见

三处读同一个标记、同一条非空规则,和聚合路径一致,是根修。作者声明的 errorMessage 优先,既符合 spec 描述,也不改变已有动作的显示。同意落地。

席位核对 — ACCEPT · domain:ui#2 · head dcc5978 · 2026-11-16T05:47Z

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 16, 2026 05:47
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 16, 2026
Merged via the queue into main with commit 5a75579 Nov 16, 2026
63 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-pgje9l branch November 16, 2026 06:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

console: a single-record action's error toast and a per-record bulk row show the platform message, not the handler's userMessage

2 participants