Skip to content

test(workstation): guard the history-rewrite confirmation invariant (WS-18) - #2121

Merged
gfargo merged 1 commit into
mainfrom
test/ws18-history-rewrite-confirmation-invariant
Aug 14, 2026
Merged

test(workstation): guard the history-rewrite confirmation invariant (WS-18)#2121
gfargo merged 1 commit into
mainfrom
test/ws18-history-rewrite-confirmation-invariant

Conversation

@gfargo

@gfargo gfargo commented Aug 14, 2026

Copy link
Copy Markdown
Owner

Summary

Investigated #1872: is reword-head (the sole entry in HISTORY_REWRITE_WORKFLOW_IDS without requiresConfirmation: true) a bug, as the audit's asymmetry-detection flagged?

Finding: this is deliberate, documented design, not an oversight. reword-head's handler (useWorkflowAction.ts) opens an input prompt pre-seeded with the current commit subject, and submitting that prompt is what triggers the rewrite — the existing code comment in inkWorkflows.ts says exactly this ("the prompt itself is the confirmation step"), dating to #1350. Every other history-rewriting workflow (including its closest sibling, amend-head) goes straight from a keystroke/selection to execution with no interstitial step, which is why those need the explicit y-confirm as their only safety gate.

The issue's own confidence note agrees: "the asymmetry is verified; whether it is wrong is a product call." Whether a pre-filled prompt-and-submit is sufficient consent for a HEAD-rewriting action (vs. requiring the same explicit confirm its siblings get, i.e. prompt and confirm like amend-head does with staged changes) is a UX decision for @gfargo, not something to resolve unilaterally by flipping a flag.

What this PR does

Adds the registry-invariant test the issue itself suggested: every id in HISTORY_REWRITE_WORKFLOW_IDS must have requiresConfirmation: true unless it's in an explicit, documented PROMPT_GATED_EXCEPTIONS allowlist (currently just reword-head). This doesn't change any runtime behavior — it pins down the current rule so a future history-rewriting workflow added with neither an explicit confirm nor a documented prompt gate fails a test instead of silently shipping unprotected.

Leaving #1872 open — the actual policy question (should reword-head also require an explicit confirm, or is prompt-implies-consent the right long-term rule for message-editing flows generally) needs your call, not mine. Left a comment on the issue with these findings.

Test plan

  • New test in inkWorkflows.test.ts: every HISTORY_REWRITE_WORKFLOW_IDS entry requires confirmation unless explicitly allowlisted as prompt-gated; the allowlist itself is validated against the real registry
  • npx jest src/workstation/runtime/inkWorkflows.test.ts — 24/24 passed
  • npx jest src/workstation — 160 suites / 3149 tests passed
  • npx eslint and npx tsc --noEmit -p . — clean
  • npx jest (full suite) — pre-existing, unrelated tree-sitter WASM failures only (same 4 failures present on a clean origin/main checkout in this worktree)

…WS-18)

reword-head is the sole entry in HISTORY_REWRITE_WORKFLOW_IDS without
requiresConfirmation — verified against the registry, but this is a
documented, intentional design choice from #1350, not an oversight:
its handler opens an input prompt pre-seeded with the current subject,
and submitting that prompt is treated as the confirmation step. Every
other history-rewriting workflow goes straight from keystroke to
execution with no interstitial step, so it needs requiresConfirmation
as its only gate.

Whether a pre-filled prompt is sufficient consent for a HEAD-rewriting
action, or should additionally require the same explicit y-confirm its
siblings get, is a genuine product call - not something to resolve
unilaterally. This adds the registry-invariant test the issue itself
suggested: it pins down the current, deliberate rule (explicit allowlist
for prompt-gated exceptions) so a future history-rewriting workflow
added with neither an explicit confirm nor a documented prompt gate
fails loudly instead of shipping unprotected.
@gfargo
gfargo merged commit 058b510 into main Aug 14, 2026
12 checks passed
@gfargo
gfargo deleted the test/ws18-history-rewrite-confirmation-invariant branch August 14, 2026 14:46
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