CT10: meshwantsclient compares wants that now carry their parts by value

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
This commit is contained in:
2026-11-11 10:56:59 +01:00
parent 90b8ba6461
commit 3883667254
2 changed files with 3 additions and 1 deletions
@@ -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 {
@@ -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)