Preserve leases needing recovery

This commit is contained in:
kami
2026-07-30 14:37:34 +04:00
parent f6ee0e3060
commit 8174400b1a
12 changed files with 106 additions and 39 deletions
+6 -3
View File
@@ -154,7 +154,7 @@ func TestEndToEndIngestRouteLeaseRotateAndComplete(t *testing.T) {
// handoff. Once TaskLeased carries a real handoff_ref, pickup correctly
// refuses it instead of silently continuing (the valid pickup contract is
// covered by the orchestrator continuity tests).
if got.State != domain.StateBlocked || got.Version != 5 {
if got.State != domain.StateNeedsAttention || got.Lease == nil || got.Version != 5 {
t.Fatalf("invalid pickup state=%s version=%d", got.State, got.Version)
}
ref, err = s.PutArtifact([]byte("report"))
@@ -162,8 +162,11 @@ func TestEndToEndIngestRouteLeaseRotateAndComplete(t *testing.T) {
t.Fatal(err)
}
if err := s.Append(domain.Event{ID: domain.NewID(), Type: "TaskCompleted", TaskID: task.ID, Version: got.Version + 1, Surface: string(authz.System), Payload: mustJSON(map[string]any{
"report_ref": ref,
"receipt": map[string]any{"harness_id": "h1", "consumed": 1},
"report_ref": ref,
"receipt": map[string]any{"harness_id": "h1", "consumed": 1},
"harness_id": got.Lease.HarnessID,
"lease_epoch": got.Lease.Epoch,
"expected_version": got.Version,
})}); err != nil {
t.Fatal(err)
}