M1: snapshot carries session_id and outcome_pending

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-05-31 12:42:35 -04:00
parent 5ee34a350d
commit 034cc16540
2 changed files with 21 additions and 0 deletions
+2
View File
@@ -17,6 +17,8 @@ type Snapshot struct {
RuntimeState domain.RuntimeState `json:"runtime_state"` RuntimeState domain.RuntimeState `json:"runtime_state"`
Commitment *domain.Commitment `json:"commitment,omitempty"` Commitment *domain.Commitment `json:"commitment,omitempty"`
DeadlineUnixSecs int64 `json:"deadline_unix_secs,omitempty"` DeadlineUnixSecs int64 `json:"deadline_unix_secs,omitempty"`
SessionID string `json:"session_id,omitempty"`
OutcomePending string `json:"outcome_pending,omitempty"`
} }
// DefaultPath returns ~/.antidrift/state.json. // DefaultPath returns ~/.antidrift/state.json.
+19
View File
@@ -48,3 +48,22 @@ func TestSaveThenLoadRoundTrips(t *testing.T) {
t.Errorf("deadline: got %d want %d", got.DeadlineUnixSecs, want.DeadlineUnixSecs) t.Errorf("deadline: got %d want %d", got.DeadlineUnixSecs, want.DeadlineUnixSecs)
} }
} }
func TestSnapshotCarriesSessionFields(t *testing.T) {
path := filepath.Join(t.TempDir(), "state.json")
want := Snapshot{
RuntimeState: domain.RuntimeActive,
SessionID: "session-abc",
OutcomePending: "completed",
}
if err := Save(path, want); err != nil {
t.Fatalf("save: %v", err)
}
got, err := Load(path)
if err != nil {
t.Fatalf("load: %v", err)
}
if got.SessionID != "session-abc" || got.OutcomePending != "completed" {
t.Fatalf("session fields did not round-trip: %+v", got)
}
}