Files
Agent-System/internal/docrevision/pi_narrative_test.go
T
weichenandCursor e7e981356c feat(docgov): PI_CHANGE_REPORT_NARRATIVE gate with full fallback
Default off; malformed or risk downgrade forces deterministic report.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-16 15:40:25 +00:00

25 lines
716 B
Go

package docrevision
import "testing"
func TestPINarrativeFlagDefaultOff(t *testing.T) {
t.Setenv("PI_CHANGE_REPORT_NARRATIVE", "")
if PIChangeReportNarrativeEnabled() {
t.Fatal("default off")
}
det := `{"ok":true}`
got := SelectChangeReportJSON(`{"pi":true}`, det, "a", "b", "low", nil, nil)
if got != det {
t.Fatalf("flag off must use deterministic, got %s", got)
}
}
func TestPINarrativeMalformedFallsBack(t *testing.T) {
t.Setenv("PI_CHANGE_REPORT_NARRATIVE", "1")
det := BuildDeterministicChangeReportJSON("from", "to", "medium", nil, DiffResult{})
got := SelectChangeReportJSON("{not-json", det, "from", "to", "medium", nil, nil)
if got != det {
t.Fatal("malformed must full fallback")
}
}