From 388366725410fb2049f01964794b4f89634e06bb Mon Sep 17 00:00:00 2001 From: jochen Date: Wed, 11 Nov 2026 10:56:59 +0100 Subject: [PATCH] CT10: meshwantsclient compares wants that now carry their parts by value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The want gained the released version and each part's digest (CT4), so two wants are compared by value; a table row writes and reads one back. Failed to compile before. Builds: design 47 G §379, §308. Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ --- contracts/go/clients/meshwantsclient/wants.go | 3 ++- contracts/go/clients/meshwantsclient/wants_test.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/contracts/go/clients/meshwantsclient/wants.go b/contracts/go/clients/meshwantsclient/wants.go index 2e54a9f6..1b79073e 100644 --- a/contracts/go/clients/meshwantsclient/wants.go +++ b/contracts/go/clients/meshwantsclient/wants.go @@ -7,6 +7,7 @@ package meshwantsclient import ( "encoding/json" "fmt" + "reflect" "regexp" "strings" @@ -258,7 +259,7 @@ func DecodeWant(data []byte) (Want, error) { } // SameWant says whether two wants are the same value, so the assigner writes only when they differ. -func SameWant(a, b Want) bool { return a == b } +func SameWant(a, b Want) bool { return reflect.DeepEqual(a, b) } func checkNodeWant(w NodeWant) error { switch { diff --git a/contracts/go/clients/meshwantsclient/wants_test.go b/contracts/go/clients/meshwantsclient/wants_test.go index 5e2ecadb..c4cf388e 100644 --- a/contracts/go/clients/meshwantsclient/wants_test.go +++ b/contracts/go/clients/meshwantsclient/wants_test.go @@ -39,6 +39,7 @@ func TestWantsAreWhatTheEarlierCodecWrote(t *testing.T) { "held back": {Want{Fp: a, Self: true, Newest: b, Rule: RuleGrant, Backup: BackupAgain, Words: "held"}, `{"v":1,"fp":"` + a + `","newest":"` + b + `","rule":6,"backup":"again","words":"held","self":true}`}, "put": {Want{Fp: a, Self: true, Put: true, Hold: true, Yes: d, Release: "r1"}, `{"v":1,"fp":"` + a + `","put":true,"hold":true,"yes":"` + d + `","release":"r1","self":true}`}, "removed": {Want{Removed: true, Words: "gone"}, `{"v":1,"removed":true,"words":"gone"}`}, + "released": {Want{Fp: a, Composed: c, Version: "0.1.15", Parts: map[string]string{"mesh-sdk:go": d}}, `{"v":1,"fp":"` + a + `","composed":"` + c + `","version":"0.1.15","parts":{"mesh-sdk:go":"` + d + `"}}`}, } { t.Run(name, func(t *testing.T) { raw, err := EncodeWant(row.w)