@plot-pm/board 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/board-server.mjs +218 -202
- package/package.json +1 -1
- package/plot-config.sh +25 -12
- package/plot-dispatch.sh +57 -203
- package/plot-fleet-scan.sh +15 -24
- package/plot-host.sh +733 -309
- package/plot-plan-meta.sh +201 -148
- package/plot-pr-merged.sh +10 -13
- package/plot-state-receipt.sh +10 -10
- package/plot-tmp.sh +1 -3
- package/plot-worker-state.sh +102 -79
package/plot-plan-meta.sh
CHANGED
|
@@ -106,7 +106,8 @@
|
|
|
106
106
|
# front matter `sprint:`); "" if absent or an HTML-comment
|
|
107
107
|
# placeholder
|
|
108
108
|
# story story slug the plan belongs to (`## Status` `Story:` or
|
|
109
|
-
# front matter `story:`)
|
|
109
|
+
# front matter `story:`), reduced from Markdown link form
|
|
110
|
+
# via reduce_story_link(); "" if absent or a placeholder
|
|
110
111
|
# assignee github handle from front matter `assignee:`, else the
|
|
111
112
|
# `## Approval` `Assignee:` line, else the `## Status`
|
|
112
113
|
# `Assignee:` line; "" if absent or a placeholder
|
|
@@ -235,6 +236,13 @@
|
|
|
235
236
|
# no branch stays silent, since reporting that would fire on
|
|
236
237
|
# every such plan. A marker inside a code span is quoted, not
|
|
237
238
|
# written, and is read nowhere. ALWAYS present; [] when none.
|
|
239
|
+
# unread_heading_items
|
|
240
|
+
# `{ wave, branch }` pairs, in document order, for a heading-
|
|
241
|
+
# shape list item claiming a branch no heading in that wave
|
|
242
|
+
# carries — a report, not a refusal. A claim on its OWN
|
|
243
|
+
# heading's branch is read instead (see the heading handler).
|
|
244
|
+
# `wave` is the wave NAME, not an index. ALWAYS present; []
|
|
245
|
+
# when every such item was attributed.
|
|
238
246
|
# issues tracker issue numbers this plan answers, from the `## Status`
|
|
239
247
|
# `Issue:` line or front matter `issue:` (sorted, unique).
|
|
240
248
|
# A DEDICATED field, never a scan of the body for `#NNN`: a
|
|
@@ -329,7 +337,7 @@ if [ ${#files[@]} -eq 0 ] && [ ${#missing[@]} -eq 0 ]; then
|
|
|
329
337
|
fi
|
|
330
338
|
|
|
331
339
|
for f in ${missing[@]+"${missing[@]}"}; do
|
|
332
|
-
printf '{"file":"%s","format":"none","error":"file not found","phase_raw":"","phase":"NONE","phase_alt_raw":"","phase_alt":"NONE","type":"","title":"","sprint":"","story":"","assignee":"","branches":[],"prs":[],"deferred_prs":[],"issues":[],"ticket":"","malformed_prs":[],"changelog":[],"long_wave_names":[],"unread_branch_headings":[],"unread_waits":[],"review_raw":"","review":"NONE","impl_raw":"","impl":"NONE","design_raw":"","spike_approved_raw":"","approved_raw":"","released_raw":"","delivered_raw":"","verified_raw":"","started_raw":[]}\n' \
|
|
340
|
+
printf '{"file":"%s","format":"none","error":"file not found","phase_raw":"","phase":"NONE","phase_alt_raw":"","phase_alt":"NONE","type":"","title":"","sprint":"","story":"","assignee":"","branches":[],"prs":[],"deferred_prs":[],"issues":[],"ticket":"","malformed_prs":[],"changelog":[],"long_wave_names":[],"unread_branch_headings":[],"unread_waits":[],"unread_heading_items":[],"review_raw":"","review":"NONE","impl_raw":"","impl":"NONE","design_raw":"","spike_approved_raw":"","approved_raw":"","released_raw":"","delivered_raw":"","verified_raw":"","started_raw":[]}\n' \
|
|
333
341
|
"$(printf '%s' "$f" | sed 's/\\/\\\\/g; s/"/\\"/g')"
|
|
334
342
|
done
|
|
335
343
|
|
|
@@ -367,6 +375,22 @@ function jesc(s) {
|
|
|
367
375
|
return s
|
|
368
376
|
}
|
|
369
377
|
function trim(s) { sub(/^[ \t]+/, "", s); sub(/[ \t]+$/, "", s); return s }
|
|
378
|
+
# Inserts v into arr[1..n], kept sorted and free of duplicates, and returns the
|
|
379
|
+
# new count. A numeric v compares numerically and a string v as a string, so
|
|
380
|
+
# the caller decides the order by the type it passes. Portable: no gawk asort.
|
|
381
|
+
function sorted_insert(arr, n, v, j) {
|
|
382
|
+
for (j = 1; j <= n; j++) if (arr[j] == v) return n
|
|
383
|
+
for (j = n; j >= 1 && arr[j] > v; j--) arr[j+1] = arr[j]
|
|
384
|
+
arr[j+1] = v
|
|
385
|
+
return n + 1
|
|
386
|
+
}
|
|
387
|
+
# Renders `n` `{"k1":"...","k2":"..."}` objects, reading arr1[i]/arr2[i] for
|
|
388
|
+
# i=1..n — the shape unread_waits and unread_heading_items both emit.
|
|
389
|
+
function emit_pairs(n, k1, arr1, k2, arr2, i, out) {
|
|
390
|
+
for (i = 1; i <= n; i++)
|
|
391
|
+
out = out (i > 1 ? "," : "") "{\"" k1 "\":\"" jesc(arr1[i]) "\",\"" k2 "\":\"" jesc(arr2[i]) "\"}"
|
|
392
|
+
return out
|
|
393
|
+
}
|
|
370
394
|
# Every `<!-- waits: … -->` marker on a line, each value split on commas, in
|
|
371
395
|
# the line order with duplicates removed, written into outArr/outN (outN is
|
|
372
396
|
# outArr[0] — awk scalars are pass-by-value, so a count returned through a
|
|
@@ -422,6 +446,11 @@ function val_after_colon(s) {
|
|
|
422
446
|
}
|
|
423
447
|
# Template placeholders like "<!-- optional -->" mean "field absent".
|
|
424
448
|
function strip_placeholder(s) { return (s ~ /^<!--/) ? "" : s }
|
|
449
|
+
# A Markdown link `[text](target)` reduces to `text`, with backticks around
|
|
450
|
+
# the text removed. A malformed link ("[text](" with no close, "[]()") is not
|
|
451
|
+
# a link, so it keeps the raw value unreduced — an empty `story` means "no
|
|
452
|
+
# story", and a malformed link is not that.
|
|
453
|
+
function reduce_story_link(s, t) { if (s !~ /^\[[^]]+\]\([^)]+\)$/) return s; t = s; sub(/^\[/, "", t); sub(/\]\([^)]*\)$/, "", t); gsub(/`/, "", t); return t }
|
|
425
454
|
# Blank out backtick-delimited inline code, so a marker PRINTED as a literal is
|
|
426
455
|
# not read as syntax. Markdown renders `<!--` between backticks as the four
|
|
427
456
|
# characters; this parser used to read it as a comment-open, and because such a
|
|
@@ -521,10 +550,12 @@ function reset_state() {
|
|
|
521
550
|
delete malformed_prs; n_malformed_prs = 0
|
|
522
551
|
fm_issue = ""; canon_issue = ""; fm_ticket = ""
|
|
523
552
|
delete issues; n_issues = 0
|
|
524
|
-
delete wave_names; delete wave_of; delete
|
|
553
|
+
delete wave_names; delete wave_of; delete wave_count
|
|
525
554
|
delete deferred_of; delete deferred_why; delete claimed_of; delete ordered_b; delete spike_of; n_waves = 0
|
|
526
555
|
delete branch_heading; delete waits_of; delete waits_set; delete waits_n
|
|
527
556
|
delete unread_waits_branch; delete unread_waits_value; n_unread_waits = 0
|
|
557
|
+
delete unread_heading_item_wave; delete unread_heading_item_branch; n_unread_heading_items = 0
|
|
558
|
+
heading_branch = ""; heading_branch_n = 0
|
|
528
559
|
delete builds_of; delete agent_of; delete commits_of; delete started; n_started = 0
|
|
529
560
|
fm_changelog = ""
|
|
530
561
|
delete changelog; n_changelog = 0; changelog_seen = 0; cl_open = 0
|
|
@@ -609,43 +640,15 @@ function emit_record( fmt, praw, palt_raw, traw, title, sprint, story, assigne
|
|
|
609
640
|
issue2 = substr(issue2, RSTART + RLENGTH)
|
|
610
641
|
}
|
|
611
642
|
}
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
for (i = 1; i <= n_branches; i++) {
|
|
615
|
-
for (j = 1; j <= nb && sorted_b[j] != branches[i]; j++) ;
|
|
616
|
-
if (j <= nb) continue
|
|
617
|
-
for (j = nb; j >= 1 && sorted_b[j] > branches[i]; j--) sorted_b[j+1] = sorted_b[j]
|
|
618
|
-
sorted_b[j+1] = branches[i]; nb++
|
|
619
|
-
}
|
|
620
|
-
np = 0
|
|
621
|
-
for (i = 1; i <= n_prs; i++) {
|
|
622
|
-
for (j = 1; j <= np && sorted_p[j] != prs[i]+0; j++) ;
|
|
623
|
-
if (j <= np) continue
|
|
624
|
-
for (j = np; j >= 1 && sorted_p[j] > prs[i]+0; j--) sorted_p[j+1] = sorted_p[j]
|
|
625
|
-
sorted_p[j+1] = prs[i]+0; np++
|
|
626
|
-
}
|
|
643
|
+
nb = 0; for (i = 1; i <= n_branches; i++) nb = sorted_insert(sorted_b, nb, branches[i])
|
|
644
|
+
np = 0; for (i = 1; i <= n_prs; i++) np = sorted_insert(sorted_p, np, prs[i] + 0)
|
|
627
645
|
# Issues: sort numeric (GitHub) issues first, then string (Jira) keys.
|
|
628
646
|
# Separate into two arrays, sort each, then concatenate.
|
|
629
647
|
n_num_i = 0; n_str_i = 0
|
|
630
648
|
for (i = 1; i <= n_issues; i++) {
|
|
631
649
|
v = issues[i]
|
|
632
|
-
if (v ~ /^[0-9]+$/)
|
|
633
|
-
|
|
634
|
-
is_dup = 0
|
|
635
|
-
for (j = 1; j <= n_num_i; j++) if (num_issues[j] == v + 0) { is_dup = 1; break }
|
|
636
|
-
if (!is_dup) {
|
|
637
|
-
for (j = n_num_i; j >= 1 && num_issues[j] > v + 0; j--) num_issues[j+1] = num_issues[j]
|
|
638
|
-
num_issues[j+1] = v + 0; n_num_i++
|
|
639
|
-
}
|
|
640
|
-
} else {
|
|
641
|
-
# String (Jira key): check for duplicate, then insert sorted.
|
|
642
|
-
is_dup = 0
|
|
643
|
-
for (j = 1; j <= n_str_i; j++) if (str_issues[j] == v) { is_dup = 1; break }
|
|
644
|
-
if (!is_dup) {
|
|
645
|
-
for (j = n_str_i; j >= 1 && str_issues[j] > v; j--) str_issues[j+1] = str_issues[j]
|
|
646
|
-
str_issues[j+1] = v; n_str_i++
|
|
647
|
-
}
|
|
648
|
-
}
|
|
650
|
+
if (v ~ /^[0-9]+$/) n_num_i = sorted_insert(num_issues, n_num_i, v + 0)
|
|
651
|
+
else n_str_i = sorted_insert(str_issues, n_str_i, v "")
|
|
649
652
|
}
|
|
650
653
|
# Concatenate: numeric first, then string (matches the field ordering the
|
|
651
654
|
# board expects — GitHub issues before Jira keys when both are present).
|
|
@@ -773,12 +776,8 @@ function emit_record( fmt, praw, palt_raw, traw, title, sprint, story, assigne
|
|
|
773
776
|
# report, not a refusal. Filled by store_waits() as each branch is matched;
|
|
774
777
|
# a `waits:` syntax example on a PROSE line (no branch claim) never reaches
|
|
775
778
|
# store_waits(), so it stays silent, as today.
|
|
776
|
-
out = out ",\"unread_waits\":["
|
|
777
|
-
|
|
778
|
-
out = out (i > 1 ? "," : "") "{\"branch\":\"" jesc(unread_waits_branch[i]) "\"" \
|
|
779
|
-
",\"value\":\"" jesc(unread_waits_value[i]) "\"}"
|
|
780
|
-
}
|
|
781
|
-
out = out "]"
|
|
779
|
+
out = out ",\"unread_waits\":[" emit_pairs(n_unread_waits, "branch", unread_waits_branch, "value", unread_waits_value) "]"
|
|
780
|
+
out = out ",\"unread_heading_items\":[" emit_pairs(n_unread_heading_items, "wave", unread_heading_item_wave, "branch", unread_heading_item_branch) "]"
|
|
782
781
|
out = out ",\"review_raw\":\"" jesc(review) "\",\"review\":\"" norm_review(review) "\""
|
|
783
782
|
out = out ",\"impl_raw\":\"" jesc(impl) "\",\"impl\":\"" norm_impl(impl) "\""
|
|
784
783
|
out = out ",\"design_raw\":\"" jesc(design) "\""
|
|
@@ -821,9 +820,16 @@ function note_branch_heading( h) {
|
|
|
821
820
|
# slice dialects at the moment each claims a branch, so a `waits:` syntax
|
|
822
821
|
# example on a line with NO branch claim never drains the queue and stays
|
|
823
822
|
# silent — the same rule the old single-value reading followed.
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
823
|
+
#
|
|
824
|
+
# OVERLAY (a heading-shape list item naming the branch of its heading) keeps what
|
|
825
|
+
# the heading stored and adds the values of this line it lacks: the union, so a
|
|
826
|
+
# prerequisite on either line holds the slice. The unread values drain either way.
|
|
827
|
+
function store_waits(n, b, overlay, k, j, dup) {
|
|
828
|
+
if (!overlay) waits_n[n] = 0
|
|
829
|
+
for (k = 1; k <= line_waits[0]; k++) {
|
|
830
|
+
dup = 0; for (j = 1; j <= waits_n[n]; j++) if (waits_of[n, j] == line_waits[k]) dup = 1
|
|
831
|
+
if (!dup) waits_of[n, ++waits_n[n]] = line_waits[k]
|
|
832
|
+
}
|
|
827
833
|
waits_set[n] = (waits_n[n] > 0) ? 1 : 0
|
|
828
834
|
for (k = 1; k <= pending_unread_n; k++) {
|
|
829
835
|
unread_waits_branch[++n_unread_waits] = b
|
|
@@ -963,41 +969,71 @@ function commit_list(s, out, m, h) {
|
|
|
963
969
|
h = "[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]+"
|
|
964
970
|
while (match(s, "→ (commit " h "(, ?" h ")*|[A-Za-z0-9._-]+/[A-Za-z0-9._-]+@" h ")")) {
|
|
965
971
|
m = substr(s, RSTART, RLENGTH); s = substr(s, RSTART + RLENGTH)
|
|
966
|
-
sub(/^→ (commit )?/, "", m); gsub(/, ?/, ",", m)
|
|
967
|
-
out = out (out == "" ? "" : ",") m
|
|
972
|
+
sub(/^→ (commit )?/, "", m); gsub(/, ?/, ",", m); out = out (out == "" ? "" : ",") m
|
|
968
973
|
}
|
|
969
974
|
return out
|
|
970
975
|
}
|
|
971
976
|
# Stores the annotations read_notes() found, and the commits the line names,
|
|
972
|
-
# against branch n (named b)
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
977
|
+
# against branch n (named b).
|
|
978
|
+
#
|
|
979
|
+
# OVERLAY decides whether a field this line does NOT carry erases what is
|
|
980
|
+
# already stored. False (the old list shape, and a heading line itself): this
|
|
981
|
+
# is the first and only line that can claim n, so every field is written
|
|
982
|
+
# outright -- unconditionally false reads as "false", not "unknown". True (a
|
|
983
|
+
# heading-shape list item naming the branch its heading already claimed): the
|
|
984
|
+
# heading line claimed n first via read_notes() on itself, so only a field
|
|
985
|
+
# THIS line carries may overwrite -- a deferral reason written on the heading
|
|
986
|
+
# must survive a list item that carries none of its own.
|
|
987
|
+
function keep_branch(n, b, overlay, is_deferred, c, parts, j, m) {
|
|
988
|
+
is_deferred = ($0 ~ /<!--[ \t]*(deferred|moved)[ \t]*(:|-->)/)
|
|
989
|
+
# THE FLAG accepts the bare form as well as the annotated one: `deferred:`
|
|
990
|
+
# and the bare `<!-- deferred -->` both set it true. The reason travels with
|
|
991
|
+
# the flag, empty for a non-deferred branch and equally empty for a bare
|
|
992
|
+
# marker with no reason recorded — a different statement from a reason of
|
|
993
|
+
# "". In OVERLAY mode a bare list-item marker must not blank a reason the
|
|
994
|
+
# heading already wrote: the flag is set whenever this line claims
|
|
995
|
+
# deferred, but the reason is overwritten only when this line carries one.
|
|
996
|
+
if (!overlay || is_deferred) deferred_of[n] = is_deferred ? "true" : "false"
|
|
997
|
+
if (!overlay || defer_note != "") deferred_why[n] = defer_note
|
|
998
|
+
if (!overlay || $0 ~ /<!--[ \t]*spike[ \t]*-->/) spike_of[n] = ($0 ~ /<!--[ \t]*spike[ \t]*-->/) ? 1 : 0
|
|
999
|
+
# Claim reflection, written by the worker after its ref push succeeds. This
|
|
1000
|
+
# is a reflection, not the claim: git refs remain authoritative.
|
|
1001
|
+
if (!overlay || claim_note != "") claimed_of[n] = claim_note
|
|
1002
|
+
# The prerequisites travel with the branch, flattened as waits_of[n,1..k]
|
|
1003
|
+
# since this awk has no nested arrays. Presence is tracked separately so a
|
|
1004
|
+
# branch that declares none emits no key.
|
|
1005
|
+
store_waits(n, b, overlay)
|
|
1006
|
+
if (!overlay || builds_note != "") builds_of[n] = builds_note
|
|
1007
|
+
# The kind travels with the branch, presence tracked separately so a slice
|
|
1008
|
+
# declaring none emits no key.
|
|
1009
|
+
if (!overlay || agent_note != "") agent_of[n] = agent_note
|
|
1010
|
+
ordered_b[n] = b
|
|
1011
|
+
# Commits merge like waits: a list item adds its own to those of the heading,
|
|
1012
|
+
# minus any ref both lines already name, in first-seen order.
|
|
1013
|
+
c = commit_list($0)
|
|
1014
|
+
if (overlay && commits_of[n] != "") { m = split(c, parts, ","); for (j = 1; j <= m; j++) if (parts[j] != "" && index("," commits_of[n] ",", "," parts[j] ",") == 0) commits_of[n] = commits_of[n] "," parts[j] } else commits_of[n] = c
|
|
1015
|
+
}
|
|
1016
|
+
# `→ #N` and `→ owner/repo#N` are both annotations: /plot-deliver instructs
|
|
1017
|
+
# implementers to write the second for `Impl: other repo` plans, and a parser
|
|
1018
|
+
# that dropped it reported `prs: []` for a plan whose only PR was written
|
|
1019
|
+
# exactly as documented. The repo part is matched but not retained — callers
|
|
1020
|
+
# ask which PRs are the evidence, and plot-host.sh resolves where each lives.
|
|
1021
|
+
# A near-miss is REPORTED, never silently dropped. `→#44` (no space) is the
|
|
1022
|
+
# obvious hand-typo, and treating it as absence makes the sweep advise adding
|
|
1023
|
+
# an annotation the plan already carries. Accepting it would widen the
|
|
1024
|
+
# contract on a guess; reporting it leaves the judgement with a person.
|
|
1025
|
+
#
|
|
1026
|
+
# DEFER (optional) files every PR on this line as deferred: a heading-shape list
|
|
1027
|
+
# item passes the deferral of its branch, which the heading line may carry alone.
|
|
1028
|
+
function extract_prs(raw, defer, line, p) {
|
|
1029
|
+
line = raw
|
|
1030
|
+
while (match(line, /→ ([A-Za-z0-9._-]+\/[A-Za-z0-9._-]+)?#[0-9]+/)) {
|
|
1031
|
+
p = substr(line, RSTART, RLENGTH); sub(/^.*#/, "", p)
|
|
1032
|
+
prs[++n_prs] = p; if (defer || raw ~ /<!--[ \t]*(deferred|moved)[ \t]*(:|-->)/) dprs[++n_dprs] = p
|
|
1033
|
+
line = substr(line, RSTART + RLENGTH)
|
|
1034
|
+
}
|
|
1035
|
+
line = raw
|
|
1036
|
+
while (match(line, /→#[0-9]+/)) { malformed_prs[++n_malformed_prs] = substr(line, RSTART, RLENGTH); line = substr(line, RSTART + RLENGTH) }
|
|
1001
1037
|
}
|
|
1002
1038
|
# The longest wave name that still reads as a label, not prose. A JUDGEMENT, not
|
|
1003
1039
|
# a measurement: the longest legitimate name in the estate is `Offered first`
|
|
@@ -1038,7 +1074,7 @@ in_fm {
|
|
|
1038
1074
|
else if (lower ~ /^type:/ && fm_type == "") fm_type = val_after_colon($0)
|
|
1039
1075
|
else if (lower ~ /^title:/ && fm_title == "") fm_title = val_after_colon($0)
|
|
1040
1076
|
else if (lower ~ /^sprint:/ && fm_sprint == "") fm_sprint = val_after_colon($0)
|
|
1041
|
-
else if (lower ~ /^story:/ && fm_story == "") fm_story = val_after_colon($0)
|
|
1077
|
+
else if (lower ~ /^story:/ && fm_story == "") fm_story = reduce_story_link(val_after_colon($0))
|
|
1042
1078
|
else if (lower ~ /^issue:/ && fm_issue == "") fm_issue = val_after_colon($0)
|
|
1043
1079
|
else if (lower ~ /^ticket:/ && fm_ticket == "") fm_ticket = val_after_colon($0)
|
|
1044
1080
|
else if (lower ~ /^assignee:/ && fm_assignee == "") fm_assignee = val_after_colon($0)
|
|
@@ -1153,7 +1189,7 @@ section == "status" {
|
|
|
1153
1189
|
else if (lower ~ /^[ \t]*[-*]?[ \t]*\**phase[:*]/ && canon_phase == "") canon_phase = val_after_colon($0)
|
|
1154
1190
|
else if (lower ~ /^[ \t]*[-*]?[ \t]*\**type[:*]/ && canon_type == "") canon_type = val_after_colon($0)
|
|
1155
1191
|
else if (lower ~ /^[ \t]*[-*]?[ \t]*\**sprint[:*]/ && canon_sprint == "") canon_sprint = val_after_colon($0)
|
|
1156
|
-
else if (lower ~ /^[ \t]*[-*]?[ \t]*\**story[:*]/ && canon_story == "") canon_story = val_after_colon($0)
|
|
1192
|
+
else if (lower ~ /^[ \t]*[-*]?[ \t]*\**story[:*]/ && canon_story == "") canon_story = reduce_story_link(val_after_colon($0))
|
|
1157
1193
|
else if (lower ~ /^[ \t]*[-*]?[ \t]*\**issue[:*]/ && canon_issue == "") canon_issue = val_after_colon($0)
|
|
1158
1194
|
else if (lower ~ /^[ \t]*[-*]?[ \t]*\**review[:*]/ && canon_review == "") canon_review = val_after_colon($0)
|
|
1159
1195
|
else if (lower ~ /^[ \t]*[-*]?[ \t]*\**impl[:*]/ && canon_impl == "") canon_impl = val_after_colon($0)
|
|
@@ -1290,31 +1326,10 @@ section == "slices" && slice_shape != "heading" {
|
|
|
1290
1326
|
sub(/`$/, "", b)
|
|
1291
1327
|
branches[++n_branches] = b
|
|
1292
1328
|
if (n_waves == 0) { wave_names[++n_waves] = "" }
|
|
1293
|
-
wave_of[n_branches] = n_waves
|
|
1294
|
-
|
|
1295
|
-
keep_branch(n_branches, b)
|
|
1296
|
-
}
|
|
1297
|
-
line = $0
|
|
1298
|
-
# `→ #N` and `→ owner/repo#N` are both annotations: /plot-deliver instructs
|
|
1299
|
-
# implementers to write the second for `Impl: other repo` plans, and a parser
|
|
1300
|
-
# that dropped it reported `prs: []` for a plan whose only PR was written
|
|
1301
|
-
# exactly as documented. The repo part is matched but not retained — callers
|
|
1302
|
-
# ask which PRs are the evidence, and plot-host.sh resolves where each lives.
|
|
1303
|
-
while (match(line, /→ ([A-Za-z0-9._-]+\/[A-Za-z0-9._-]+)?#[0-9]+/)) {
|
|
1304
|
-
p = substr(line, RSTART, RLENGTH)
|
|
1305
|
-
sub(/^.*#/, "", p)
|
|
1306
|
-
prs[++n_prs] = p; if ($0 ~ /<!--[ \t]*(deferred|moved)[ \t]*(:|-->)/) dprs[++n_dprs] = p
|
|
1307
|
-
line = substr(line, RSTART + RLENGTH)
|
|
1308
|
-
}
|
|
1309
|
-
# A near-miss is REPORTED, never silently dropped. `→#44` (no space) is the
|
|
1310
|
-
# obvious hand-typo, and treating it as absence makes the sweep advise adding
|
|
1311
|
-
# an annotation the plan already carries. Accepting it would widen the
|
|
1312
|
-
# contract on a guess; reporting it leaves the judgement with a person.
|
|
1313
|
-
line = $0
|
|
1314
|
-
while (match(line, /→#[0-9]+/)) {
|
|
1315
|
-
malformed_prs[++n_malformed_prs] = substr(line, RSTART, RLENGTH)
|
|
1316
|
-
line = substr(line, RSTART + RLENGTH)
|
|
1329
|
+
wave_of[n_branches] = n_waves; ++wave_count[n_waves]
|
|
1330
|
+
keep_branch(n_branches, b, 0)
|
|
1317
1331
|
}
|
|
1332
|
+
extract_prs($0)
|
|
1318
1333
|
next
|
|
1319
1334
|
}
|
|
1320
1335
|
# `## Waves` — the new spelling. The `### ` heading carries the meta (which
|
|
@@ -1327,58 +1342,96 @@ section == "slices" && slice_shape != "heading" {
|
|
|
1327
1342
|
# old shape produces for the same plan. So this shares every accumulation
|
|
1328
1343
|
# variable with the branches handler above; only the EXTRACTION differs.
|
|
1329
1344
|
section == "slices" && slice_shape == "heading" {
|
|
1330
|
-
#
|
|
1331
|
-
#
|
|
1332
|
-
|
|
1345
|
+
# A `### ` heading carries meta, as before. Below it, ONE line is no longer
|
|
1346
|
+
# prose-only: a list item that is a LIST CLAIM (branch_claim_re, the same
|
|
1347
|
+
# anchor the old shape uses) and names the branch this heading just claimed
|
|
1348
|
+
# is read for its `→ #N` and its annotations — see below. Every other line,
|
|
1349
|
+
# including a list item naming a DIFFERENT branch, stays prose.
|
|
1350
|
+
if ($0 ~ /^###[ \t]/) {
|
|
1351
|
+
# A heading opens a wave whose NAME is the heading text with the
|
|
1352
|
+
# `(Branch: …, PR: …)` parenthetical and any trailing annotation stripped, so
|
|
1353
|
+
# `### Removed (Branch: bug/foo, PR: #300)` names the wave `Removed` — exactly
|
|
1354
|
+
# what the old shape (bare `### Removed`) produced, which is what keeps the two
|
|
1355
|
+
# spellings byte-identical.
|
|
1356
|
+
wname = trim(substr($0, 4))
|
|
1357
|
+
# Drop a trailing HTML comment (claimed/deferred ride the heading line now).
|
|
1358
|
+
sub(/[ \t]*<!--.*$/, "", wname)
|
|
1359
|
+
# Drop the `(Branch: …)` meta parenthetical. Anchored to `(Branch:` so a
|
|
1360
|
+
# parenthetical in a genuine wave name — none exist, but the grammar must not
|
|
1361
|
+
# assume it — is not eaten unless it is the meta block.
|
|
1362
|
+
sub(/[ \t]*\(Branch:.*$/, "", wname)
|
|
1363
|
+
wname = trim(wname)
|
|
1364
|
+
wave_names[++n_waves] = wname
|
|
1365
|
+
note_branch_heading()
|
|
1333
1366
|
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
# `### Removed (Branch: bug/foo, PR: #300)` names the wave `Removed` — exactly
|
|
1337
|
-
# what the old shape (bare `### Removed`) produced, which is what keeps the two
|
|
1338
|
-
# spellings byte-identical.
|
|
1339
|
-
wname = trim(substr($0, 4))
|
|
1340
|
-
# Drop a trailing HTML comment (claimed/deferred ride the heading line now).
|
|
1341
|
-
sub(/[ \t]*<!--.*$/, "", wname)
|
|
1342
|
-
# Drop the `(Branch: …)` meta parenthetical. Anchored to `(Branch:` so a
|
|
1343
|
-
# parenthetical in a genuine wave name — none exist, but the grammar must not
|
|
1344
|
-
# assume it — is not eaten unless it is the meta block.
|
|
1345
|
-
sub(/[ \t]*\(Branch:.*$/, "", wname)
|
|
1346
|
-
wname = trim(wname)
|
|
1347
|
-
wave_names[++n_waves] = wname
|
|
1348
|
-
note_branch_heading()
|
|
1367
|
+
# Annotations bind to the line carrying the branch name, which is the heading.
|
|
1368
|
+
read_notes()
|
|
1349
1369
|
|
|
1350
|
-
|
|
1351
|
-
|
|
1370
|
+
# The branch this heading just claimed, so a list item below can be
|
|
1371
|
+
# matched against it. "" until a branch is read below, so a heading with
|
|
1372
|
+
# no readable branch claims nothing for any list item that follows.
|
|
1373
|
+
heading_branch = ""; heading_branch_n = 0; heading_pr = ""
|
|
1352
1374
|
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1375
|
+
# The branch is the `Branch:` value, matched against the known prefixes exactly
|
|
1376
|
+
# as the old shape matched the backticked name. Written unquoted in the heading
|
|
1377
|
+
# (`Branch: bug/foo`), so the match is on a bare token, not on backticks. A
|
|
1378
|
+
# heading with no readable branch still opened a wave above — so a `## Waves`
|
|
1379
|
+
# section is never silently empty, which is the failure this plan refuses: a
|
|
1380
|
+
# consumer sees a wave it could not extract a branch from, not an absence.
|
|
1381
|
+
#
|
|
1382
|
+
# THE VALUE MAY BE BACKTICKED. `(Branch: \`bug/foo\`)` is unambiguous, and a
|
|
1383
|
+
# backtick between `Branch:` and the prefix made the anchored match fail, so
|
|
1384
|
+
# the heading opened a wave and yielded nothing. The backticks are optional on
|
|
1385
|
+
# both sides and stripped from the name. Measured 2026-09-28 over 357 plans:
|
|
1386
|
+
# 2 records change, 355 byte-identical.
|
|
1387
|
+
if (match($0, "Branch:[ \t]*`?(" PREFIXES ")/[^ \t,)`]+`?")) {
|
|
1388
|
+
b = substr($0, RSTART, RLENGTH)
|
|
1389
|
+
sub(/^Branch:[ \t]*/, "", b)
|
|
1390
|
+
gsub(/`/, "", b)
|
|
1391
|
+
branches[++n_branches] = b
|
|
1392
|
+
wave_of[n_branches] = n_waves; ++wave_count[n_waves]
|
|
1393
|
+
keep_branch(n_branches, b, 0)
|
|
1394
|
+
heading_branch = b; heading_branch_n = n_branches
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
# The PR is the `PR: #NNN` value in the heading. Absent PR: contributes
|
|
1398
|
+
# nothing — not "", not 0 — the same rule `Issue:` follows. Only a heading
|
|
1399
|
+
# that carries the field adds to prs.
|
|
1400
|
+
if (match($0, /PR:[ \t]*#[0-9]+/)) {
|
|
1401
|
+
p = substr($0, RSTART, RLENGTH)
|
|
1402
|
+
sub(/^.*#/, "", p)
|
|
1403
|
+
prs[++n_prs] = heading_pr = p; if ($0 ~ /<!--[ \t]*(deferred|moved)[ \t]*(:|-->)/) dprs[++n_dprs] = p
|
|
1404
|
+
}
|
|
1405
|
+
next
|
|
1373
1406
|
}
|
|
1374
1407
|
|
|
1375
|
-
#
|
|
1376
|
-
#
|
|
1377
|
-
# that
|
|
1378
|
-
if (match($0,
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1408
|
+
# A LIST CLAIM below the heading — same anchor as the old shape
|
|
1409
|
+
# (`branch_claim_re`), so a backticked name in prose stays unread exactly as
|
|
1410
|
+
# it always has. Only a line that IS the claim form is even considered.
|
|
1411
|
+
if (match($0, branch_claim_re)) {
|
|
1412
|
+
claim = substr($0, RSTART, RLENGTH)
|
|
1413
|
+
item_branch = substr(claim, index(claim, "`") + 1)
|
|
1414
|
+
sub(/`$/, "", item_branch)
|
|
1415
|
+
if (heading_branch != "" && item_branch == heading_branch) {
|
|
1416
|
+
# Names the branch the heading above already claimed: its `→ #N` and its
|
|
1417
|
+
# annotations belong to that branch. read_notes() reads $0 (this line), so
|
|
1418
|
+
# a list item marker is read IN ADDITION TO a heading marker, never
|
|
1419
|
+
# instead of it — the overlay=1 arm of keep_branch then leaves a field
|
|
1420
|
+
# this line does not carry (a deferral reason written on the `### `
|
|
1421
|
+
# line, say) exactly as the heading already stored it.
|
|
1422
|
+
# Deferral is decided per BRANCH once both lines are read: a deferral on
|
|
1423
|
+
# either line files the PR of the heading and the PRs of this line as deferred.
|
|
1424
|
+
was_deferred = deferred_of[heading_branch_n]
|
|
1425
|
+
read_notes()
|
|
1426
|
+
keep_branch(heading_branch_n, heading_branch, 1)
|
|
1427
|
+
if (was_deferred != "true" && deferred_of[heading_branch_n] == "true" && heading_pr != "") dprs[++n_dprs] = heading_pr
|
|
1428
|
+
extract_prs($0, deferred_of[heading_branch_n] == "true")
|
|
1429
|
+
} else {
|
|
1430
|
+
# Names a branch no heading in this wave claims (or there is no current
|
|
1431
|
+
# heading branch at all) — the parser cannot attribute it, so it is
|
|
1432
|
+
# reported rather than silently dropped and never read as a second claim.
|
|
1433
|
+
unread_heading_item_wave[++n_unread_heading_items] = wave_names[n_waves]; unread_heading_item_branch[n_unread_heading_items] = item_branch
|
|
1434
|
+
}
|
|
1382
1435
|
}
|
|
1383
1436
|
next
|
|
1384
1437
|
}
|
package/plot-pr-merged.sh
CHANGED
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
# `not-merged` → `none`, `unknown` or a non-zero exit → `unaskable`.
|
|
48
48
|
#
|
|
49
49
|
# `_plot_open_lookup` asks `pr-list --state open --branch <br>` and reads its
|
|
50
|
-
# rows for one whose `head` equals the branch asked about.
|
|
51
|
-
#
|
|
52
|
-
#
|
|
50
|
+
# rows for one whose `head` equals the branch asked about. `--branch` narrows
|
|
51
|
+
# the Bitbucket arm to a per-branch sweep and the GitHub arm to `gh pr list
|
|
52
|
+
# --head <br>`, so neither answers from a slice of a repository-wide page. A page
|
|
53
53
|
# `plot-host.sh` could not prove complete says so on stderr
|
|
54
54
|
# ("possibly truncated") — a caller that read `none` past that warning could
|
|
55
55
|
# miss its own branch's open PR behind a fuller page, so it reads `unaskable`
|
|
@@ -131,18 +131,15 @@ _plot_merged_lookup() {
|
|
|
131
131
|
|
|
132
132
|
# What the host says about an OPEN PR on this branch: found / none / unaskable.
|
|
133
133
|
#
|
|
134
|
-
# `--branch` narrows
|
|
135
|
-
#
|
|
136
|
-
#
|
|
137
|
-
#
|
|
138
|
-
# as `unaskable` rather than trusting a `none` that might be hiding behind a
|
|
139
|
-
# fuller page.
|
|
134
|
+
# `--branch` narrows both hosts to the one branch asked about (Bitbucket: a
|
|
135
|
+
# per-branch query; GitHub: `gh pr list --head`). A page `plot-host.sh` could
|
|
136
|
+
# not prove complete says so on stderr and reads `unaskable`, not `none`. One
|
|
137
|
+
# capture holds both streams, so the lookup creates no temp path.
|
|
140
138
|
_plot_open_lookup() {
|
|
141
|
-
local br="$1" out ok=1
|
|
139
|
+
local br="$1" out ok=1
|
|
142
140
|
[ -n "$br" ] && [ -f "$_plot_host_sh" ] || { echo unaskable; return; }
|
|
143
|
-
out=$(bash "$_plot_host_sh" pr-list --state open --branch "$br" --limit 100 2
|
|
144
|
-
|
|
145
|
-
rm -f -- "$err" 2>/dev/null
|
|
141
|
+
out=$(bash "$_plot_host_sh" pr-list --state open --branch "$br" --limit 100 2>&1) || ok=0
|
|
142
|
+
case "$out" in *'possibly truncated'*) ok=0 ;; esac
|
|
146
143
|
[ "$ok" -eq 1 ] || { echo unaskable; return; }
|
|
147
144
|
case "$out" in *"\"head\":\"$br\""*) echo found ;; *) echo none ;; esac
|
|
148
145
|
}
|
package/plot-state-receipt.sh
CHANGED
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
#
|
|
11
11
|
# plot-state-receipt.sh --unowned <path> <value> <reason>
|
|
12
12
|
#
|
|
13
|
-
# for the
|
|
13
|
+
# for the two writes that have NO owning script today. `/plot-approve` step 3b
|
|
14
14
|
# writes the phase by hand under `Review: in-session` and `Review: ballot` —
|
|
15
15
|
# `plot-approve.sh:190` refuses both by name, because a script cannot stand in
|
|
16
16
|
# for a human reviewer or read a ballot. `/plot-release` writes `State:
|
|
17
|
-
# Released
|
|
18
|
-
#
|
|
17
|
+
# Released`; `setPlanPhase` does not exist, so it has no script to route to.
|
|
18
|
+
# `/plot-reject` is no longer one: `plot-undeliver.sh` owns its write.
|
|
19
19
|
#
|
|
20
20
|
# A GATE WITH NO EXIT IS ONE PEOPLE ROUTE AROUND — `plot-dispatch.sh`'s
|
|
21
21
|
# `--allow-local` in the same tradition, and the reason this slice waited at all:
|
|
@@ -23,10 +23,9 @@
|
|
|
23
23
|
#
|
|
24
24
|
# THE ESCAPE IS COUNTABLE, WHICH IS THE POINT. The reason is required and it is
|
|
25
25
|
# recorded, so each use is a line naming a routing gap the later slices of
|
|
26
|
-
# `the-master-agent-uses-the-controllers` close: `/plot-
|
|
27
|
-
# controller
|
|
28
|
-
#
|
|
29
|
-
# reached for. Until then it is the difference between a gap that is visible and
|
|
26
|
+
# `the-master-agent-uses-the-controllers` close: `/plot-release` asks a
|
|
27
|
+
# controller for its verdict. When that lands, its script records its own
|
|
28
|
+
# receipt and the escape stops being reached for. Until then it is the difference between a gap that is visible and
|
|
30
29
|
# a gate that is turned off.
|
|
31
30
|
#
|
|
32
31
|
# WHY A RECEIPT RATHER THAN A COMMIT MESSAGE. `plot-state-gate.sh` sees a
|
|
@@ -176,6 +175,7 @@ _action_of() { # $1=script name or action word → the action, or nothing
|
|
|
176
175
|
plot-approve.sh|approve) printf 'approve\n' ;;
|
|
177
176
|
plot-deliver.sh|deliver) printf 'deliver\n' ;;
|
|
178
177
|
release) printf 'release\n' ;;
|
|
178
|
+
restart) printf 'restart\n' ;;
|
|
179
179
|
esac
|
|
180
180
|
}
|
|
181
181
|
|
|
@@ -237,7 +237,7 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
|
|
|
237
237
|
action_reason="$*"
|
|
238
238
|
if [ -z "$action_script" ] || [ -z "$action_subject" ] || [ -z "$action_reason" ]; then
|
|
239
239
|
echo "plot-state-receipt: --unowned-action needs an action, a subject and a reason." >&2
|
|
240
|
-
echo " usage: plot-state-receipt.sh --unowned-action <dispatch|approve|deliver|release> <
|
|
240
|
+
echo " usage: plot-state-receipt.sh --unowned-action <dispatch|approve|deliver|release|restart> <subject> <reason>" >&2
|
|
241
241
|
echo "" >&2
|
|
242
242
|
echo " The reason is required because each use names a routing gap, and a gap" >&2
|
|
243
243
|
echo " nobody wrote down is one nobody closes. Where the board IS running, the" >&2
|
|
@@ -254,9 +254,10 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
|
|
|
254
254
|
approve|plot-approve.sh) action_script="approve" ;;
|
|
255
255
|
deliver|plot-deliver.sh) action_script="deliver" ;;
|
|
256
256
|
release) action_script="release" ;;
|
|
257
|
+
restart) action_script="restart" ;;
|
|
257
258
|
*)
|
|
258
259
|
echo "plot-state-receipt: '$action_script' is not a controller-owned action." >&2
|
|
259
|
-
echo " The
|
|
260
|
+
echo " The five are: dispatch, approve, deliver, release, restart." >&2
|
|
260
261
|
exit 2
|
|
261
262
|
;;
|
|
262
263
|
esac
|
|
@@ -281,7 +282,6 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
|
|
|
281
282
|
echo "The named escape for a lifecycle write with no owning script:" >&2
|
|
282
283
|
echo " /plot-approve under 'Review: in-session' or 'Review: ballot'" >&2
|
|
283
284
|
echo " /plot-release writing 'State: Released'" >&2
|
|
284
|
-
echo " /plot-reject reverting Delivered -> Approved" >&2
|
|
285
285
|
echo "" >&2
|
|
286
286
|
echo "--unowned-action is the other layer: a controller-owned action run with no" >&2
|
|
287
287
|
echo "controller, for a machine running no board." >&2
|
package/plot-tmp.sh
CHANGED
|
@@ -37,9 +37,7 @@
|
|
|
37
37
|
# the last `trap` wins, and that replacement is the defect this file fixes
|
|
38
38
|
# (`plot-fleet-scan.sh` left one ~955-file cache per run). Use `plot_on_exit`.
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
return 0 2>/dev/null || exit 0
|
|
42
|
-
fi
|
|
40
|
+
[ "${PLOT_TMP_LOADED:-}" = "$$" ] && { return 0 2>/dev/null || exit 0; }
|
|
43
41
|
PLOT_TMP_LOADED=$$
|
|
44
42
|
|
|
45
43
|
# Fixed at first source: a later `TMPDIR` change in the script does not move it.
|