Answer the build queue as data too, so a check can say how far back it waits
mesh/merge-gate pass: builds build-agent, mesh-controller → ace, g14, novox, shanks; no bus step; every machine composes with the change as it did without …
mesh/repo-check pass: its merge-check.sh passed
mesh/delivery delivered

The queue verb answered only a table, so nothing outside the controller
could say an ask's place in the queue. It now asks its command for JSON:
each ask's state, kind, repository, commit, machine, since and position
among the waiting, with the table carried beside it and answered as the
verb's output, both written from one read. A repository's password, if
one were ever written into it, is left out of what is shown.

novox/hq issue 455
This commit is contained in:
2026-10-12 14:22:22 +02:00
parent db9e9c5b87
commit 0cd8bc0bfb
7 changed files with 264 additions and 8 deletions
+16 -2
View File
@@ -426,7 +426,8 @@ func (a *verbArguments) commandLine() ([]string, error) {
return argv, nil
// The build queue (novox/hq ADR 0219).
case "queue":
return []string{"queue"}, nil
// As data, the table its output (novox/hq issue 455).
return []string{"queue", "--json"}, nil
case "cancel", "kill":
if err := need("id"); err != nil {
return nil, err
@@ -977,7 +978,14 @@ var jsonVerbs = map[string]bool{"status": true, "seats": true, "plan": true, "co
// What the records say the registries may keep (novox/hq ADR 0251).
"artifacts": true, "collect": true, "images": true, "mirrors": true,
// The delivery's owner's verbs answer JSON where they read (plan, order, check, walks) — novox/hq ADR 0239.
"delivery": true}
"delivery": true,
// The build queue, each ask with its position among the waiting (novox/hq issue 455).
"queue": true}
// tableBesideVerbs are the JSON verbs whose document carries the table a person reads as its `text`: the
// verb answers that table as its output, as it did before it answered data, and the rest as `answer` —
// both from the one read, so they never disagree (novox/hq issue 455).
var tableBesideVerbs = map[string]bool{"queue": true}
// overviewVerbs are the JSON verbs whose answer is said once, as data, and not again as the text the
// command printed: the overviews, which grow with the mesh (novox/hq issue 314). Every reader of theirs
@@ -1097,6 +1105,12 @@ func answerOf(argv []string, stdout []byte, stderr string, ok bool) verbAnswer {
var parsed any
if json.Unmarshal(bytes.TrimSpace(stdout), &parsed) == nil {
answer.Answer = parsed
if doc, isDoc := parsed.(map[string]any); isDoc && tableBesideVerbs[argv[0]] {
if table, said := doc["text"].(string); said {
answer.Output = table + stderr
delete(doc, "text")
}
}
if overviewVerbs[argv[0]] {
// Once, as data: the same document again as text doubled an answer that already
// outgrew one message of the bus (novox/hq issue 314).