From 7024df820a085087249712888c698a490edd2863 Mon Sep 17 00:00:00 2001 From: jochen Date: Wed, 11 Nov 2026 21:42:07 +0100 Subject: [PATCH] =?UTF-8?q?=C2=A7693=20/=20A-6:=20the=20seat=20mesh-wants'?= =?UTF-8?q?=20wanted=20event=20gains=20removed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Builds: design 47 G ยง693, A-6 (G-20) Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ --- contracts/go/seats/meshwants/contract.go | 16 +++++++++------- contracts/go/seats/meshwants/contract_test.go | 2 ++ contracts/seats/mesh-wants/fixtures/events.json | 14 ++++++++++++++ contracts/seats/mesh-wants/seat.json | 4 ++++ contracts/ts/seats/meshwants/index.d.ts | 2 ++ 5 files changed, 31 insertions(+), 7 deletions(-) diff --git a/contracts/go/seats/meshwants/contract.go b/contracts/go/seats/meshwants/contract.go index 2f1c5dec..e86953fe 100644 --- a/contracts/go/seats/meshwants/contract.go +++ b/contracts/go/seats/meshwants/contract.go @@ -820,13 +820,15 @@ type DifferenceEvent struct { // WantedEvent is the body of the event wanted. type WantedEvent struct { - At *time.Time `json:"at,omitempty"` - Fp string `json:"fp"` - Module string `json:"module"` - Node string `json:"node"` - Revision int64 `json:"revision"` - Source int64 `json:"source,omitempty"` - V int64 `json:"v"` + At *time.Time `json:"at,omitempty"` + Fp string `json:"fp"` + Module string `json:"module"` + Node string `json:"node"` + // true when the assigner removes the want of that node and module (the node left, or the module was unplaced); fp is then the fingerprint last wanted there (design 47 G section 693) + Removed bool `json:"removed,omitempty"` + Revision int64 `json:"revision"` + Source int64 `json:"source,omitempty"` + V int64 `json:"v"` } // WaitHeldEvent is the body of the event wait-held. diff --git a/contracts/go/seats/meshwants/contract_test.go b/contracts/go/seats/meshwants/contract_test.go index 1e2da9e6..d18fcac6 100644 --- a/contracts/go/seats/meshwants/contract_test.go +++ b/contracts/go/seats/meshwants/contract_test.go @@ -27,6 +27,8 @@ func TestFixtures(t *testing.T) { decode: func(b []byte) (any, error) { var v DifferenceEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.mesh-wants\\.event\\.difference$")}, {name: "an entry wanted from a trunk revision", subject: "mesh.seat.mesh-wants.event.wanted", given: "{\"at\":\"2026-11-09T19:00:00Z\",\"fp\":\"src2:b427bdde1f100e2f52490cfa9df0c5112dd3700226b4892349f0c14a15a4af56\",\"module\":\"xclip\",\"node\":\"n1\",\"revision\":40,\"source\":3589,\"v\":1}", wire: "{\"at\":\"2026-11-09T19:00:00Z\",\"fp\":\"src2:b427bdde1f100e2f52490cfa9df0c5112dd3700226b4892349f0c14a15a4af56\",\"module\":\"xclip\",\"node\":\"n1\",\"revision\":40,\"source\":3589,\"v\":1}", decode: func(b []byte) (any, error) { var v WantedEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.mesh-wants\\.event\\.wanted$")}, + {name: "a want removed, its node left or its module unplaced", subject: "mesh.seat.mesh-wants.event.wanted", given: "{\"at\":\"2026-11-09T19:05:00Z\",\"fp\":\"src2:b427bdde1f100e2f52490cfa9df0c5112dd3700226b4892349f0c14a15a4af56\",\"module\":\"xclip\",\"node\":\"n1\",\"removed\":true,\"revision\":41,\"v\":1}", wire: "{\"at\":\"2026-11-09T19:05:00Z\",\"fp\":\"src2:b427bdde1f100e2f52490cfa9df0c5112dd3700226b4892349f0c14a15a4af56\",\"module\":\"xclip\",\"node\":\"n1\",\"removed\":true,\"revision\":41,\"v\":1}", + decode: func(b []byte) (any, error) { var v WantedEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.mesh-wants\\.event\\.wanted$")}, {name: "a composing wait held with its bound", subject: "mesh.seat.mesh-wants.event.wait-held", given: "{\"bound\":\"30m\",\"fp\":\"src2:b427bdde1f100e2f52490cfa9df0c5112dd3700226b4892349f0c14a15a4af56\",\"module\":\"xclip\",\"node\":\"n1\",\"part\":\"node-engine\",\"since\":\"2026-11-09T19:00:00Z\",\"step\":\"compose\",\"version\":\"src2:7dd0db8e98224f46121a5ae05c0b9c5a430eff531a5120aa40b1a59237853a3f\"}", wire: "{\"bound\":\"30m\",\"fp\":\"src2:b427bdde1f100e2f52490cfa9df0c5112dd3700226b4892349f0c14a15a4af56\",\"module\":\"xclip\",\"node\":\"n1\",\"part\":\"node-engine\",\"since\":\"2026-11-09T19:00:00Z\",\"step\":\"compose\",\"version\":\"src2:7dd0db8e98224f46121a5ae05c0b9c5a430eff531a5120aa40b1a59237853a3f\"}", decode: func(b []byte) (any, error) { var v WaitHeldEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.mesh-wants\\.event\\.wait-held$")}, {name: "a wait ended, released by hand", subject: "mesh.seat.mesh-wants.event.wait-ended", given: "{\"bound\":\"30m\",\"by\":\"lead@shanks: the node is away\",\"fp\":\"src2:b427bdde1f100e2f52490cfa9df0c5112dd3700226b4892349f0c14a15a4af56\",\"how\":\"released\",\"module\":\"xclip\",\"node\":\"n1\",\"part\":\"node-engine\",\"since\":\"2026-11-09T19:00:00Z\",\"step\":\"compose\",\"version\":\"src2:7dd0db8e98224f46121a5ae05c0b9c5a430eff531a5120aa40b1a59237853a3f\"}", wire: "{\"bound\":\"30m\",\"by\":\"lead@shanks: the node is away\",\"fp\":\"src2:b427bdde1f100e2f52490cfa9df0c5112dd3700226b4892349f0c14a15a4af56\",\"how\":\"released\",\"module\":\"xclip\",\"node\":\"n1\",\"part\":\"node-engine\",\"since\":\"2026-11-09T19:00:00Z\",\"step\":\"compose\",\"version\":\"src2:7dd0db8e98224f46121a5ae05c0b9c5a430eff531a5120aa40b1a59237853a3f\"}", diff --git a/contracts/seats/mesh-wants/fixtures/events.json b/contracts/seats/mesh-wants/fixtures/events.json index f9bdf4ab..85b2e909 100644 --- a/contracts/seats/mesh-wants/fixtures/events.json +++ b/contracts/seats/mesh-wants/fixtures/events.json @@ -47,6 +47,20 @@ "at": "2026-11-09T19:00:00Z" } }, + { + "name": "a want removed, its node left or its module unplaced", + "of": "event:wanted", + "subject": "mesh.seat.mesh-wants.event.wanted", + "given": { + "v": 1, + "node": "n1", + "module": "xclip", + "fp": "src2:b427bdde1f100e2f52490cfa9df0c5112dd3700226b4892349f0c14a15a4af56", + "revision": 41, + "removed": true, + "at": "2026-11-09T19:05:00Z" + } + }, { "name": "a composing wait held with its bound", "of": "event:wait-held", diff --git a/contracts/seats/mesh-wants/seat.json b/contracts/seats/mesh-wants/seat.json index d9d6d32a..05966ed3 100644 --- a/contracts/seats/mesh-wants/seat.json +++ b/contracts/seats/mesh-wants/seat.json @@ -325,6 +325,10 @@ "source": { "type": "integer" }, + "removed": { + "type": "boolean", + "description": "true when the assigner removes the want of that node and module (the node left, or the module was unplaced); fp is then the fingerprint last wanted there (design 47 G section 693)" + }, "at": { "type": "string", "format": "date-time" diff --git a/contracts/ts/seats/meshwants/index.d.ts b/contracts/ts/seats/meshwants/index.d.ts index 876d399c..399bdeaa 100644 --- a/contracts/ts/seats/meshwants/index.d.ts +++ b/contracts/ts/seats/meshwants/index.d.ts @@ -455,6 +455,8 @@ export interface WantedEvent { "fp": string; "module": string; "node": string; + /** true when the assigner removes the want of that node and module (the node left, or the module was unplaced); fp is then the fingerprint last wanted there (design 47 G section 693) */ + "removed"?: boolean; "revision": number; "source"?: number; "v": number;