// session_log_helper — Go-side counterpart for the cross-runtime // session-log parity probe. Reads a fixture JSON on stdin, builds a // SessionRecord, emits one JSONL row to stdout. // // Used by scripts/cutover/parity/session_log_parity.sh. package main import ( "encoding/json" "fmt" "io" "os" "time" "git.agentview.dev/profit/golangLAKEHOUSE/internal/validator" ) // fixtureInput shape mirrors the Rust helper's accepted shape so both // helpers can read the same stdin payload. type fixtureInput struct { SessionID string `json:"session_id"` Kind string `json:"kind"` Model string `json:"model"` Provider string `json:"provider"` Prompt string `json:"prompt"` Iterations int `json:"iterations"` MaxIterations int `json:"max_iterations"` FinalVerdict string `json:"final_verdict"` Attempts []validator.SessionAttemptRecord `json:"attempts"` Artifact map[string]any `json:"artifact"` GroundedInRoster *bool `json:"grounded_in_roster"` DurationMs int64 `json:"duration_ms"` } func main() { buf, err := io.ReadAll(os.Stdin) if err != nil { fmt.Fprintf(os.Stderr, "read stdin: %v\n", err) os.Exit(1) } var in fixtureInput if err := json.Unmarshal(buf, &in); err != nil { fmt.Fprintf(os.Stderr, "parse stdin: %v\n", err) os.Exit(1) } rec := validator.SessionRecord{ Schema: validator.SessionRecordSchema, SessionID: in.SessionID, Timestamp: time.Date(2026, 1, 1, 0, 0, 0, 0, time.UTC).Format(time.RFC3339), Daemon: "validatord", Kind: in.Kind, Model: in.Model, Provider: in.Provider, Prompt: in.Prompt, Iterations: in.Iterations, MaxIterations: in.MaxIterations, FinalVerdict: in.FinalVerdict, Attempts: in.Attempts, Artifact: in.Artifact, GroundedInRoster: in.GroundedInRoster, DurationMs: in.DurationMs, } body, err := json.Marshal(rec) if err != nil { fmt.Fprintf(os.Stderr, "marshal: %v\n", err) os.Exit(1) } fmt.Println(string(body)) }