Skip to content

fix(console): a settings action whose handler declares confirmText asks before invoking - #30470

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-30419-settings-action-confirm
Nov 5, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-30419-settings-action-confirm

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Sales · project thread

domain:ui#6 · os-sales · session_01L6bhgUR8Nu4M7tbtgES7q2

Fixes #30419

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:设置页的操作按钮(action_button)若在 manifest 里声明了 confirmText,点击后先弹出确认框显示该文字;取消则什么都不执行,确认才执行一次。未声明的按钮行为不变。
  • 为什么改:spec 早已声明「执行前确认」(SpecifierHandlerSchema 的 http / action 两臂),但控制台从不读取,作者标记为需确认的危险操作一点就跑(声明 ≠ 兑现)。
  • 风险与回滚:仅改控制台一个渲染分支,复用现有 AlertDialog 原语与已有 actionConfirm.* 文案键,不加新组件、不加新 locale 键;回滚即 revert 本 PR。
  • 先看:ui/apps/console/src/pages/settings/SettingsField.tsx 的 action_button 分支(declaredConfirm 一段);其次新测试 SettingsField.actionConfirm.test.tsx。
  • 两分钟验证:pnpm --dir ui exec vitest run apps/console/src/pages/settings/__tests__/SettingsField.actionConfirm.test.tsx,预期 11 passed。
  • 需要你做的:无,席位落地。

What changes

  • SettingsField's action_button row reads the handler's declared confirmText (the spec's SpecifierHandlerSchema http / action arms: "Confirm dialog text before invoking (omit = no confirm)").
  • Declared (judged confirmText != null, the same test the spec's action resolver applies when it decides an action opens a dialog): the button becomes the trigger of the console's existing AlertDialog primitive from @object-ui/components (the one the Approvals Inbox confirms with). The dialog body is the text resolved the way this file resolves the row's other manifest copy: labels.actionConfirm(actionId, resolveLabel(confirmText)), i.e. the already-existing, until now unread settings.NAMESPACE.actions.ID.confirmText slot with the manifest literal as fallback. Title / Cancel / Continue reuse the shared actionConfirm.* keys ActionConfirmDialog uses, so no locale key is added. Cancel invokes nothing; Continue invokes onAction once.
  • Not declared, and a navigate handler (which has no such key): the button is rendered exactly as before, onClick={onAction}, no dialog.
  • Outside the source-badge / reset-to-default region; no packages/** change; no change to the types.ts mirror.

Tests

New ui/apps/console/src/pages/settings/__tests__/SettingsField.actionConfirm.test.tsx (11 tests):

  • for an http and an action handler with confirmText: click opens an alertdialog carrying the text and invokes nothing; Cancel closes it and invokes nothing; Continue invokes exactly once;
  • the actions.ID.confirmText translation is what the dialog shows, and the helper is asked with the manifest literal as fallback;
  • no confirmText (http, action), a navigate handler, and no handler: click invokes once, no dialog.

Acceptance notes

  • The settings mirror (types.ts) types confirmText as a plain string while the spec declares an I18nLabel (string or inline locale map). The same mirror gap already holds for every specifier label here (resolveLabel reads a string or a defaultValue/key object, not an inline locale map). This PR keeps that resolution unchanged; because the dialog opens on the declaration, not on the resolved text, an inline-map confirmText still asks (with the generic title) rather than running unasked. Not filed: observation, no reach measured.

Verification

All readings on objectstack-ai/objectstack, branch head 470a4eb5 (tests run at 21978cf3; the only later commit adds the changeset).

Positive control: the declared-confirm tests fail on main's SettingsField

git restore --source=677ac3bb -- ui/apps/console/src/pages/settings/SettingsField.tsx (trap-restored from HEAD, hash re-compared after), then pnpm --dir ui exec vitest run --reporter=verbose apps/console/src/pages/settings/__tests__/SettingsField.actionConfirm.test.tsx:

 Tests  7 failed | 4 passed (11)
 os-verify-lock: VERDICT command-exit 1

The 7 failures are exactly the declared-confirm cases (http x3, action x3, translation); the 4 undeclared cases pass on main, as they must.

With the fix
pnpm --dir ui exec vitest run --reporter=verbose apps/console/src/pages/settings/__tests__/SettingsField.actionConfirm.test.tsx
 Test Files  1 passed (1)
      Tests  11 passed (11)
os-verify-lock: VERDICT command-exit 0

pnpm --dir ui exec vitest run apps/console/src/pages/settings/__tests__/
 Test Files  32 passed (32)
      Tests  262 passed (262)
os-verify-lock: VERDICT command-exit 0

(The settings directory run includes settingsPage.noBareLiterals-12821.test.ts, which reads SettingsField.tsx for bare rendered literals.)

Lint

cd ui && pnpm exec eslint apps/console/src/pages/settings/SettingsField.tsx apps/console/src/pages/settings/__tests__/SettingsField.actionConfirm.test.tsx → exit 0, 0 errors, 2 warnings (both pre-existing no-explicit-any lines outside this diff). pnpm --dir ui run check:new-line-citations → VERDICT new-cross-file-line-citations: 0 new citation(s).

Derived gates (`node scripts/pm/dispatch-gates.mjs --commands`, 34 commands)
  • node scripts/check-adr-0087-registration.mjs --base origin/main → exit 0
  • node scripts/check-adr-0087-registration.mjs --self-test → exit 0
  • node scripts/check-changeset-no-major.mjs --base origin/main → exit 0
  • node scripts/check-closing-keyword-parity.mjs → exit 0
  • node scripts/check-closing-keyword-parity.mjs --self-test → exit 0
  • node scripts/check-comment-mask-corpus.mjs → exit 0
  • node scripts/check-empty-changeset.mjs --base origin/main → exit 0
  • node scripts/check-empty-changeset.mjs --self-test → exit 0
  • node scripts/check-sdui-manifest.mjs → exit 0
  • node scripts/check-sdui-manifest.mjs --self-test → exit 0
  • node scripts/pm/release-rehearsal-clone.mjs --self-test → exit 0
  • node scripts/release-pending-publish.mjs --self-test → exit 0
  • pnpm --filter @objectstack/spec run check:duration-unit-keys → exit 0
  • pnpm check:changeset-gate-self-tests → exit 0
  • pnpm check:closed-ceremony-text → exit 0
  • pnpm check:cross-package-test-inputs → exit 0
  • pnpm check:dispatcher-error-vocabulary → exit 0
  • pnpm check:driver-memory-census → exit 0
  • pnpm check:engine-double-contract → exit 0
  • pnpm check:gitlink-declared → exit 0
  • pnpm check:nul-bytes → exit 0
  • pnpm check:published-files → exit 0
  • pnpm check:query-options-erasure → exit 0
  • pnpm check:refd-timer-probe → exit 0
  • pnpm check:registry-log-declared → exit 0
  • pnpm check:rest-log-spy-declared → exit 0
  • pnpm check:test-source-alias → exit 0
  • pnpm check:tier-file-adoption → exit 0
  • pnpm check:type-check-coverage → exit 0
  • pnpm check:type-check-debt → exit 3
  • pnpm check:undeclared-dep-imports → exit 0
  • pnpm check:watch-hint-literal → exit 0
  • pnpm check:where-matcher → exit 0
  • pnpm check:changeset-fixed → exit 0

pnpm check:type-check-debt exit 3 is the gate's PREREQUISITE NOT MET (it refused to measure), read as NOT MEASURED, not a finding; this diff touches no package ledger. pnpm --dir ui exec vitest run scripts/ not run locally (scripts tree untouched); CI runs it.

NOT MEASURED
  • Console type-check (pnpm --filter @object-ui/console run type-check): NOT MEASURED, reason: it needs the @object-ui/* dist closure built; the shared verify lock queue-timed out twice (exit 99, 9 min each) behind another run, and an unlocked attempt without that build answers only TS2307 missing-module noise. CI's Type Check UI measures it.

🤖 Generated with Claude Code

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 5, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#6 · os-sales · session_01L6bhgUR8Nu4M7tbtgES7q2

维护者速读

  • 改了什么:设置页的操作按钮如果在 manifest 里声明了 confirmText,点击后先弹确认框显示这段文字;取消什么都不执行,确认才执行一次。没声明的按钮行为不变。
  • 为什么改:spec 早就声明了「执行前确认」,控制台却从不读取,作者标成需要确认的操作一点就跑(Setup settings page: an action button whose handler declares confirmText runs without asking #30419,声明了却没兑现)。
  • 风险与回滚:只改控制台的一个渲染分支,复用现有的 AlertDialog 和已有的 actionConfirm.* 文案键,没有新组件,也没有新语言键。回滚即撤本 PR。
  • 先看:ui/apps/console/src/pages/settings/SettingsField.tsx 的 action_button 分支(declaredConfirm 一段)和新测试 SettingsField.actionConfirm.test.tsx。
  • 两分钟验证:pnpm --dir ui exec vitest run apps/console/src/pages/settings/__tests__/SettingsField.actionConfirm.test.tsx,预期 11 passed。
  • 需要你做的:无,席位落地。
  • 席位意见:可合。

席位核对 — ACCEPT · head 470a4eb

  • 形态:3 文件 +177/−7(SettingsField.tsx 的 action_button 分支、1 份新测试、changeset @object-ui/console patch)。check-governed-merges --pr 30470:NOT governed,184 行 ≤ 3000。Fixes #30419,draft,目标 main。席位逐行读过源码 diff:没声明时按钮仍是 onClick={onAction};声明了就由 AlertDialogTrigger 包住,只有 AlertDialogAction 调用 onAction;navigate 型 handler 不受影响。没碰 PR fix(console): a deployment-level settings value set here reads Modified and offers Reset to default #30428 修改的 source-badge / reset 区域。
  • 契约:Clause-② no,Metadata-protocol none,与认领 6657188814 一致:没有新导出,没有新语言键(复用既有的 actions.<id>.confirmText 槽与 actionConfirm.*)。
  • 前提实测:dev 报告 6658312089。正对照:src 还原到 677ac3bb 时 7 红 4 绿(红的全是声明了确认的用例),修后 11 绿;settings 目录 32 文件 262 绿;派生门禁 34 条中 33 条 exit 0,check:type-check-debt 因本地前置缺失记 NOT MEASURED,由 CI Type Check · debt ledger 覆盖,已绿。
  • 门禁 check-runs:head 上最新一轮 55 个,44 success,11 skipped(ui-only diff 的预期跳过),0 红。Live E2E UI 首次跑红:studio-customize-journey.spec.ts 在 GET /api/v1/meta/view/showcase_task.in_progress 报 ECONNRESET,与本 diff 不相交,同一 check 在 main 最近 6 个提交上都是绿的。经中继 rerun-failed 重跑一次(attempt 2,job 127256629912)后 success。mergeable_state clean。
  • 接受的偏差:本地未测 console type-check(verify 锁排队超时),由 CI Type Check UI 覆盖,已绿。changeset 文件名不含卡号。PR 正文速读用的是半角标点,本记录已改用全角。
  • 范围外去向:settings 镜像类型 types.ts 把 label 写成 string 或 {defaultValue,key},而 spec 声明的是 I18nLabel(可以是内联语言 map),resolveLabel 不读内联 map。dropped:没有实测到可达路径,记在 PR 正文 Acceptance notes。本修复按「是否声明」判断要不要弹框,所以内联 map 的 confirmText 也会先确认再执行,不会直接跑。
  • 落地条款:中继 pr_ready + automerge_enable。合并后由 Fixes 关卡,席位同一笔摘掉 pm:dispatched 并留落地评论。

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 5, 2026 12:59
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit a1d0b1e Nov 5, 2026
88 of 89 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-30419-settings-action-confirm branch November 5, 2026 13:10
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 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.

Setup settings page: an action button whose handler declares confirmText runs without asking

1 participant