Skip to content

fix(validator): make decision-event matrix harness-aware#114

Open
chozandrias76 wants to merge 1 commit into
eqtylab:mainfrom
Banon-Labs:fix/validator-harness-aware-events
Open

fix(validator): make decision-event matrix harness-aware#114
chozandrias76 wants to merge 1 commit into
eqtylab:mainfrom
Banon-Labs:fix/validator-harness-aware-events

Conversation

@chozandrias76

Copy link
Copy Markdown

Summary

Closes #113.

cupcake validate flagged every decision verb on a Cursor-native event (beforeShellExecution, afterFileEdit, beforeReadFile, …) as incompatible with an empty Supported: 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, 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).
  • 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); and knows_event() distinguishes unknown from known-but-empty. cargo test -p cupcake-core --lib validator → 27 passed.

Notes

  • Scoped to the validator only; no engine/runtime behavior changes.
  • Verified end-to-end: after this change, cupcake validate on a global config scaffolded by cupcake init goes from 5 errors to 0.

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>
@chozandrias76 chozandrias76 marked this pull request as ready for review June 15, 2026 19:11
@chozandrias76

Copy link
Copy Markdown
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)

@chozandrias76

Copy link
Copy Markdown
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)

Oh and I also did a build test and smoke test with claude.

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.

[Bug]: cupcake validate flags valid decision verbs on Cursor (and other non-Claude) events

1 participant