M1: snapshot carries session_id and outcome_pending
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -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.
|
||||||
|
|||||||
@@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user