Files
Agent-System/internal/jevdecide/regold_test.go
T
weichen 45f21e84c7 feat(jevdecide): product shadow client with offline eval gates
Add typed jevdecide HTTP client (circuit, metrics) and coordinator
DecideAssist wiring behind JEV_DECIDE_MODE (default off). Offline eval
and synthetic soak evidence gate realtime/profile before assist rollout.
2026-09-23 17:40:40 +00:00

52 lines
1.2 KiB
Go

package jevdecide_test
import (
"encoding/json"
"os"
"path/filepath"
"testing"
"chat-agent-system/internal/coordinator"
"chat-agent-system/internal/jevdecide"
)
func TestRegoldProfileIfRequested(t *testing.T) {
if os.Getenv("REGOLD_PROFILE") != "1" {
t.Skip("set REGOLD_PROFILE=1")
}
path := filepath.Join("testdata", "eval-v1.json")
raw, err := os.ReadFile(path)
if err != nil {
t.Fatal(err)
}
var file struct {
SchemaVersion int `json:"schema_version"`
Description string `json:"description"`
Cases []struct {
ID string `json:"id"`
Suite string `json:"suite"`
Input string `json:"input"`
Gold map[string]any `json:"gold"`
} `json:"cases"`
}
if err := json.Unmarshal(raw, &file); err != nil {
t.Fatal(err)
}
for i := range file.Cases {
c := &file.Cases[i]
if c.Suite != "profile" {
continue
}
p := coordinator.ProfileTask(c.Input, nil)
c.Gold = map[string]any{
"bucket": jevdecide.ProfileBucket(p.ComplexityScore),
"score": p.ComplexityScore,
"form": string(p.DeliverableForm),
}
}
out, _ := json.MarshalIndent(file, "", " ")
if err := os.WriteFile(path, append(out, '\n'), 0o644); err != nil {
t.Fatal(err)
}
}