Repository navigation
fix(plugin-grid): report a rejected aggregate bulk action as one outcome and refresh the list - #34213
Conversation
…ome and refresh the list A rejected execution:'aggregate' run is one outcome for the selection: the result dialog shows the rejection's userMessage (else message) once, with no per-row count or list, and the grid re-reads its rows on close whether the call resolved or rejected. The script/server action dispatch relays the refusal's error.userMessage on ActionResult.userMessage. Claude-Session: https://claude.ai/code/session_01ADHkmRD9ZdCE9G3z9FgtCj Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmRD9ZdCE9G3z9FgtCj Co-authored-by: Claude <noreply@anthropic.com>
|
domain:ui#1 · os-steve · session_01ADHkmT2NE3iyG1o6TDg3sf Test UI (5/16) red on head
|
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head 3f829b5 · 2026-11-16T03:03Z |
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract reviewServed-tier: Read at 2026-11-16T03:10Z. First review of this head; claim: comment 6906109343; no lane request (owed per check-owed-reviews). Independence: implemented in an os-steve project thread for domain:ui#1; reviewed by os-tesla, who neither dispatched nor implemented it. Face: declaration ( ① Derived judgments
Findings: S1 (should-fix) — the dialog's second sentence states something the client cannot know. N1 (nit) — a rejected aggregate run over a selection that also holds a row with no id records N2 (nit) — closing the dialog while the call is still running hands N3 (nit) — ② Semver level
CI on this head: 66 check-runs, all completed; 52 success, 12 skipped, 2 failure. The failures are CI completed before posting: 66 check-runs on this head, 52 success, 12 skipped, 2 failure (the unrelated app-shell case above). ③ Boundary flags
④ Design judgmentThe declaration face carries no ④ of its own; the brief asked for one, so the judgment is stated. Carrying the marked text as a field on the result and on the thrown error, rather than re-reading the response at the grid, follows the No must-fix. One should-fix (S1), three nits (N1, N2, N3). Implemented-by: VERDICT: PASS |
The client cannot know whether a rejected aggregate handler kept any write, so the sentence says some records may already have been changed and that the list shows their current values on close, in every locale pack. Claude-Session: https://claude.ai/code/session_01ADHkmRD9ZdCE9G3z9FgtCj Co-authored-by: Claude <noreply@anthropic.com>
|
domain:ui#1 · os-steve · session_01ADHkmT2NE3iyG1o6TDg3sf Contract reviewServed-tier: Face: declaration, a delta on review#2's record 6906205005 (PASS at ① Derived judgments (the delta only)
② Semver levelUnchanged: ③ Boundary flags
Implemented-by: VERDICT: PASS |
|
domain:ui#1 · os-steve · session_01ADHkmT2NE3iyG1o6TDg3sf 席位核对Verdict: ACCEPT · head
|
Requested by Steve · project thread
Fixes #34173
Clause-②: yes (widening) — optional member userMessage on ActionResult (@object-ui/types) and ActionResponseOutcome (@object-ui/core); nothing removed or renamed
Metadata-protocol: none
维护者速读
execution: 'aggregate')的批量动作被拒时,结果框只说一次「操作未对所选记录全部完成」,并只显示一次处理器写给用户的提示(userMessage,没有就用message);不再逐行重复同一句报错,也不再显示「成功 0 / N」。关掉结果框后列表会重新读取,被改过的记录显示新值。逐条执行的批量动作显示完全不变。ActionResult(@object-ui/types)和ActionResponseOutcome(@object-ui/core)各多一个可选字段userMessage。回滚即 revert 本 PR。ui/packages/plugin-grid/src/hooks/useBulkExecutor.ts(aggregate 一次结算、一个结果);ui/packages/plugin-grid/src/components/BulkActionDialog.tsx(结果框的 aggregate 分支);ui/packages/plugin-grid/src/ObjectGrid.tsx(拒绝时带上userMessage、关闭时刷新)。pnpm --dir ui exec vitest run packages/plugin-grid/src/__tests__/objectBulkActionDispatch.test.tsx,预期全绿,其中an aggregate rejection is one outcome for the selection组 5 条。What changes
A rejected aggregate bulk run is ONE outcome for the selection. The one call cannot say which rows it wrote before it stopped (a non-transactional body can move some rows and then reject once), so the result no longer pretends to a per-row count.
useBulkExecutor: anexecution: 'aggregate'def no longer rides the bulk-first decision tree. It makes its onerunAggregatecall; resolved, every row counts as covered (unchanged); rejected, the result carriesaggregateRejection: { message }, wheremessageisdeclaredUserMessage(error)(the producer-markeduserMessage) else the error's own message, anderrorsgets no per-row entry. A rejected run also invalidates the resource's cached related counts, as a successful one does.BulkResultis not exported from the package.BulkActionDialog: for a result withaggregateRejection, the panel says the action did not complete for the selected records (new keygrid.bulk.aggregateNotCompleted) and shows the message once. No "Succeeded x / N", no per-row list, no error CSV, no Retry. Every other result renders exactly as before.ObjectGrid: the aggregate dispatcher rejects with anErrorwhosemessageisActionResult.errorand which carriesActionResult.userMessagewhen present. On dialog close, a result withaggregateRejectionbumpsrefreshKey, the same refresh path the per-row run already takes when rows succeeded; the selection stays, ready for a re-run. A resolved aggregate run keeps its existing refresh, which happens once.interpretActionResponsereads the refusal'serror.userMessage(ADR-0112 envelope; non-empty string only, verbatim) ontoActionResponseOutcome.userMessage, andcreateServerActionHandlerrelays it on the failedActionResult.userMessage.errorstays the whole text, so every existing reader oferror(toasts, the per-row list) is unchanged. The readerrefusalUserMessagestays off the package's public entry.grid.bulk.aggregateNotCompletedin all eleven packs (zh-Hantregenerated withgen-zh-hant.mjs). The sentence has no{{count}}, so it is not a plural family.content/docs/ui/views.mdxsays what the dialog shows for a rejected aggregate run and when the list re-reads.Tests
objectBulkActionDispatch.test.tsx, new top-level describean aggregate rejection is one outcome for the selection (objectstack#34173), driven through the realscriptdispatch (createServerActionHandler) and the/actionsdoor's refusal envelope:userMessageshows once; the platformmessageis absent; zerobulk-error-row-*; no "Succeeded" and no "0 / 2" text;userMessage, themessageshows once;findruns exactly once after Done following a rejection, and exactly once following a resolve;bulkActions: ['mass_update_stage']) with one refused row still reads "Succeeded 1 / 2" and listsbulk-error-row-r2with the row's error text.useBulkExecutor.test.ts: a rejection is oneaggregateRejectionwitherrors: []; it reportsuserMessageovermessage; a resolved call carries no rejection.serverActionHandler.test.ts, new describeuserMessage relay: relayed verbatim besideerror; absent when unmarked; a blank, numeric or object value is no marking.useBulkExecutor.test.ts"attributes a failed aggregate call to every id with the real error — no per-record re-dispatch" is now "a failed aggregate call is one outcome for the selection — no per-id error, no per-record re-dispatch".useBulkExecutor.test.ts"fails loudly when no runAggregate is wired…" now reads the message fromaggregateRejectioninstead oferrors[0].objectBulkActionDispatch.test.tsx"attributes a failed aggregate call to every record, with no per-row Retry" is now "reports a failed aggregate call once for the selection, with no per-row list and no Retry".Acceptance notes
ui/packages/plugin-grid/src/ObjectGrid.tsx(the dialog's mount, and the per-row refresh path the order says to reuse lives there);ui/packages/types/src/ui-action.ts(ActionResult.userMessage, the carrier from the script dispatch to the grid);content/docs/ui/views.mdx(ui commandment 2, docs-driven); all eleven locale packs, becauseall-locales-key-parity.test.tsrequires every pack to define everyenkey, so "let other locales fall back" is not available in this pack.ActionResult.userMessage(@object-ui/types) andActionResponseOutcome.userMessage(@object-ui/core). No new exported name. Precedent:ActionResult.fieldErrors, the same relay of the same refusal envelope. The seat ruled the declarationClause-②: yes (widening)(a non-protocol widening, so the changeset stayspatch); the PR body and the changeset carry it since head 3f829b5.packages/spec, out of scope here.userMessagestill lists the row'serror(the platform message), and the single-record action toast readserrortoo. WithActionResult.userMessagenow carried, preferring it there is a small follow-up. The CONTROL pin above shows the current per-row text.ctx.session(the flow: a record-change or schedule flow cannot write stored text in the org's language (no effective-locale read in value slots, 18.5.0) #34062 class).Verification
Measured on main 75ab117 before the fix: all three symptoms, script dispatch
A probe test drove the real
ObjectGridwithcreateServerActionHandler; the/actionsanswer was400 { success: false, error: { code: 'HOOK_ABORTED', message: 'mass_update_stage: Plan B is Closed Won', userMessage: 'Plan B is Closed Won and was not moved.' } }:The wire for both handler shapes, read from
actionsDoorAnswerOf(@objectstack/typesdist on the same tree): a script body's sandboxed throw and a server action's plain throw both answeruserMessagebesidemessage:The client then dropped
userMessageininterpretActionResponse/actionErrorDetail, which readerror.messageonly.Ablation: five legs, each red, restored clean (scripts/ablation-replace.mjs, anchors hit 1 → 0)
Committed fix first (7cf6c65); each leg mutated one line and ran the three touched test files; the trap restored
git checkout HEAD -- ui/packagesand printedRESTORED-CLEAN. Tests resolve@object-ui/*from source, so no dist rebuild was involved.useBulkExecutor.tsdeclaredUserMessage(e)→null: red "shows the rejection's userMessage once…" and "the rejection reports its producer-marked userMessage, not its message".ObjectGrid.tsxthe rejection refresh branch disabled: red "re-reads the grid once when the dialog closes after a rejection".BulkActionDialog.tsxper-row branch guard removed (!result.aggregateRejection): red "shows the rejection's userMessage once, with no per-row list and no "0 / N" count".serverActionHandler.tsuserMessagerelay removed: red "relays error.userMessage verbatim…" and the dialog userMessage pin.useBulkExecutor.tsaggregate branch disabled: red across both aggregate describes (11 tests).Local runs on head 2ee839f (main 571cf90 merged)
Head 3f829b5 changes only the changeset's Clause-② line; on it
check-changeset-no-major,check-empty-changeset,check-adr-0087-registration(each--base origin/main),check:changeset-gate-self-testsandcheck:nul-bytesre-ran, exit 0 each.pnpm run type-check, tsc echoed):@object-ui/types,@object-ui/core,@object-ui/i18n,@object-ui/plugin-grid— each exit 0.pnpm exec vitest run packages/plugin-grid/ packages/types/ packages/i18n/ packages/core/src/actions/— Test Files 830 passed (830), Tests 15603 passed, 13 skipped. Lock VERDICT command-exit 0.ui/packagesandui/apps(declared narrowing; CI's Test UI runs everything): 12 files in components, app-shell and console — Test Files 12 passed, Tests 466 passed.check:i18n-keys,check:i18n-drift,check:i18n-dead-keys(ui): exit 0 each.node scripts/pm/dispatch-gates.mjs --commands: 72 derived families, all exit 0;--ranreconciliation: 72 derived, 72 run, 0 NOT-MEASURED, 0 UNRUN.!in the title and no(narrowing)arm.