| 1 | //go:build live |
| 2 | |
| 3 | package agent |
| 4 | |
| 5 | import ( |
| 6 | "encoding/json" |
| 7 | "testing" |
| 8 | ) |
| 9 | |
| 10 | // External inspection establishes current state without rewriting historical |
| 11 | // execution facts through the retired recovery actions. |
| 12 | func snapshotLiveWriteHistory(t *testing.T, a *Agent) string { |
| 13 | t.Helper() |
| 14 | pending := a.PendingToolRecovery() |
| 15 | if len(pending) != 1 || pending[0].ReadOnly { |
| 16 | t.Fatalf("expected one unresolved write, got %d recovery records", len(pending)) |
| 17 | } |
| 18 | data, err := json.Marshal(pending) |
| 19 | if err != nil { |
| 20 | t.Fatal(err) |
| 21 | } |
| 22 | return string(data) |
| 23 | } |
| 24 |