GT1: the gate's whole test over a real bus reads the mover's entry

The test bus serves the ledger's query the movers index answers, and the
take-in's mover is looked for in its own entry, the head counting it.

Builds: design 47 H2 §809; H-A-391
This commit is contained in:
2026-11-22 00:22:05 +01:00
parent e866a64be3
commit eac56f9990
2 changed files with 15 additions and 2 deletions
@@ -387,13 +387,25 @@ func (r *runtime) answer(m rpcMessage) {
return nil, fmt.Errorf("the runtime answers no ask %s in this test", a.Key)
}
switch m.Method {
case buscalls.LedgerApply, buscalls.LedgerGet:
case buscalls.LedgerApply, buscalls.LedgerGet, buscalls.LedgerQuery:
// The gate's ledger `records` (W11.1), as the tool runner keeps it: the record test's ledger in memory.
r.b.mu.Lock()
defer r.b.mu.Unlock()
if r.b.ledger == nil {
r.b.ledger = newLedgerFake(r.t)
}
if m.Method == buscalls.LedgerQuery {
var in buscalls.QueryRequest
if err := json.Unmarshal(m.Params, &in); err != nil {
return nil, err
}
insts, err := r.b.ledger.Query(in.Index, in.Key)
var a buscalls.QueryAnswer
for _, inst := range insts {
a.Entries = append(a.Entries, buscalls.IndexEntry{Instance: inst})
}
return a, err
}
if m.Method == buscalls.LedgerGet {
var in buscalls.InstanceRequest
if err := json.Unmarshal(m.Params, &in); err != nil {
@@ -75,7 +75,8 @@ func TestAGateWholeTakesAMergeCallAndWatchesTheHeadsOverARealBus(t *testing.T) {
rt.until("the take-in's mover in the record", eventWithin, func() bool {
b.mu.Lock()
defer b.mu.Unlock()
return strings.Contains(string(b.ledger.states[instance]), `"module":"app"`)
mover, _ := MoverInstance(recordMilestone(branch, 1), "app")
return strings.Contains(string(b.ledger.states[mover]), `"module":"app"`) && strings.Contains(string(b.ledger.states[instance]), `"movers":1`)
})
if e, _ := b.kvs["source"].Get(ctx, sourceKey); e.Revision() != 1 {
t.Fatalf("the merge call heard twice wrote source.%s %d times", escaped, e.Revision())