The bridge watches the registrations' branches by origin (a first view of registrations, then registration-changed), before the first registration the gate's source's (source-moved); no branch is named in its code, Trunk goes. Every move is heard on the seat git's branch-moved through the bridge's durable on SEAT_git_branch-moved, its head read by the seat's verb branch, never the event's: merged with its pull request and `base` (the watched branch) when the seat's pull names the head a pull request's merge, else `pushed` with branch, head and `before`, both with the take-in inputs at the head. The last head written per watched branch is kept in the state heads under branch.<owner>.<name>.<escaped branch>, so a move heard twice writes once, and each watched branch's head is read at the start and when a branch is registered. A move of an unprotected branch writes nothing. pull.merged into a watched branch writes nothing (its message is the move's); the forge-made merge's trunk filter goes. Builds: design 47 G §4, §7, §11, §20, §41, §507, §509, §532, §714, A-227, A-236 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
37 lines
1.3 KiB
Go
37 lines
1.3 KiB
Go
package bridge
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-forge-bridge/forgemsg"
|
|
)
|
|
|
|
// 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 := convertMerged(mergedBody(map[string]any{"repo": "mesh-sdk", "module_dirs": []string{""}}), treesOf(&calls, "r0", map[string]string{"": "r0"}, nil), files, nil)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
f, err := forgemsg.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))
|
|
}
|
|
}
|