Replace FakeActionOwner with QueryOwner+QueryGuard at the composition root; DispatchEligible reuses claim/execute/recover so confirm stays zero-write before dispatch and default tier remains legacy.
37 lines
975 B
Go
37 lines
975 B
Go
package app
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
"testing"
|
|
|
|
"chat-agent-system/internal/app/intentflow"
|
|
)
|
|
|
|
func TestProductionCompositionRoot_NoFakeQueryOwner(t *testing.T) {
|
|
root := "."
|
|
src, err := os.ReadFile(filepath.Join(root, "app.go"))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
body := string(src)
|
|
if strings.Contains(body, "NewFakeActionOwner()") {
|
|
t.Fatal("production composition root must not construct FakeActionOwner")
|
|
}
|
|
if !strings.Contains(body, "NewQueryOwner(") {
|
|
t.Fatal("production composition root must wire NewQueryOwner")
|
|
}
|
|
if !strings.Contains(body, "QueryGuard{Inner: queryOwner}") {
|
|
t.Fatal("production composition root must wrap QueryOwner in QueryGuard")
|
|
}
|
|
}
|
|
|
|
func TestDefaultPlanTierRemainsLegacy(t *testing.T) {
|
|
t.Setenv("MULTI_INTENT_PLAN_TIER", "")
|
|
intentflow.ResetFeatureFlagsForTest()
|
|
if got := intentflow.CurrentFeatureFlags().PlanTier; got != intentflow.TierLegacy {
|
|
t.Fatalf("default tier = %s, want legacy", got)
|
|
}
|
|
}
|