GT2 whole: the gate's whole test ends a record and reads its delivery time and class

The review found §810's whole criterion proven only at the unit level (H-A-453 (3)): the whole test now ends its
record through the wants seat's wanted and pipeline-wanted and the node-engine seat's running, over the real bus, and
reads the head's delivery-time and class core from a core mover's catalog entry.

Builds: design 47 H2 §810, H-A-453 (3)
This commit is contained in:
2026-11-22 02:34:05 +01:00
parent 98da0e0b68
commit 5dc8cb343b
2 changed files with 36 additions and 3 deletions
@@ -106,7 +106,8 @@ func newTestBus(t *testing.T) *testBus {
// The streams the events are on (mesh.mod.<module>.event.<name>, mesh.seat.<seat>.event.<name>).
if _, err := js.CreateStream(context.Background(), jetstream.StreamConfig{Name: "EVENTS",
Subjects: []string{"mesh.seat.git.event.>", "mesh.seat." + oc.Seat + ".event.>",
"mesh.mod.mesh-delivery-forge-bridge.event.>", "mesh.mod.mesh-delivery-indexer.event.>"}}); err != nil {
"mesh.mod.mesh-delivery-forge-bridge.event.>", "mesh.mod.mesh-delivery-indexer.event.>",
"mesh.seat.mesh-pipeline-runner.event.>", "mesh.seat.mesh-wants.event.>", "mesh.seat.node-engine.event.>"}}); err != nil {
t.Fatal(err)
}
return b
@@ -377,7 +378,11 @@ func (r *runtime) answer(m rpcMessage) {
case "seat:mesh-hand-acts.hand-act":
return toolAnswer(map[string]any{"id": "hand-act-1"}), nil
case "seat:" + meshcatalog.Seat + "." + meshcatalog.VerbEntry:
// A mover's catalog entry, read once for its class (design 47 H2 §810): this test's modules are leaves.
// A mover's catalog entry, read once for its class (design 47 H2 §810): a fingerprint of this test opening with
// "core" is a core module's, every other a leaf's.
if fp, _ := a.Body["fingerprint"].(string); strings.HasPrefix(fp, "core") {
return toolAnswer(map[string]any{"entry": map[string]any{"manifest": map[string]any{"class": "core"}}}), nil
}
return toolAnswer(map[string]any{"entry": map[string]any{"manifest": map[string]any{}}}), nil
case "gitea.gitea_note_append", "gitea.gitea_delivery_view", "gitea.gitea_commit_status", "gitea.gitea_merge_pull_request",
"gitea.gitea_add_comment":
@@ -71,7 +71,7 @@ func TestAGateWholeTakesAMergeCallAndWatchesTheHeadsOverARealBus(t *testing.T) {
}
b.publish(t, "mesh.mod.mesh-delivery-indexer.event.take-in.taken", map[string]any{"branch": branch, "source": 1, "revision": 1,
"call": call, "entries": []any{map[string]any{"module": "app", "commit": merge, "fingerprint": "f", "repository": "novox/app"}}})
"call": call, "entries": []any{map[string]any{"module": "app", "commit": merge, "fingerprint": "core-f", "repository": "novox/app"}}})
rt.until("the take-in's mover in the record", eventWithin, func() bool {
b.mu.Lock()
defer b.mu.Unlock()
@@ -82,6 +82,34 @@ func TestAGateWholeTakesAMergeCallAndWatchesTheHeadsOverARealBus(t *testing.T) {
t.Fatalf("the merge call heard twice wrote source.%s %d times", escaped, e.Revision())
}
// GT2 (design 47 H2 §810; H-A-453 (3)): at its end the record keeps on its head the delivery time, from merge-called to
// its last mover's running, and its class, core for a record that moves a core module.
b.publish(t, "mesh.seat.mesh-wants.event.wanted.test.app", map[string]any{"v": 1, "module": "app", "node": "test",
"fp": "core-f", "pipeline": recordMilestone(branch, 1), "revision": 7})
b.publish(t, "mesh.seat.node-engine.event.running.test.app", map[string]any{"v": 1, "module": "app", "node": "test",
"fingerprint": "core-f", "at": time.Now().UTC().Format(time.RFC3339)})
rt.until("app running on test", eventWithin, func() bool {
b.mu.Lock()
defer b.mu.Unlock()
mover, _ := MoverInstance(recordMilestone(branch, 1), "app")
return strings.Contains(string(b.ledger.states[mover]), `"step":"`+StepRunning+`"`)
})
b.publish(t, "mesh.seat.mesh-wants.event.pipeline-wanted."+escaped+".1", map[string]any{"v": 1, "branch": branch,
"source": 1, "pipeline": recordMilestone(branch, 1), "outcome": "running"})
var head Record
rt.until("the record ended with its delivery time and class", eventWithin, func() bool {
b.mu.Lock()
defer b.mu.Unlock()
head = Record{}
return json.Unmarshal(b.ledger.states[instance], &head) == nil && head.Ended != nil
})
took, err := time.ParseDuration(head.DeliveryTime)
if want := time.Since(time.Date(2026, 11, 20, 3, 0, 0, 0, time.UTC)); err != nil || took < want-time.Minute || took > want ||
head.Class != "core" {
t.Errorf("the ended record keeps the delivery time %q and the class %q, want about %s and core", head.DeliveryTime, head.Class,
want.Round(time.Minute))
}
// The seed (§768): every watched branch's first source revision at its head; its head-moved then holds nothing.
seeded := strings.Repeat("5", 40)
b.mu.Lock()