Repository navigation
fix(ui): a destructive action block confirms through the destructive button - #26776
Merged
Merged
Conversation
…e as danger The four action block renderers now forward their variant in the runner's dialect, so a destructive block confirms through the destructive button. UIActionSchema.variant takes the block rows' vocabulary by reference (adds link). Drops the four JUSTIFIED entries in check-action-forward-parity. Claude-Session: https://claude.ai/code/session_01JQwxbZyGPLFfG86a9oeMDr Co-authored-by: Claude <noreply@anthropic.com>
…order Claude-Session: https://claude.ai/code/session_01JQwxbZyGPLFfG86a9oeMDr Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbZyGPLFfG86a9oeMDr Co-authored-by: Claude <noreply@anthropic.com>
…-173d81 Claude-Session: https://claude.ai/code/session_01JQwxbZyGPLFfG86a9oeMDr Co-authored-by: Claude <noreply@anthropic.com>
This was referenced Oct 27, 2026
Contributor
Author
维护者速读
席位核对ACCEPT · seat
Generated by Claude Code |
This was referenced Oct 27, 2026
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 Warren · project thread
Fixes #26665
Clause-②: no
Metadata-protocol: none
维护者速读
action:button/action:icon/action:group/action:menu)把variant转发给动作执行器,destructive在这一处转成danger;UIActionSchema.variant按引用取 spec 块行的词表(补上link)。destructive的危险动作,确认框一直是中性按钮;执行器只认动作方言里的danger,而四个块从不转发variant。confirmText且 variant 为destructive的块,确认按钮改为红色;default/outline不转发,行为不变。回滚即 revert 本 PR。ui/packages/components/src/renderers/action/runner-variant.ts(映射本身)、action-button.tsx的 forward 一行、ui/packages/types/src/ui-action.ts的variant。pnpm --dir ui exec vitest run packages/components/src/renderers/action/__tests__/action-variant-confirm-26665.test.tsx,预期 9 个测试全部通过。What changes
@objectstack/specspellsvariantin two dialects, each on its own surface (seat ruling: premise correction comment 6444873110 on #26665):ActionButtonPropsSchema,ActionIconPropsSchema,ActionGroupPropsSchema,ActionMenuPropsSchema, and the group/menu member items) take the Button primitive's vocabulary plusprimary, and refusedanger;ActionSchema, which the runner dispatches, takesprimary | secondary | danger | ghost | link. The runner readsvariantfor one purpose:dangerpaints the confirm button destructive (confirmOptionsinActionRunner.ts).The four block renderers forwarded no
variant, so a block declareddestructiveconfirmed through a neutral button. Now:runner-variant.ts(new,@object-ui/components):toRunnerVarianttranslates the block value into the action value at the one forward:destructivebecomesdanger;primary,secondary,ghostandlinkpass through;defaultandoutline, which the action dialect has no word for, forward nothing. It reads nodanger: it is not a reader-side alias.variant: toRunnerVariant(...)besideconfirmText.action:groupandaction:menuforward each member's ownvariant, not the container's.UIActionSchema.variant(@object-ui/types) is typed by reference to the spec'sActionButtonProps['variant'], the waysizebeside it already is. That addslink, which the block rows accept, and keeps refusingdanger, which they refuse.ui/scripts/check-action-forward-parity.mjs: the fourSURFACE:variantJUSTIFIED entries are removed; the gate now findsvariantforwarded on all four surfaces.Why
The goal of the card is unchanged: a destructive action declared through one of the four blocks confirms through the destructive button. The method follows the seat's premise correction: the block rows keep their own spec dialect, and the translation lives at the forward, because each value is spec-declared on its own surface.
Tests
action-variant-confirm-26665.test.tsx: per surface, adestructiveaction asks the confirm handler withdestructive: true; theoutlinecontrol asks without it; each row first asserts the handler was called once and that nothing ran after the cancel. One row pins the mapping table oftoRunnerVariant.action-forward-precedence.test.tsx:variantadded to the button and icon key-order lists, besideconfirmText(one added name, no neighbour moved).Acceptance notes
action:group's inline members draw the group'svariantwhen they declare none, but the forward carries only the member's ownvariant: the group's value is the container's style, not a declaration about each action.action:button/action:iconregistrationinputsstill publish the variant enum withoutlink. Publishing it is a registry change with a manifest regeneration and is not in this card.@object-ui/typeshas no zod mirror ofUIActionSchema.variant; the public-block zod faces take the spec rows by reference already.Verification
All local runs on head
631c2c46.Ablation (two mutations, both restored by blob hash)
runner-variant.ts,return 'danger';replaced withreturn undefined;(anchor 1 to 0, blob changed): 5 failed, the fourdestructiverows and the mapping row. Restored: blob equals the HEAD blob,git diff HEADempty.action-group.tsx, thevariant: toRunnerVariant(action.variant),forward deleted: 1 failed (theaction:groupdestructive row), 8 passed. Restored the same way.Reverse type check
A scratch file in
ui/packages/types/srctyped twoUIActionSchemaliterals:variant: 'link'compiled,variant: 'danger'failed with TS2322 (the union printed is the block rows' seven values). The file was removed; the tree is clean.Tests and type-check
pnpm --dir ui exec vitest run --maxWorkers=2 packages/components/src/renderers/action/(under the verify lock, before the main merge): Test Files 35 passed (35), Tests 581 passed (581).pnpm --filter @object-ui/types --filter @object-ui/components run type-check(under the lock): both packages Done, VERDICT command-exit 0.pnpm --dir ui run check:action-forward-parity: exit 0, 26 justified omissions, 0 known gaps;variantforwarded on all four surfaces.pnpm --dir ui run check:new-line-citations: 0 new citations, exit 0.node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 34 families on head631c2c46; all 34 ran with exit 0, and--ranreconciles 34 derived, 34 run, 0 NOT-MEASURED, 0 UNRUN (pnpm --dir ui exec vitest run scripts/included, under the lock).test:repo,pnpm lintand the type-check lanes are CI's.Human Minimum
packages/specholds no runtime logic. (Nopackages/specchange.)pnpm lintis CI's.main, one pull request.packages/specnot touched.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Implemented in the card thread session
session_01JQwxbZyGPLFfG86a9oeMDrfor seatdomain:ui#1.🤖 Generated with Claude Code
https://claude.ai/code/session_01JQwxbZyGPLFfG86a9oeMDr
Generated by Claude Code