A-248: buildrun.Asker puts under the asker its subject names
The indexer's validation ask rides accept.<queue>.<asker> under its own name (§712, A-232); an asker that names none still puts under the builder's. Builds: design 47 G A-248, A-247, §712 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package buildrun
|
||||
|
||||
import (
|
||||
"cmp"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
@@ -34,6 +35,9 @@ type AskWaiter interface {
|
||||
|
||||
// Asker puts asks and waits for their steps.
|
||||
type Asker struct {
|
||||
// Name is the asker the subject names, the caller's seat name (design 47 G A-248, A-163): empty puts under the builder's
|
||||
// name until the asker rename after the join.
|
||||
Name string
|
||||
Publisher AskPublisher
|
||||
Waiter AskWaiter
|
||||
// Seats finds the build module of an ask's language (design 47 G A-82).
|
||||
@@ -173,8 +177,8 @@ func (k Asker) dropped(a buildstep.StepAsk, why string) {
|
||||
// PutTry is how long one publish of an ask waits for its stream's answer before it is made again (Put).
|
||||
var PutTry = 10 * time.Second
|
||||
|
||||
// Put puts a on its stream: the seat's accept subject of its language and kind, under the builder's name as asker (design 47 G
|
||||
// §481, §600: `accept.<queue>.builder`). The put is a kept call (novox/hq ADR 0668
|
||||
// Put puts a on its stream: the seat's accept subject of its language and kind, under the asker's Name, else the builder's
|
||||
// name (design 47 G §481, §600, A-248: `accept.<queue>.builder`). The put is a kept call (novox/hq ADR 0668
|
||||
// §1, §2; issue 1966, issue 1748 note 27): it carries the ask's id as its message id, so the stream takes it once, and it
|
||||
// is made again through every transport fault (a deadline, no responders) within busretry.Bound, each try bounded by
|
||||
// PutTry, until ctx ends. A put that still meets one is an error opening `transport fault:` (TransportFault), so the key it
|
||||
@@ -184,7 +188,7 @@ func (k Asker) Put(ctx context.Context, a buildstep.StepAsk) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
subject, err := buildstep.AskSubjectBy(a.Language, a.Kind, buildstep.AskerBuilder)
|
||||
subject, err := buildstep.AskSubjectBy(a.Language, a.Kind, cmp.Or(k.Name, buildstep.AskerBuilder))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -44,6 +44,11 @@ func TestAnAskerPutsOnceAndReadsTheStep(t *testing.T) {
|
||||
if len(subjects.seen) != 1 || subjects.seen[0] != "mesh.seat.node-build-go.accept."+goAsk("x").Kind+".builder" {
|
||||
t.Fatalf("the ask was put on %v", subjects.seen)
|
||||
}
|
||||
// A-248: an asker that names itself puts under its own name.
|
||||
byName := Asker{Name: "indexer", Seats: testSeats(), Publisher: subjects, Waiter: f}
|
||||
if err := byName.Put(context.Background(), goAsk("mvl0frv18d1959")); err != nil || subjects.seen[len(subjects.seen)-1] != "mesh.seat.node-build-go.accept."+goAsk("x").Kind+".indexer" {
|
||||
t.Fatalf("a named asker put on %v (%v)", subjects.seen, err)
|
||||
}
|
||||
f.Answer = func(a buildstep.StepAsk) buildstep.Step {
|
||||
return buildstep.Step{ID: a.ID, Node: "shanks", State: buildstep.StepRefused, Reason: "go 1.27 installed"}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user