Skip to content

fix(hooks): merge-guard mint-vs-read auth-token symmetry (#1031 + #1032)#1040

Merged
michael-wojcik merged 17 commits into
Synaptic-Labs-AI:mainfrom
michael-wojcik:fix/merge-guard-auth-symmetry
Jun 26, 2026
Merged

fix(hooks): merge-guard mint-vs-read auth-token symmetry (#1031 + #1032)#1040
michael-wojcik merged 17 commits into
Synaptic-Labs-AI:mainfrom
michael-wojcik:fix/merge-guard-auth-symmetry

Conversation

@michael-wojcik

Copy link
Copy Markdown
Collaborator

Summary

Fixes the merge-guard mint-vs-read auth-token asymmetry — the single root cause behind #1031 (false-REJECT / usability) and #1032 (false-AUTHORIZE / security) — as one PR. The mint side (merge_guard_post) parsed AskUserQuestion prose while the read side (merge_guard_pre) validated the actual command; they drifted. The fix routes BOTH arms through one shared command-anchored extractor (so they can't drift again), makes the read side fail-closed, and fixes the selection-signal so a selected option carrying the command counts as approval.

What landed (10 commits)

Why

Empirically at HEAD: all 4 #1032 bypasses + A-DEFER were live and #1031 R1-R7 false-rejected. The asymmetry required fixing both arms together; the shared extractor makes future drift structurally impossible (the #720 dual-hook class). Confine-the-fix (#797) honored — zero token-lifecycle changes.

Testing

Full suite GREEN: 9684 passed / 11 skipped / 0 failed / 0 errors (rtk proxy + explicit 0-errors scan, pyenv 3.12.7). Non-vacuity: C2-revert → 4 RED, C3-revert → 17 RED, CLASS-II add-mutations → 3, seam → 3 — all RESTORE_CLEAN. Coverage ≥ 90% on changed mint/read paths.

Closure

Completes the acceptance criteria of #1031 and #1032; closure pending the post-install logged live-probe PASS (do not auto-close — runtime-hook gate per the established discipline).

Follow-ups (NOT in this PR)

Caveat

R7/#1034 is PROVISIONAL — asserted from the documented option-command structure (no verbatim captured payload exists); the load-bearing property (command-only-in-option + descriptive label mints) is exercised.

…block (per-positional count, mirrors force-push)
…tic-Labs-AI#1032)

The post-hook minted a token from any command in the AskUserQuestion bundle, including a command padded into question prose alongside a benign clicked option — letting a padded question mint authorization the operator never selected (Synaptic-Labs-AI#1032).

Anchor the mint to the operator's action surface: the minted (op,target) pair must be carried by a CLICKED option, never question prose alone. Prose stays a divergence signal (>1 distinct pair refuses) but is no longer a sole mint source; a bundle with no options can never mint (fail-closed); free-text answers no longer mint. Confined to _mint_context_from_bundle; zero token-lifecycle change.
…contract (Synaptic-Labs-AI#1032)

Repoint the approval-flow tests broken by the option-anchoring fix (Synaptic-Labs-AI#1032): the authorizing command moves from question-prose into the clicked option's description (the conforming convention), so every original regression — FD-redirect over-block, bare-push authorize, two-uses-then-third-denied, branch-delete, force-push, session-scoped, merge and close-pr flows — stays guarded under the new contract. Add option-anchoring counter-tests: a command padded into question prose with a benign clicked option refuses; a no-options/free-text bundle refuses. Each is mutation-proven non-vacuous.
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