Repository navigation
Description
Goal
In the confirmation dialog each sub-command that still needs a rule can be expanded to pick a suggested allow rule and its scope. Picking stages the rule and changes the row's status; several rows can be staged; "Save rules (N)" saves them. The whole-command button "Accept + Rule ▾" is gone.
Context
- Dialog:
ConfirmActionForminapps/smart-ssh-community/frontend/src/components/chat/ActionCard.tsx:291, segment listcomponents/chat/CoverageList.tsx:23-80(status with Global scope; renders nothing for a single segment unless blocked), whole-command rule buttoncomponents/chat/QuickRuleButton.tsx(split button, scope radios:146-178, click on a suggestion saves and executes at once,:110-121), accept pathcomponents/chat/useActionDecisions.ts:60-87(acceptWithRule). - Expand pattern used elsewhere:
components/NotesPanel.tsx:228-235(▸/▾ per row,aria-expanded),components/fileBrowser/ElevationNotice.tsx:57-65(aria-controls). - Backend commands for per-segment suggestions and batch save come from the blocking issue.
- Spec
docs/specs/0011-rule-quick-accept.md§4 (UI), §6 (coverage). Localessrc/locales/<lang>/common.json, blockconfirmDialog(25 languages).
Requirements
Decided by maintainer:
- Already allowed sub-commands are summarised compactly on top with green check marks; below are only the sub-commands still to decide. A rule picked or saved in this dialog keeps its row in place (check mark behind it, toggle stays) and moves into the summary only the next time.
- The whole-command split button "Accept + Rule ▾" is removed, also for single commands. Per-sub-command selection replaces it.
- Scope is chosen per sub-command (This Server default, Global, Tag with text field).
- A separate button "Save rules (N)" saves the staged rules; it does not execute or deny the command.
Behaviour:
- The segment list is always shown, also for a single command. It has two parts:
- on top, a compact summary of the sub-commands that are already allowed when the dialog opens: one short line each with a green check mark (and the covering rule on hover/tooltip), so the user sees at a glance what is already allowed;
- below, the sub-commands that still need a decision ("needs a rule", "always asks"), each as its own row.
- A row in state "needs a rule" gets a ▸/▾ toggle (pattern of
NotesPanel). Expanded: scope choice and the suggestions for that segment with their verdicts, from the per-segment backend command. - Clicking a suggestion stages it: the row collapses and shows a check mark plus the staged rule (" · "), visually distinct from a saved rule. The row stays where it is (it does not move into the summary on top), and its toggle stays, so a mis-click can be changed or removed again. The verdicts of the other rows' suggestions consider the staged rules.
- Rows "always asks" have no toggle; already allowed sub-commands in the summary have none either.
- "Save rules (N)" is enabled when N ≥ 1. On success the staged marks turn into a green "covered by rule …" check mark, the rows stay in place in the lower part during this dialog, and their toggle stays (the user can still pick a different rule; that stages a new one). The next time a command contains such a sub-command, it appears in the summary on top. On failure an error is shown and nothing is lost from the staging.
- Execute and Deny stay as they are. With unsaved staged rules a hint "N rules not saved" stands next to them; Execute does not save them; Deny and Execute discard the staging.
- The dialog works on narrow screens (inline expansion, no popup).
acceptWithRule,QuickRuleButtonand the Tauri commandaccept_and_create_ruleare removed when nothing uses them any more.
Acceptance Criteria
- For
echo a && ls -la /tmp && git statuswithout matching rules, the dialog shows three rows, each with a toggle; expanding one shows its suggestions and a scope choice with This Server preselected. - With an existing rule covering
echo *, the same command showsecho ain the summary of allowed sub-commands with a green check mark and onlyls -la /tmpandgit statusas rows with a toggle. - Staging
echo *(This Server) andls *(Global) shows both rows as staged and the button "Save rules (2)"; the command is not executed. - After "Save rules", two rules exist with the chosen scopes, the two rows stay in place with a green "covered" check mark and their toggle, and the dialog is still open; Execute then runs the command. The next confirmation of a command with
echo …lists it in the summary on top. - A staged rule can be changed and removed again; N updates.
- A save error (mocked) shows a message and keeps the staging.
- Deny with staged rules saves nothing.
- A single command
ls -lashows one row with the toggle; "Accept + Rule" is not shown anywhere. - Toggles are keyboard-operable with
aria-expanded. - New strings exist in all 25 locales.
- Unit tests (
QuickRuleButton.test.tsxreplaced,ChatPanelExplanation.test.tsx,chat/useActionDecisions.test.tsx) and e2ee2e/tests/command-confirmation.spec.tsande2e/tests/narrow-chat.spec.ts(fake backende2e/harness/fakeBackend.ts) cover the flow; relevant automated tests pass.
Technical Notes
Rule creation is security-relevant: the UI shows "runs automatically" only from the backend verdict, never computed in the frontend.
Files: apps/smart-ssh-community/frontend/src/components/chat/, apps/smart-ssh-community/frontend/src/components/QuickRuleButton.test.tsx, apps/smart-ssh-community/frontend/src/components/ChatPanelExplanation.test.tsx, apps/smart-ssh-community/frontend/src/api/api.ts, apps/smart-ssh-community/frontend/src/test/apiMock.ts, apps/smart-ssh-community/frontend/src/locales/, apps/smart-ssh-community/frontend/e2e/, crates/app-shell/src/commands/rules.rs, crates/app-shell/src/lib.rs, apps/smart-ssh-community/frontend/src/generated/ipc.ts, docs/specs/0011-rule-quick-accept.md
Spec impact: update 0011
Related Work
- Confirmation dialog: per-segment rule coverage, rules for uncovered segments, verdict whether a rule will auto-accept #596, Confirmation card: show the always-asks reason for a rule-covered command, and do not hide a failed coverage lookup #689, Command card: show which allow rule let a command run without confirmation #696
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
feat(app-shell): per-sub-command rule staging in the confirmation dia…
smart-ssh-coder commentedon Nov 20, 2026
Implementation ready for review. PR #1392. Confirmation dialog now lists sub-commands (summary of allowed ones, rows with inline ▸/▾ rule suggestions per sub-command, staged rules, "Save rules (N)" via the batch command); "Accept + Rule", acceptWithRule and accept_and_create_rule removed; explain_confirmation returns the segment list for single commands too; Spec 0011, changelog and 25 locales updated. Vitest, lint, Playwright and CI (PR #1392) are green.
smart-ssh-reviewer commentedon Nov 20, 2026
Review: 1. Other specs still describe the removed whole-command quick rule. Spec 0113 (line 41) describes the "Akzeptieren + Regel" bottom sheet. Spec 0077 3.1.2 says the quick rule resolves the confirmation even when rule creation fails. Spec 0027 2.1 lists "Akzeptieren mit Regel" as an execution path. Spec 0054 Part 1 mentions the quick-rule dropdown in the chat. Update these statements to match the new staging/save behaviour (Spec 0011 alone is not enough). 2. RuleStaging.tsx:94 shows the raw backend message when "Save rules" fails (commandErrorMessage). Spec 0077 3.1.4 requires the quick-rule error to be shown translated, without the library text. Translate via commandErrorCode + translateErrorCode, fall back to the message only when there is no code, and extend the save-error test with a coded rejection.
fix(frontend): translate rule save errors, update specs for removed q…
smart-ssh-coder commentedon Nov 20, 2026
Implementation ready for review. PR #1392. Previous Browser Tests failure was a 30-minute step timeout (611 tests passed, none failed), not a test failure. Merged develop, pushed, and wait-ci is green on the new head.
smart-ssh-reviewer commentedon Nov 20, 2026
Review passed – moving on to merge. Both earlier findings are fixed in af60aad. Specs 0027, 0054, 0077 and 0113 no longer describe the removed whole-command quick rule. Rule-save errors are now shown translated, and a counter-proofed test covers this (it fails without the fix). The affected Vitest and Playwright specs pass locally, and CI is green. Follow-ups: remove the dead ruleNotice chat item, and remove the obsolete test_accept_and_create_rule_* tests in app-logic notes/tests.rs.
feat(app-shell): per-sub-command rule staging in the confirmation dia…
smart-ssh-coordinator commentedon Nov 20, 2026
Merged and branch deleted: PR #1392 (squash) in develop
smart-ssh-planner commentedon Nov 20, 2026
Follow-ups filed: #1393 Remove the dead ruleNotice chat item and the stale accept_and_create_rule tests; #1394 Make the confirmation-dialog e2e tests wait for the rule rows and use auto-waiting assertions. Not filed: indentation-only style nits.