mesh-knowledge: the overview's delivery block and the progress verb's groups lines go
Review round 1, Must 3: the groups and group-ended are retired; the overview showed the deliveries, another module's state, which the status view owns. The overview keeps two sources (the tracker, the asks), consumes no merge, transition or pipeline's end, and the progress verb asks no groups. Builds: design 47 H §764 (the gate's verb groups; the runner's group-ended); H-A-28; H-A-125 Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
This commit is contained in:
@@ -3,12 +3,12 @@ package main
|
||||
// progress: how far a design, a milestone, an issue or a record has come, in one call (novox/hq issue 1947). The
|
||||
// knowledge base works a design's state out and nobody writes it (ADR 0424 §1, §2); this verb says it at every
|
||||
// level, in two forms: minimal, one line per child, cheap enough for every five minutes; detailed, the tree of a
|
||||
// lead's report with the pull requests, the held groups and what waits on whom, for about every thirty.
|
||||
// lead's report with the pull requests and what waits on whom, for about every thirty.
|
||||
//
|
||||
// It keeps no state of its own. It reads, each a request and reply over the bus: the designs' titles and states through
|
||||
// the records module (design.go, cached by hq's commit), their milestones from the issue tracker (milestones.go,
|
||||
// issue 1781), the issues from the issue tracker (`issue-tracker.list`, whose rows
|
||||
// say each issue's delivery and when it last moved), and the deliveries and groups from mesh-delivery.
|
||||
// say each issue's delivery and when it last moved), and the deliveries from mesh-delivery. It reads no groups: they went (design 47 H §764, H-A-125).
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
@@ -112,19 +112,10 @@ type deliveryRow struct {
|
||||
State string `json:"state"`
|
||||
Since time.Time `json:"since"`
|
||||
Waits string `json:"waits"`
|
||||
Group string `json:"group"`
|
||||
Issues []int `json:"-"`
|
||||
Title string `json:"-"`
|
||||
}
|
||||
|
||||
// groupRow is a row of `mesh-delivery.groups`.
|
||||
type groupRow struct {
|
||||
ID string `json:"id"`
|
||||
State string `json:"state"`
|
||||
Why string `json:"why"`
|
||||
Members []string `json:"members"`
|
||||
}
|
||||
|
||||
var (
|
||||
designOf = regexp.MustCompile(`^design\s+([0-9]{1,3})$`)
|
||||
milestoneOf = regexp.MustCompile(`(?i)^milestone\s+([0-9]{1,3})/(.+)$`)
|
||||
@@ -596,11 +587,10 @@ func (k *KB) progressRecord(p *Progress, kind string, n int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// extras is what a detailed answer reads beyond the rows: the open deliveries with their issues, the groups, and
|
||||
// extras is what a detailed answer reads beyond the rows: the open deliveries with their issues, and
|
||||
// each issue not done read whole.
|
||||
type extras struct {
|
||||
deliveries []deliveryRow
|
||||
groups map[string]groupRow
|
||||
gets map[int]*issueGot
|
||||
warnings []string
|
||||
}
|
||||
@@ -616,9 +606,9 @@ func final(state string) bool {
|
||||
return state == "merged" || state == "closed" || state == "delivered"
|
||||
}
|
||||
|
||||
// readExtras reads the deliveries not final with the issues each names, the groups, and the issues not done.
|
||||
// readExtras reads the deliveries not final with the issues each names, and the issues not done.
|
||||
func (k *KB) readExtras(items []Item) (*extras, error) {
|
||||
x := &extras{groups: map[string]groupRow{}, gets: map[int]*issueGot{}}
|
||||
x := &extras{gets: map[int]*issueGot{}}
|
||||
raw, err := k.Seats("seat:mesh-delivery.deliveries", map[string]any{})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("mesh-delivery does not answer: %v", err)
|
||||
@@ -656,17 +646,6 @@ func (k *KB) readExtras(items []Item) (*extras, error) {
|
||||
d.Issues, d.Title = s.Delivery.Issues, s.Delivery.Title
|
||||
x.deliveries = append(x.deliveries, d)
|
||||
}
|
||||
raw, err = k.Seats("seat:mesh-delivery.groups", map[string]any{})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("mesh-delivery does not answer: %v", err)
|
||||
}
|
||||
var gs []groupRow
|
||||
if err := json.Unmarshal(raw, &gs); err != nil {
|
||||
return nil, fmt.Errorf("mesh-delivery.groups answered something else: %v", err)
|
||||
}
|
||||
for _, g := range gs {
|
||||
x.groups[g.ID] = g
|
||||
}
|
||||
got := 0
|
||||
for _, m := range items {
|
||||
for _, c := range m.Children {
|
||||
@@ -716,13 +695,12 @@ func (k *KB) readExtras(items []Item) (*extras, error) {
|
||||
return x, nil
|
||||
}
|
||||
|
||||
// pullLines is one line per open delivery naming issue n, and per group it is in.
|
||||
// pullLines is one line per open delivery naming issue n.
|
||||
func (x *extras) pullLines(n int) []string {
|
||||
if x == nil {
|
||||
return nil
|
||||
}
|
||||
var out []string
|
||||
groups := map[string]bool{}
|
||||
for _, d := range x.deliveries {
|
||||
named := false
|
||||
for _, i := range d.Issues {
|
||||
@@ -744,31 +722,12 @@ func (x *extras) pullLines(n int) []string {
|
||||
line += ", waits for " + d.Waits
|
||||
}
|
||||
out = append(out, line)
|
||||
if d.Group != "" {
|
||||
groups[d.Group] = true
|
||||
}
|
||||
}
|
||||
var gids []string
|
||||
for g := range groups {
|
||||
gids = append(gids, g)
|
||||
}
|
||||
sort.Strings(gids)
|
||||
for _, id := range gids {
|
||||
g, ok := x.groups[id]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
mark := marks[StateMoving]
|
||||
if g.State == "held" {
|
||||
mark = marks[StateStuck]
|
||||
}
|
||||
out = append(out, fmt.Sprintf("%s group %s %s: %s", mark, g.ID, g.State, g.Why))
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// renderTree draws a design's or a milestone's tree: minimal, one line per milestone with the done ones folded into
|
||||
// one line; detailed, each milestone not done with its issues, their pull requests and groups.
|
||||
// one line; detailed, each milestone not done with its issues, their pull requests.
|
||||
func renderTree(top Item, detail string, x *extras, oneMilestone bool) string {
|
||||
var b strings.Builder
|
||||
if oneMilestone {
|
||||
@@ -815,7 +774,7 @@ func renderTree(top Item, detail string, x *extras, oneMilestone bool) string {
|
||||
}
|
||||
|
||||
// writeIssues draws a milestone's issues: minimal, those not done; detailed, every issue, and under each not done
|
||||
// its pull requests, groups and what it depends on.
|
||||
// its pull requests and what it depends on.
|
||||
func writeIssues(b *strings.Builder, indent string, kids []Item, detail string, x *extras) {
|
||||
var show []Item
|
||||
for _, c := range kids {
|
||||
|
||||
Reference in New Issue
Block a user