The running pre-G indexer publishes a repository's packages only when every package directory it published last is
still in the tree; G moved contracts/go and sdk to modules/, so mesh-delivery's packages, G's renamed paths among them,
are never published and nothing importing them builds (2026-11-13, indexer journal 'its packages are not published').
These are the trees of e70754ef, unchanged, without sdk/module.json (no second module). Nothing imports them; they go
once G's indexer runs and publishes without them.
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
77 lines
2.8 KiB
Go
77 lines
2.8 KiB
Go
// Code generated by seatgen from the seat definitions; DO NOT EDIT.
|
|
|
|
package meshwants
|
|
|
|
import (
|
|
"encoding/json"
|
|
"reflect"
|
|
"regexp"
|
|
"testing"
|
|
)
|
|
|
|
// TestFixtures reads every fixture of seats/mesh-wants/fixtures: each decodes into its type, a field the type does not
|
|
// know is dropped (ADR 0608 §6), and it reads back as its wire says; each subject named is the contract's.
|
|
func TestFixtures(t *testing.T) {
|
|
cases := []struct {
|
|
name, subject, given, wire string
|
|
decode func([]byte) (any, error)
|
|
subjectIs *regexp.Regexp
|
|
}{
|
|
{name: "a want", subject: "", given: "{\"fp\":\"ab12\",\"rule\":3,\"v\":1}", wire: "{\"fp\":\"ab12\",\"rule\":3,\"v\":1}",
|
|
decode: func(b []byte) (any, error) {
|
|
var v WantsByWantNodeModuleValue
|
|
err := json.Unmarshal(b, &v)
|
|
return v, err
|
|
}, subjectIs: nil},
|
|
{name: "a node's own want", subject: "", given: "{\"composed\":\"sha256:aa\",\"self\":true,\"v\":1}", wire: "{\"composed\":\"sha256:aa\",\"self\":true,\"v\":1}",
|
|
decode: func(b []byte) (any, error) {
|
|
var v WantsByWantNodeNodeValue
|
|
err := json.Unmarshal(b, &v)
|
|
return v, err
|
|
}, subjectIs: nil},
|
|
{name: "a held fingerprint", subject: "", given: "{\"node\":\"ace\",\"v\":1}", wire: "{\"node\":\"ace\",\"v\":1}",
|
|
decode: func(b []byte) (any, error) {
|
|
var v WantsByHeldModuleFingerprintValue
|
|
err := json.Unmarshal(b, &v)
|
|
return v, err
|
|
}, subjectIs: nil},
|
|
{name: "a difference", subject: "", given: "{\"unexplained\":true,\"v\":1,\"want\":\"ab12\"}", wire: "{\"unexplained\":true,\"v\":1,\"want\":\"ab12\"}",
|
|
decode: func(b []byte) (any, error) {
|
|
var v DifferencesByNodeModuleValue
|
|
err := json.Unmarshal(b, &v)
|
|
return v, err
|
|
}, subjectIs: nil},
|
|
{name: "a composition", subject: "", given: "{\"group\":\"g1\",\"heads\":\"0123456789ab\",\"state\":\"pass\",\"v\":1}", wire: "{\"group\":\"g1\",\"heads\":\"0123456789ab\",\"state\":\"pass\",\"v\":1}",
|
|
decode: func(b []byte) (any, error) {
|
|
var v CompositionsByGroupHeadsValue
|
|
err := json.Unmarshal(b, &v)
|
|
return v, err
|
|
}, subjectIs: nil},
|
|
}
|
|
for _, c := range cases {
|
|
v, err := c.decode([]byte(c.given))
|
|
if err != nil {
|
|
t.Errorf("%s: does not decode: %v", c.name, err)
|
|
continue
|
|
}
|
|
back, err := json.Marshal(v)
|
|
if err != nil {
|
|
t.Errorf("%s: does not encode: %v", c.name, err)
|
|
continue
|
|
}
|
|
var got, want any
|
|
if err := json.Unmarshal(back, &got); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := json.Unmarshal([]byte(c.wire), &want); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if !reflect.DeepEqual(got, want) {
|
|
t.Errorf("%s: reads back as %s, want %s", c.name, back, c.wire)
|
|
}
|
|
if c.subjectIs != nil && !c.subjectIs.MatchString(c.subject) {
|
|
t.Errorf("%s: subject %q is not the contract's %s", c.name, c.subject, c.subjectIs)
|
|
}
|
|
}
|
|
}
|