Files
Agent-System/internal/events/cutover_test.go
T
weichenandCursor 265f09c1f2 fix(server): cache health probes, surface SSE marshal errors, fail closed on missing duties
Health checks reuse a two-second snapshot and bound the schema query. Task SSE writes an error frame when an event cannot be encoded. ResolveDocTask errors when the frozen plan has no duty row, while explicit none-duties stay zero. Drop the unwired semantic-summary replace env, record the intentional dev versus release model split, document the test/main cutover path, and archive pre-goose SQL.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-19 09:16:18 +00:00

41 lines
1.3 KiB
Go

package events
import (
"strings"
"testing"
)
func TestValidateOpsCutoverRejectsFavAndNonDev(t *testing.T) {
if err := ValidateOpsCutover("dev", ConsumerNotify, ModeShadow); err != nil {
t.Fatal(err)
}
if err := ValidateOpsCutover("test", ConsumerNotify, ModeLive); err == nil {
t.Fatal("test env must fail")
}
if err := ValidateOpsCutover("main", ConsumerNotify, ModeLive); err == nil {
t.Fatal("main env must fail")
}
if !strings.Contains(OpsCutoverPromotionPath, "test") || !strings.Contains(OpsCutoverPromotionPath, "main") {
t.Fatalf("promotion path must name test and main: %s", OpsCutoverPromotionPath)
}
if err := ValidateOpsCutover("dev", ConsumerFAV, ModeOff); err == nil {
t.Fatal("fav must fail even at off")
}
if err := ValidateOpsCutover("dev", "unknown", ModeLive); err == nil {
t.Fatal("unknown consumer must fail")
}
if err := ValidateOpsCutover("dev", ConsumerNotify, "dual"); err == nil {
t.Fatal("unknown mode must fail")
}
}
func TestValidateOpsCutoverAllowsThreeConsumers(t *testing.T) {
for _, c := range []string{ConsumerNotify, ConsumerWorkflowAdvance, ConsumerProjection} {
for _, m := range []string{ModeOff, ModeShadow, ModeLive} {
if err := ValidateOpsCutover("dev", c, m); err != nil {
t.Fatalf("%s %s: %v", c, m, err)
}
}
}
}