Skip to content

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

Description

@chozandrias76

Bug Description

The decision-event compatibility matrix (cupcake-core/src/validator/decision_event_matrix.rs) only contains Claude Code events. For any Cursor-native event (beforeShellExecution, afterFileEdit, beforeReadFile, …), compatible_verbs() returns an empty list, so is_compatible() returns false for every decision verb. As a result cupcake validate reports each verb on those events as incompatible with an empty Supported: list.

This makes the Cursor builtins that cupcake init generates fail validation out of the box. Swapping the verb (e.g. haltdeny) does not help, because no verb is registered for those events — the matrix simply has no entry for the event at all.

Steps to Reproduce

  1. cupcake init --global --harness claude (this also scaffolds the cursor/builtins/*.rego policies)
  2. cupcake validate --policy-dir ~/.config/cupcake/policies
  3. Observe errors on the Cursor builtins, e.g.:
✗ .../policies/cursor/builtins/system_protection.rego
  ERROR (line 15): Policy routes to 'beforeShellExecution' events but uses incompatible 'halt' decision verb. 'halt' decisions are not supported for beforeShellExecution events. Supported: 
  ERROR (line 15): Policy routes to 'afterFileEdit' events but uses incompatible 'halt' decision verb. 'halt' decisions are not supported for afterFileEdit events. Supported: 

(The empty string after Supported: is the tell — the matrix has no entry for the event.)

Expected Behavior

Decision verbs that are valid for a harness's events should validate cleanly, and the validator should not flag events it has no spec for.

Actual Behavior

Every decision verb used on a Cursor-native event is reported as incompatible with an empty Supported: list, so cupcake validate fails on the generated Cursor builtins.

Harness

Cursor (note: validate applies the Claude-Code matrix regardless of which harness is active)

Cupcake Version

0.5.2

Operating System

Linux

OS Version

CachyOS (Arch-based)

Additional Context

Root cause: DecisionEventMatrix::new() only inserts Claude Code events; compatible_verbs() falls back to unwrap_or_default() (empty) for unknown events, and the compatibility rule in validator/rules.rs flags every verb against that empty set.

Proposed fix (PR incoming): add Cursor's actionable before/stop events to the matrix with verb sets derived from the Cursor response handlers (beforeShellExecution/beforeMCPExecution: halt/deny/block/ask; beforeReadFile and beforeSubmitPrompt: halt/deny/block; stop: halt/block); add a knows_event() helper; and have the rule skip events the matrix doesn't know — covering Cursor's fire-and-forget after* events and other harnesses' events — while still validating known-but-empty events like SessionEnd. Regression tests included.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions