package bridge import ( "os" "testing" "git.novox.be/novox/mesh-sdk/go/delivery" ) // ADR 0495 clause 1 with the lead's decision L8 of R4e: the forge bridge is no reader of a manifest's `paths`. A merge of a // module whose artifacts name their paths (mesh-sdk's module.json at 9cb4d59) gives a message that carries the manifest as // the forge answered it and no named path's object: the indexer asks the forge for those itself. func TestAMergedMessageCarriesNoNamedPathsTheBridgeDerived(t *testing.T) { raw, err := os.ReadFile("testdata/mesh-sdk-9cb4d59.module.json") if err != nil { t.Fatal(err) } files := func(owner, repo, path, ref string) ([]byte, error) { if path == "module.json" { return raw, nil } return nil, ErrNotFound } var calls []call msg, err := Convert(mergedSubject, mergedBody(map[string]any{"repo": "mesh-sdk", "module_dirs": []string{""}}), treesOf(&calls, "r0", map[string]string{"": "r0"}, nil), files) if err != nil { t.Fatal(err) } f, err := delivery.DecodeForge(msg.Data) if err != nil { t.Fatal(err) } if len(f.Paths) != 0 || f.Manifests[""] != string(raw) || len(calls) != 1 { t.Errorf("message paths %v, manifest carried %v, trees asked %d times; want no paths, the manifest, one ask", f.Paths, f.Manifests[""] == string(raw), len(calls)) } }