gate: the reader of mover-added decodes through meshpipelinerunnerclient.MoverAdded, a refusal said

Builds: design 47 H2 H-A-645 (AC-DC2c)
This commit is contained in:
2026-11-25 19:10:29 +01:00
parent e83a7adb2d
commit e2e82311c9
3 changed files with 13 additions and 13 deletions
@@ -33,6 +33,7 @@ import (
"time"
nodeengine "git.novox.be/novox/mesh-contracts/go/seats/nodeengine"
runnerclient "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshpipelinerunnerclient"
runner "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner"
wants "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshwants"
)
@@ -58,22 +59,13 @@ func decodePipelineStarted(body json.RawMessage, _ time.Time) ([]StepOutcome, er
return nil, namesSource(p.Branch, p.Source, p.Run)
}
// decodeMoverAdded reads a mover-added with the contract's decoder, and refuses one naming none or two of from, caller and
// decodeMoverAdded reads a mover-added with the client's decoder, which refuses one naming none or two of from, caller and
// take-in (design 47 H2 H-A-645).
func decodeMoverAdded(body json.RawMessage, _ time.Time) ([]StepOutcome, error) {
m, _, err := runner.DecodeMoverAddedEvent(body)
m, err := runnerclient.MoverAdded(body)
if err != nil {
return nil, err
}
named := 0
for _, given := range []bool{m.From != "", m.Caller != "", m.TakeIn != 0} {
if given {
named++
}
}
if named != 1 {
return nil, fmt.Errorf("a mover-added names exactly one of from, caller and take-in, and this names %d", named)
}
if m.Module == "" || m.Pipeline == "" {
return nil, fmt.Errorf("a mover-added names no module or pipeline")
}
@@ -160,8 +152,8 @@ func (h *Holder) Follow(event string, body json.RawMessage) error {
}
return h.pipelineStarted(p)
case runner.EventMoverAdded:
var m runner.MoverAddedEvent
if err := json.Unmarshal(body, &m); err != nil {
m, err := runnerclient.MoverAdded(body)
if err != nil {
return nil
}
return h.moverAdded(m)
@@ -381,12 +381,19 @@ func TestARecordsEndCountIsSaidAtEachEndAndAHigherPipelineEndReopensIt(t *testin
}
// A mover-added counts its mover in the record its pipeline's key names; one naming none or two of its sources is refused.
hear(t, c, "mesh-pipeline-runner.mover-added.main.1", "", `{"v":1,"pipeline":"main.1","revision":4,"module":"extra","fingerprint":"x","from":"main.1.again.1"}`)
var refusals []string
c.Logf = func(format string, a ...any) { refusals = append(refusals, fmt.Sprintf(format, a...)) }
for _, bad := range []string{
`{"v":1,"pipeline":"main.1","revision":4,"module":"never","fingerprint":"y"}`,
`{"v":1,"pipeline":"main.1","revision":4,"module":"never","fingerprint":"y","from":"a","take-in":3}`,
} {
hear(t, c, "mesh-pipeline-runner.mover-added.main.1", "", bad)
}
// Each is refused by the client's decoder and said (AC-DC2c, H-A-645).
if len(refusals) != 2 || !strings.Contains(refusals[0]+refusals[1], "meshpipelinerunnerclient: mover-added names exactly one of from, caller and take-in, not 0") ||
!strings.Contains(refusals[1], "not 2") {
t.Errorf("the refusals said %q: want the client decoder's, one naming none and one naming two", refusals)
}
if _, ok := r.Entries[EntryKey("extra", "x", "")]; !ok {
t.Errorf("a mover-added counted no mover: %v", r.Entries)
}
+1
View File
@@ -9,6 +9,7 @@ require (
git.novox.be/novox/mesh-contracts/operator-and-conversation/go/clients/operatorchannelclient v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-contracts/operator-and-conversation/go/seats/operatorchannel v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshdeliveryclient v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshpipelinerunnerclient v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/git v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshdelivery v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshpipelinerunner v0.0.0-00010101000000-000000000000