Files
WeiCHENandCursor 868238137c fix(intent): Phase 0+1 P0 safety gates for recognition and coordination
Add golden-v1 hard-negative suite, shadow observability fields, query/command
negation gates for high-risk writes, AllowAffirmative enforcement, candidate
conflict clarification, and coordinator clarify-before-ambiguous ordering.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:21 +00:00

29 lines
959 B
Go

package intent
import "testing"
func TestApplyCandidateConflictGate_WriteVsQuery(t *testing.T) {
write := CandidateIntent{Intent: IntentDocGovSubmitReview, Confidence: 0.94}
query := CandidateIntent{Intent: IntentQueryRejectReason, Confidence: 0.92}
candidates := []CandidateIntent{write, query}
top := &candidates[0]
if !applyCandidateConflictGate(candidates, top) {
t.Fatal("expected conflict gate to trigger for write vs query within margin")
}
if top.ClarificationQuestion == "" {
t.Fatal("expected clarification question on conflict")
}
}
func TestApplyCandidateConflictGate_ClearMargin(t *testing.T) {
write := CandidateIntent{Intent: IntentDocGovSubmitReview, Confidence: 0.94}
query := CandidateIntent{Intent: IntentQueryRejectReason, Confidence: 0.80}
candidates := []CandidateIntent{write, query}
top := &candidates[0]
if applyCandidateConflictGate(candidates, top) {
t.Fatal("expected no conflict when margin >= 0.05")
}
}