9130ae8c7a
Add durable FIFO capacity-one resource leases for executable stages, including cleanup-confirmed release, conservative restart quarantine, queue state events, and CLI/TUI/Android waiting presentation. Add scheduler, cleanup, protocol, client, and Android coverage plus a proposed Android v3 resource draft. Checked packaged templates and authoring skill references: neither needs updating in this item. The per-item docs note records the shared documentation that docs-fold must update; no shared README or packaged reference was edited.
30 lines
955 B
Go
30 lines
955 B
Go
package protocol
|
|
|
|
import (
|
|
"encoding/json"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestResourceWaitOlderClientCompatibility(t *testing.T) {
|
|
data, err := json.Marshal(RunSummary{ID: 1, Status: RunStatusQueued, ResourceWait: &ResourceWait{Resource: "X", Stage: "review", Sequence: 2, QueuedSince: "now"}})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
var old struct {
|
|
ID int64 `json:"id"`
|
|
Status string `json:"status"`
|
|
}
|
|
if err := json.Unmarshal(data, &old); err != nil || old.Status != "queued" {
|
|
t.Fatal("old client no longer waits", old, err)
|
|
}
|
|
clear, err := json.Marshal(RunEventFrame{RunID: 1, ResourceWaitSet: true})
|
|
if err != nil || !strings.Contains(string(clear), `"resource_wait_set":true`) {
|
|
t.Fatal("no explicit clear", string(clear), err)
|
|
}
|
|
var current RunSummary
|
|
if err := json.Unmarshal([]byte(`{"id":2,"status":"running"}`), ¤t); err != nil || current.ResourceWait != nil {
|
|
t.Fatal("missing field changed old payload", err)
|
|
}
|
|
}
|