Repository navigation
fix(core): a declared action's confirm dialog names the action - #26663
Merged
Merged
Conversation
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
Contributor
Author
席位核对ACCEPT · seat
Landing: no contract review is owed (no published schema, no governed text, Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Steedos · project thread
Fixes #26580
Clause-②: no
Metadata-protocol: none
维护者速读
confirmText的动作时,确认框的标题和确认按钮现在显示动作自己的名字(如「标记为赢单」),variant: 'danger'的动作确认按钮变成红色危险样式。以前一律是「确认操作」+ 中性的「继续」。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
ActionRunnerasked itsConfirmationHandlerwith the confirm message alone, so the console'sActionConfirmDialogalways fell back to its genericactionConfirm.title/actionConfirm.confirmcopy ("Confirm Action" / "Continue", 「确认操作」 / 「继续」), and avariant: 'danger'action confirmed through a neutral button.The runner now fills the handler's existing
optionsbag from what the action already declares (no new key, per triage comment 6437776331):titleandconfirmTextare the action'slabel. Every console surface resolves the label against the locale's bundle before dispatch (useActionTextLocalizer), so the runner receives the localized string.destructive: truewhen the action declares the spec'svariant: 'danger'(ActionSchema.variant,packages/spec/src/ui/action.zod.ts), the same flag the record Delete passes, which paints the confirm button withbuttonVariants({ variant: 'destructive' }).ActionConfirmDialog.tsxanduseConsoleActionRuntimeneeded no change: both already forward and rendertitle,confirmTextanddestructive. TheConfirmationHandlertype 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'sdestructive: true(confirmOptionsinui/packages/core/src/actions/ActionRunner.ts). The dialog turnsdestructiveinto the style:ActionConfirmDialog.tsxsets the confirm button'sclassNametobuttonVariants({ 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, soui/scripts/check-action-forward-parity.mjsowedvariantonaction:button,action:icon,action:groupandaction:menu. Those renderers'variantis@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 onActionDef(primary | secondary | danger | ghost | link). Forwarding it raw does not type-check and carries nodanger, so the four omissions are JUSTIFIED entries (issue 26580), not forwards. The vocabulary gap itself is left open; see Acceptance notes.Tests
ui/packages/core/src/actions/__tests__/ActionRunner.confirmNamesAction-26580.test.ts(5 tests): a labelled action passes{ title, confirmText }; a labelled danger action addsdestructive: 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.scripts/ablation-replace.mjsreplacedthis.confirmHandler(confirmMessage, confirmOptions)withthis.confirmHandler(confirmMessage)(anchor 1 to 0, blob888cfb538c5dto926b95771ab6). 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 withgit diff HEADempty.../ActionRunner), so nodist/rebuild sits between the mutation and the run.Acceptance notes
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.action:button/action:icon/action:group/action:menunode styledvariant: 'destructive'(theUIActionSchemaspelling) gets a neutral confirm button, because the runner reads only the spec'sdanger. 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'sdispatchHeaderAction) carry the declaration's own specvariantand are covered.Verification
All readings at head
84482207unless named. The core suite and type-check ran at88581363; the later commit touches onlyui/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 oncheck-action-forward-parity.test.ts > the real repository > is green(the fourvariantdrops); the run before the closure build also failedunit-registry-absence-collision.test.tson 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/objectstackat84482207derived 34 commands from 4 changed paths; each ran with its exit code captured before any pipe (the PR-body gates read this body throughGITHUB_EVENT_PATH;check:type-check-debtunder the lock). Reconciliation:--rananswered "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.mjson this body: exit 0.Dogfood battery: not owed (no
!in the title, no(narrowing)arm).Generated by Claude Code