Skip to content

Classify Safe Updates writes as destructive - #13

Merged
dennisdornon merged 3 commits into
mainfrom
mwp-2369-safe-updates-destructive
Nov 25, 2026
Merged

dennisdornon merged 3 commits into
mainfrom
mwp-2369-safe-updates-destructive

Conversation

@dennisdornon

@dennisdornon dennisdornon commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

The Safe Updates abilities that start, continue or cancel a run, retest a site, or mark a failed check as expected now match the destructive name patterns. Each one needs --dry-run and then --confirm, whatever the Dashboard's annotations say. rollback-safe-update-v1 already matched rollback-*. The run and list reads keep their classification.

docs/safety.md describes the Safe Updates behavior, and tests cover each ability name.

With #14 merged, the CLI no longer sends user_confirmed, so confirming retest and resolve passes the Safe Updates schemas, which don't allow extra properties. Typecheck, lint, npm test (1132), npm run test:process (115) and build pass locally on the merged branch.

Summary by CodeRabbit

  • Changed
    • Safe Updates actions that modify a run now require a dry run followed by confirmation, regardless of Dashboard annotations.
    • Read-only run-listing actions remain available without these flags.
    • After confirmation, continue tracking the run on the Dashboard; --wait and jobs watch are not used for this flow.
  • Documentation
    • Added guidance on previewing and confirming Safe Updates actions.

The Safe Updates abilities that start, continue or cancel a run, retest
a site or mark a failed check as expected now match the destructive
name patterns, so each needs --dry-run and then --confirm whatever the
Dashboard's annotations say. rollback-safe-update-v1 already matched
rollback-*. The Dashboard requires a preview or confirm for retest and
resolve as well, and the CLI only sends confirm on the destructive
path, so leaving those two out would make them impossible to run.

The run and list reads keep their classification, and docs/safety.md
describes the Safe Updates behavior.
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Safe Updates write abilities are classified as destructive regardless of Dashboard annotations. Tests cover write and read abilities, and the changelog and safety guide document the preview and confirmation flow.

Changes: Safe Updates safety

Layer / File(s) Summary
Destructive classification and confirmation guidance
src/core/safety-controller.ts, src/core/safety-controller.test.ts, docs/safety.md, CHANGELOG.md
Name patterns classify five Safe Updates write operations as destructive. Tests cover eleven write abilities, read-only run listing and retrieval, and unrelated names. The safety guide and changelog document the required preview and confirmation flow.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: Minimal · up to 3a799

Five Safe Updates write abilities (run, continue, cancel, retest and resolve) now always require --dry-run followed by --confirm. The reads are unchanged. Tests and docs cover the behavior. One thing was not checked: whether retest and resolve work with the Dashboard's own schemas, which are not in this repository. No concrete merge-blocking issue was found.

Security architecture risk: Minimal · up to 3a799

Five Safe Updates writes now require a successful preview and explicit confirmation, even if the Dashboard labels them read-only. Run-listing and run-detail reads are unaffected. The reviewed change strengthens the CLI safeguard without granting new access. Compatibility with deployed Dashboard versions was not verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The change affects matching write calls made through the CLI and the Safe Updates runs and sites reachable with its existing Dashboard credentials. The name-only change does not give those credentials new permissions or extend the preview requirement to direct API callers.

Trust Boundaries and Controls

  • observed — Dashboard metadata can no longer downgrade these matching names to read-only. This is a client-side control: preview and execution remain separate requests, and the CLI does not guarantee that Dashboard state stays unchanged between them.

Resilience and Maintainability Implications

  • observed — A failed preview or declined approval stops before confirm dispatch. The command attempts to record approval in the local audit log before dispatch. If dispatch throws, the command reports an unknown outcome and directs the operator to check Dashboard state before retrying rather than resending from the command handler.

Hardening Proposals

  • proposed — Add a compatibility check against supported Dashboard versions for preview and confirm on all five writes, including cancellation during recovery. Check the HTTP method and schema-valid payload, and verify that preview leaves run and site state unchanged.
Pre-merge checks: Passed 6

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Classify Safe Updates writes as destructive" matches the main change: five Safe Updates write abilities (run, continue, cancel, retest, resolve) are added to DESTRUCTIVE_NAME_PATTERNS so th…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Public Contract Compatibility Passed The PR changes one public CLI-facing behavior. DESTRUCTIVE_NAME_PATTERNS in src/core/safety-controller.ts (lines 86-92) now forces the destructive class on five Safe Updates abilities: `run-safe-u…
Validation Evidence Passed The PR changes executable code. The changed-file inventory includes src/core/safety-controller.ts and src/core/safety-controller.test.ts, plus docs and CHANGELOG. The check therefore applies. The …
Full details: Title check

Explanation

The title "Classify Safe Updates writes as destructive" matches the main change: five Safe Updates write abilities (run, continue, cancel, retest, resolve) are added to DESTRUCTIVE_NAME_PATTERNS so they require --dry-run and --confirm regardless of annotations. The title is specific, concise, and free of file lists or vague terms.

Full details: Public Contract Compatibility

Explanation

The PR changes one public CLI-facing behavior. DESTRUCTIVE_NAME_PATTERNS in src/core/safety-controller.ts (lines 86-92) now forces the destructive class on five Safe Updates abilities: run-safe-update-v1, continue-safe-update-run-v1, cancel-safe-update-run-v1, retest-safe-update-site-v1, and resolve-safe-update-site-v1. Callers of these abilities must now run --dry-run and then --confirm. Scripts that called them without flags will fail. This is an observable incompatible change. The PR documents the change and the consumer update: - CHANGELOG.md (Unreleased, Changed) lists the five abilities and the new --dry-run then --confirm requirement. It also states that reads are unchanged. - docs/safety.md adds a Safe Updates section with the flow, a command example, and the note that a confirmed run returns a run_id. The Dashboard-to-Child payload concern is also addressed. The base branch already has the user_confirmed removal (src/core/abilities-executor.ts line 437 and related tests), so the #14 dependency in the PR description is satisfied on this branch. The Dashboard-side Safe Updates schemas are external and were not checked. The PR's claim that they accept confirmed retest and resolve calls is therefore not independently verified. Minor gap: the changelog entry for this change is not prefixed with Breaking:, although it changes required flags for existing callers. The check passes because the change is explained and the consumer update is documented, not because it is non-breaking.

Resolution

Optional: prefix the CHANGELOG entry with Breaking: so CLI scripts that call these five abilities without flags are flagged clearly. Verify the Dashboard Safe Updates schemas accept the confirm payload for retest and resolve.

Full details: Validation Evidence

Explanation

The PR changes executable code. The changed-file inventory includes src/core/safety-controller.ts and src/core/safety-controller.test.ts, plus docs and CHANGELOG. The check therefore applies. The PR description records validation commands and outcomes: typecheck, lint, npm test (1132 tests), npm run test:process (115 tests), and build, all reported as passing locally on the merged branch. The check does not require execution of tests, so these author-reported outcomes satisfy it. No explicit verification limitation is needed because validation evidence is present.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI; Enforced overrides: Organization
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1f1bd033-0c31-4693-a882-4a0c677388dc
Commits

Reviewing files that changed from the base of the PR and between 590c973 and 3a79955.

Files selected for processing: 4

  • CHANGELOG.md
  • docs/safety.md
  • src/core/safety-controller.test.ts
  • src/core/safety-controller.ts

Included review availability: This review used your included allowance. 4 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 10 reviews per hour.

Recent review details

Context from checks skipped due to timeout: 3

  • GitHub Check: CodeRabbit
  • GitHub Check: CodeRabbit Security
  • GitHub Check: test (20.18.1, windows-latest)
Additional context used

Path-based instructions: 1

Check request and response contracts, unsafe HTML insertion, exposed credentials, stale asynchronous responses, and error handling.

CodeRabbit configuration file

Files:

  • src/core/safety-controller.test.ts
  • src/core/safety-controller.ts
LanguageTool

docs/safety.md

[style] ~17-~17: ‘On top of that’ might be wordy. Consider a shorter alternative.
Context: ...-destructive is treated as destructive. On top of that, a conservative name-based override for...

(EN_WORDINESS_PREMIUM_ON_TOP_OF_THAT)

Additional comments: 3

src/core/safety-controller.test.ts: 1

15-15: LGTM!

Also applies to: 447-472, 474-488, 490-497

CHANGELOG.md: 1

14-14: LGTM!

src/core/safety-controller.ts: 1

91-92: Data Integrity & Integration

The gate decision for retest-safe-update-site-v1 and resolve-safe-update-site-v1 depends on Dashboard-served schemas. The repository has no copy of those schemas, so this review cannot determine whether abilitySupportsPreview accepts them.

@dennisdornon
dennisdornon marked this pull request as ready for review November 20, 2026 13:32
@dennisdornon
dennisdornon marked this pull request as draft November 20, 2026 13:33
@dennisdornon
dennisdornon marked this pull request as ready for review November 25, 2026 19:00
@dennisdornon

Copy link
Copy Markdown
Member Author

@coderabbitai review

@dennisdornon
dennisdornon merged commit 64598de into main Nov 25, 2026
11 checks passed
@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Action not completed

Pull request is closed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@dennisdornon dennisdornon mentioned this pull request Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant