diff --git a/go/seats/meshrecovery/contract.go b/go/seats/meshrecovery/contract.go index 4f1846e..b9e28c3 100644 --- a/go/seats/meshrecovery/contract.go +++ b/go/seats/meshrecovery/contract.go @@ -449,6 +449,8 @@ type EndedEvent struct { Outcome string `json:"outcome"` Size int64 `json:"size,omitempty"` Snapshot string `json:"snapshot,omitempty"` + // the words of the hand act that ended it, for a cancel (design 47 G A-117, 560) + Why string `json:"why,omitempty"` } // The values of EndedEvent's outcome. @@ -487,6 +489,8 @@ type RestoredEvent struct { // how the act ended Outcome string `json:"outcome"` Snapshot string `json:"snapshot,omitempty"` + // the words of the hand act that ended it, for a cancel (design 47 G A-117, 560) + Why string `json:"why,omitempty"` } // The values of RestoredEvent's outcome. diff --git a/go/seats/meshrecovery/contract_test.go b/go/seats/meshrecovery/contract_test.go index 8d7277d..346c550 100644 --- a/go/seats/meshrecovery/contract_test.go +++ b/go/seats/meshrecovery/contract_test.go @@ -25,6 +25,8 @@ func TestFixtures(t *testing.T) { decode: func(b []byte) (any, error) { var v RestoreStartedEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.mesh-recovery\\.event\\.restore-started\\.[^.*> ]+\\.[^.*> ]+$")}, {name: "restored is said", subject: "mesh.seat.mesh-recovery.event.restored.mesh-knowledge.ledger", given: "{\"act\":\"a-3\",\"at\":\"2026-11-11T10:00:00Z\",\"error\":\"restore point missing\",\"kept\":\"ledger\",\"missing\":true,\"module\":\"mesh-knowledge\",\"outcome\":\"failed\"}", wire: "{\"act\":\"a-3\",\"at\":\"2026-11-11T10:00:00Z\",\"error\":\"restore point missing\",\"kept\":\"ledger\",\"missing\":true,\"module\":\"mesh-knowledge\",\"outcome\":\"failed\"}", decode: func(b []byte) (any, error) { var v RestoredEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.mesh-recovery\\.event\\.restored\\.[^.*> ]+\\.[^.*> ]+$")}, + {name: "a cancelled act says the hand act's why", subject: "mesh.seat.mesh-recovery.event.restored.mesh-knowledge.ledger", given: "{\"act\":\"a-4\",\"at\":\"2026-11-11T10:00:00Z\",\"error\":\"cancelled\",\"kept\":\"ledger\",\"module\":\"mesh-knowledge\",\"outcome\":\"failed\",\"why\":\"the operator stopped it to look at the disk\"}", wire: "{\"act\":\"a-4\",\"at\":\"2026-11-11T10:00:00Z\",\"error\":\"cancelled\",\"kept\":\"ledger\",\"module\":\"mesh-knowledge\",\"outcome\":\"failed\",\"why\":\"the operator stopped it to look at the disk\"}", + decode: func(b []byte) (any, error) { var v RestoredEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.mesh-recovery\\.event\\.restored\\.[^.*> ]+\\.[^.*> ]+$")}, {name: "set-aside is said", subject: "mesh.seat.mesh-recovery.event.set-aside.mesh-knowledge.ledger", given: "{\"act\":\"a-4\",\"at\":\"2026-11-11T10:00:00Z\",\"id\":\"20261111T121200Z\",\"name\":\"mesh-knowledge_ledger\",\"size\":4096}", wire: "{\"act\":\"a-4\",\"at\":\"2026-11-11T10:00:00Z\",\"id\":\"20261111T121200Z\",\"name\":\"mesh-knowledge_ledger\",\"size\":4096}", decode: func(b []byte) (any, error) { var v SetAsideEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.mesh-recovery\\.event\\.set-aside\\.[^.*> ]+\\.[^.*> ]+$")}, {name: "aside-discarded is said", subject: "mesh.seat.mesh-recovery.event.aside-discarded.mesh-knowledge.ledger", given: "{\"act\":\"a-5\",\"at\":\"2026-11-11T10:00:00Z\",\"id\":\"20261111T121200Z\",\"name\":\"mesh-knowledge_ledger\",\"size\":4096}", wire: "{\"act\":\"a-5\",\"at\":\"2026-11-11T10:00:00Z\",\"id\":\"20261111T121200Z\",\"name\":\"mesh-knowledge_ledger\",\"size\":4096}", diff --git a/seats/mesh-recovery/fixtures/events.json b/seats/mesh-recovery/fixtures/events.json index 2b13fb8..724aefb 100644 --- a/seats/mesh-recovery/fixtures/events.json +++ b/seats/mesh-recovery/fixtures/events.json @@ -72,6 +72,20 @@ "missing": true } }, + { + "name": "a cancelled act says the hand act's why", + "of": "event:restored", + "subject": "mesh.seat.mesh-recovery.event.restored.mesh-knowledge.ledger", + "given": { + "act": "a-4", + "at": "2026-11-11T10:00:00Z", + "module": "mesh-knowledge", + "kept": "ledger", + "outcome": "failed", + "error": "cancelled", + "why": "the operator stopped it to look at the disk" + } + }, { "name": "set-aside is said", "of": "event:set-aside", diff --git a/seats/mesh-recovery/seat.json b/seats/mesh-recovery/seat.json index 31fff7a..ded2e60 100644 --- a/seats/mesh-recovery/seat.json +++ b/seats/mesh-recovery/seat.json @@ -669,6 +669,10 @@ "type": "string", "description": "when failed" }, + "why": { + "type": "string", + "description": "the words of the hand act that ended it, for a cancel (design 47 G A-117, 560)" + }, "consumers": { "type": "array", "items": { @@ -788,6 +792,10 @@ "error": { "type": "string" }, + "why": { + "type": "string", + "description": "the words of the hand act that ended it, for a cancel (design 47 G A-117, 560)" + }, "aside": { "$ref": "#/defs/Aside" }, diff --git a/ts/seats/meshrecovery/index.d.ts b/ts/seats/meshrecovery/index.d.ts index fda42f1..292c4e1 100644 --- a/ts/seats/meshrecovery/index.d.ts +++ b/ts/seats/meshrecovery/index.d.ts @@ -399,6 +399,8 @@ export interface EndedEvent { "outcome": "done" | "failed"; "size"?: number; "snapshot"?: string; + /** the words of the hand act that ended it, for a cancel (design 47 G A-117, 560) */ + "why"?: string; } /** is the body of the event restore-started. */ @@ -431,6 +433,8 @@ export interface RestoredEvent { /** how the act ended */ "outcome": "done" | "failed"; "snapshot"?: string; + /** the words of the hand act that ended it, for a cancel (design 47 G A-117, 560) */ + "why"?: string; } /** is the body of the event set-aside. */