fix(validator): make decision-event matrix harness-aware#114
Open
chozandrias76 wants to merge 1 commit into
Open
fix(validator): make decision-event matrix harness-aware#114chozandrias76 wants to merge 1 commit into
chozandrias76 wants to merge 1 commit into
Conversation
The decision-event compatibility matrix only contained Claude Code
events, so `cupcake validate` flagged every decision verb used on a
Cursor-native event (beforeShellExecution, afterFileEdit, beforeReadFile,
...) as incompatible with an empty "Supported:" list. This produced false
errors for the Cursor builtins generated by `cupcake init` — and swapping
the verb (halt -> deny) did not help, because no verb is registered for
those events.
Changes:
- Add Cursor's actionable native events to the matrix, with verb sets
derived from the Cursor response handlers:
- beforeShellExecution / beforeMCPExecution: Halt, Deny, Block, Ask
- beforeReadFile: Halt, Deny, Block (ask is coerced to deny)
- beforeSubmitPrompt: Halt, Deny, Block (ask coerced; context dropped)
- stop: Halt, Block
Cursor's fire-and-forget after* events (always return {}) are
intentionally omitted.
- Add DecisionEventMatrix::knows_event() to distinguish an unknown event
from a known event with an empty verb set (e.g. SessionEnd).
- Skip events the matrix has no spec for in the compatibility rule, so the
Claude-centric matrix no longer flags other harnesses' events while
still validating known-but-empty events.
- Add regression tests for Cursor before-events, fire-and-forget after*
events, and the unknown-vs-empty distinction.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Author
|
For posterity, I reported this bug to my LLM (Claude) initially, I tasked it with investigation, and I gave it some criteria to validate for assumptions and to ensure the bug was real (according to my configurations). The text report (issue), PR body, and changes were LLM generated and validated by me (Colin) |
Author
Oh and I also did a build test and smoke test with claude. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #113.
cupcake validateflagged every decision verb on a Cursor-native event (beforeShellExecution,afterFileEdit,beforeReadFile, …) as incompatible with an emptySupported:list, because the decision-event compatibility matrix only contained Claude Code events. Swapping the verb did not help — the matrix had no entry for the event at all, so the generated Cursor builtins failed validation out of the box.Changes
decision_event_matrix.rs: add Cursor's actionable native events, with verb sets derived from the Cursor response handlers (harness::response::cursor):beforeShellExecution/beforeMCPExecution:Halt,Deny,Block,Ask(full allow/deny/ask permission gate)beforeReadFile:Halt,Deny,Block(ask is coerced to deny)beforeSubmitPrompt:Halt,Deny,Block(ask coerced; context injection unsupported)stop:Halt,Blockafter*events (always return{}) are intentionally omitted.DecisionEventMatrix::knows_event()to distinguish an unknown event from a known event with an empty verb set (e.g.SessionEnd).validator/rules.rs: skip events the matrix has no spec for, so the Claude-centric matrix no longer flags other harnesses' (or fire-and-forget) events, while known-but-empty events stay strict.Tests
Added regression tests: Cursor before-events support the expected verbs;
after*events are unknown (skipped); andknows_event()distinguishes unknown from known-but-empty.cargo test -p cupcake-core --lib validator→ 27 passed.Notes
cupcake validateon a global config scaffolded bycupcake initgoes from 5 errors to 0.