Skip to content

fix(core): a declared action's confirm dialog names the action - #26663

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-lwevo0
Oct 27, 2026
Merged

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

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steedos · project thread

Fixes #26580

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:点一个声明了 confirmText 的动作时,确认框的标题和确认按钮现在显示动作自己的名字(如「标记为赢单」),variant: 'danger' 的动作确认按钮变成红色危险样式。以前一律是「确认操作」+ 中性的「继续」。
  • 为什么改:用户在确认框里看不出自己确认的是哪个动作,危险操作也没有危险提示;Record Delete 早已这样做,声明式动作没有。
  • 风险与回滚:低。只改 ActionRunner 的一个调用点,把已有的 options 参数传给已有的确认处理器;没有新键。另在 ui 门禁 check-action-forward-parity 的豁免表加四条(四个 action 渲染器的 variant 是按钮样式词表,不转给 runner)。回滚即 revert 本 PR。
  • 先看:ui/packages/core/src/actions/ActionRunner.ts 的确认调用点与新的 confirmOptions;ui/packages/core/src/actions/__tests__/ActionRunner.confirmNamesAction-26580.test.ts;ui/scripts/check-action-forward-parity.mjs 新增的四条 JUSTIFIED。
  • 两分钟验证:cd ui && pnpm exec vitest run packages/core/src/actions/__tests__/ActionRunner.confirmNamesAction-26580.test.ts,预期 5 个用例全绿;或在控制台点一个带确认文案的危险动作,确认框标题是动作名、按钮是红色的动作名。
  • 需要你做的:无,席位落地。

What changes

ActionRunner asked its ConfirmationHandler with the confirm message alone, so the console's ActionConfirmDialog always fell back to its generic actionConfirm.title / actionConfirm.confirm copy ("Confirm Action" / "Continue", 「确认操作」 / 「继续」), and a variant: 'danger' action confirmed through a neutral button.

The runner now fills the handler's existing options bag from what the action already declares (no new key, per triage comment 6437776331):

  • title and confirmText are the action's label. Every console surface resolves the label against the locale's bundle before dispatch (useActionTextLocalizer), so the runner receives the localized string.
  • destructive: true when the action declares the spec's variant: 'danger' (ActionSchema.variant, packages/spec/src/ui/action.zod.ts), the same flag the record Delete passes, which paints the confirm button with buttonVariants({ variant: 'destructive' }).
  • The cancel button keeps the host's copy. An action with neither a label nor the danger variant is asked with the message alone, exactly as before.

ActionConfirmDialog.tsx and useConsoleActionRuntime needed no change: both already forward and render title, confirmText and destructive. The ConfirmationHandler type is unchanged; its doc comment now names the runner as one of the bag's producers.

Where the danger-to-destructive styling lives: the runner turns the spec's variant: 'danger' into the handler's destructive: true (confirmOptions in ui/packages/core/src/actions/ActionRunner.ts). The dialog turns destructive into the style: ActionConfirmDialog.tsx sets the confirm button's className to buttonVariants({ variant: 'destructive' }) from @object-ui/components (unchanged since objectui#11695). No other mapping is added.

Gate table, one file outside the first claim (claim amended, comment 6440643307). The runner now reads action.variant, so ui/scripts/check-action-forward-parity.mjs owed variant on action:button, action:icon, action:group and action:menu. Those renderers' variant is @object-ui/types' UIActionSchema.variant, the button-style vocabulary (default | primary | secondary | destructive | outline | ghost), consumed at the renderer; the runner reads the spec enum on ActionDef (primary | secondary | danger | ghost | link). Forwarding it raw does not type-check and carries no danger, so the four omissions are JUSTIFIED entries (issue 26580), not forwards. The vocabulary gap itself is left open; see Acceptance notes.

Tests

  • New ui/packages/core/src/actions/__tests__/ActionRunner.confirmNamesAction-26580.test.ts (5 tests): a labelled action passes { title, confirmText }; a labelled danger action adds destructive: true; a labelless danger action passes { destructive: true } only; a CONTROL action with neither is called with the message alone; a cancel still stops the run.
  • Ablation (one-off, not kept): scripts/ablation-replace.mjs replaced this.confirmHandler(confirmMessage, confirmOptions) with this.confirmHandler(confirmMessage) (anchor 1 to 0, blob 888cfb538c5d to 926b95771ab6). The new file went red: Tests 3 failed, 2 passed (the CONTROL and the cancel case stay green, as expected). Restored to the HEAD blob with git diff HEAD empty.
  • The test imports the runner from source (../ActionRunner), so no dist/ rebuild sits between the mutation and the run.

Acceptance notes

  • The existing one-argument pins (ActionRunner.test.ts "should show confirmation", ActionRunner.callContext-13063.test.ts) use actions with no label, so they still hold unchanged; that is the CONTROL path.
  • The confirm button repeats the action's label, as triage asked. A surface whose action reaches the runner without a label still shows the generic chrome.
  • Open, not built here: an action:button / action:icon / action:group / action:menu node styled variant: 'destructive' (the UIActionSchema spelling) gets a neutral confirm button, because the runner reads only the spec's danger. Closing it needs a decision on the two vocabularies (map one onto the other, or retire one); it is reported to the seat as an open question. Declared actions dispatched by the console's spread-based hosts (DeclaredActionsBar, page:header's dispatchHeaderAction) carry the declaration's own spec variant and are covered.

Verification

All readings at head 84482207 unless named. The core suite and type-check ran at 88581363; the later commit touches only ui/scripts/check-action-forward-parity.mjs, so they still hold.

Touched package: @object-ui/core
  • bash scripts/pm/os-verify-lock.sh -c 'cd ui && pnpm exec vitest run packages/core/ --maxWorkers=2' (after --filter '@object-ui/core^...' build): Test Files 214 passed (214), Tests 4105 passed, 27 skipped; VERDICT command-exit 0.
  • pnpm --filter @object-ui/core run type-check (tsc --noEmit && tsc -p tsconfig.test.json, so the tests are covered): exit 0.
ui scripts suite and the forward-parity gate
  • node ui/scripts/check-action-forward-parity.mjs: exit 0 (action:button owes 29, forwards 25; icon, group, menu owe 29, forward 23; payloads excess-property CHECKED).
  • pnpm --dir ui exec vitest run scripts/ under the lock, after --filter '@object-ui/app-shell^...' build: Test Files 178 passed, 2 skipped (180); Tests 5065 passed, 2 skipped. Before the JUSTIFIED entries it was red on check-action-forward-parity.test.ts > the real repository > is green (the four variant drops); the run before the closure build also failed unit-registry-absence-collision.test.ts on unbuilt workspace packages, a prerequisite, green after the build.
Derived gates: 34 of 34, all exit 0

node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack at 84482207 derived 34 commands from 4 changed paths; each ran with its exit code captured before any pipe (the PR-body gates read this body through GITHUB_EVENT_PATH; check:type-check-debt under the lock). Reconciliation: --ran answered "34 derived famil(ies) accounted for — 34 run, 0 NOT-MEASURED (a DERIVED zero — all 34 recorded an exit code and none of them is 3)". check-partof-closing-keyword.mjs on this body: exit 0.

Dogfood battery: not owed (no ! in the title, no (narrowing) arm).


Generated by Claude Code

ActionRunner asked its ConfirmationHandler with the message alone, so the
console dialog always read the generic "Confirm Action" / "Continue" chrome
and a danger action confirmed through a neutral button. The runner now
passes the handler's existing options bag: the action's label as title and
confirm label, and destructive for variant 'danger'.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jSVZrd3f8WgEZrkUCu
…om the runner forward

The runner now reads `variant` (danger paints the confirm button
destructive), so check-action-forward-parity owed it on action:button,
icon, group and menu. Their `variant` is the @object-ui/types button-style
vocabulary consumed at the renderer, not the spec enum the runner reads,
so the four omissions are JUSTIFIED rather than forwarded.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jSVZrd3f8WgEZrkUCu
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

席位核对

ACCEPT · seat domain:ui#4 · session_01QsR2jTfvjNTaR29ehLk26T · 2026-10-27T12:22Z · head 84482207cc666510d752f26e19494c305a6809ea

  1. Shape: draft, base main, first line Fixes #26580. Clause-②: no and Metadata-protocol: none match the claim (6440272542), in the body and in the changeset. All four files are inside the amended surface (6440643307): ActionRunner.ts (the confirm call site plus a private confirmOptions), its new test, the four JUSTIFIED entries in ui/scripts/check-action-forward-parity.mjs, and one root changeset. No content/docs/releases/.
  2. Premise, measured: the seat read the diff. The runner called confirmHandler(message) with no options, so the console dialog always fell back to 「确认操作」 / 「继续」. Now confirmOptions fills the handler's existing options bag from what the action already declares. label becomes the title and the confirm text. The spec's variant: 'danger' becomes destructive: true. An action with neither still gets the one-argument call. The ConfirmationHandler type is unchanged, so no key is added, as triage ruled (6437776331).
  3. Gates, pinned to the head: check-runs at 84482207: 52 total, 43 success, 9 skipped, 0 failed. Type Check UI, Lint UI, Test UI (16 shards), Build & E2E UI and Check Changeset are all success. check-governed-merges --pr 26663: not governed, 160 changed lines ≤ 3000. mergeable_state: clean.
  4. Accepted deviations: the four JUSTIFIED entries are the amended surface. Each names this card and the reason: the block renderers' variant is UIActionSchema's button vocabulary, not ActionDef's enum. Clause-②: no is kept because the handler type is unchanged. The report's open question, the destructive vs danger dialect, is filed as action:button / icon / group / menu: UIActionSchema.variant spells danger destructive while the spec's ActionDef says danger, so a block-declared danger action confirms through a neutral button #26665 (no labels, for triage). When it lands, the four entries go.
  5. Out of scope: reconciling the dialect (action:button / icon / group / menu: UIActionSchema.variant spells danger destructive while the spec's ActionDef says danger, so a block-declared danger action confirms through a neutral button #26665). A block-declared danger action (action:button and the other three) still confirms through a neutral button until then. Declarations dispatched by spread already carry danger. Skills-docs: is not owed.
  6. Prose face, checked sentence by sentence against the diff: each changeset claim matches a hunk and a test:
    • the label titles the dialog and labels the confirm button;
    • danger makes the button destructive;
    • the cancel button keeps the host's copy;
    • neither label nor danger means the message alone (the CONTROL case);
    • a custom handler that ignores its second argument behaves as before.

Landing: no contract review is owed (no published schema, no governed text, Clause-②: no). The seat marks the PR ready and arms auto-merge. On MERGED, Fixes #26580 closes the card.


Generated by Claude Code

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 27, 2026 12:22
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge October 27, 2026 12:23
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 27, 2026
Merged via the queue into main with commit 47b6392 Oct 27, 2026
53 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-lwevo0 branch October 27, 2026 12:46
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.

An action's confirm dialog is always titled 「确认操作」 with a 「继续」 button — the action's own label and danger variant never reach it

2 participants