@plot-pm/board 0.19.0 → 0.20.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 +233 -226
- package/package.json +1 -1
- package/plot-config.sh +19 -9
- package/plot-dispatch.sh +59 -86
- package/plot-fleet-scan.sh +52 -19
- package/plot-host.sh +229 -183
- package/plot-plan-meta.sh +225 -233
- package/plot-pr-merged.sh +4 -33
- package/plot-release-refs.sh +0 -1
- package/plot-tmp.sh +8 -2
- package/plot-worker-state.sh +29 -51
package/package.json
CHANGED
package/plot-config.sh
CHANGED
|
@@ -172,20 +172,30 @@
|
|
|
172
172
|
# the same for Released. A team whose *Done* means
|
|
173
173
|
# *shipped* sets only this one; a team watching progress
|
|
174
174
|
# sets both.
|
|
175
|
+
# Tracker issue type the Jira issue type `issueOpen` opens an issue as, in
|
|
176
|
+
# the project's own vocabulary (`Bug`, `Task`). Absent or
|
|
177
|
+
# empty = `Task`. The issue opens in the first project
|
|
178
|
+
# `Ticket prefixes` names.
|
|
175
179
|
# Ticket prefixes the tracker project keys this repository's work lives
|
|
176
180
|
# in, comma-separated (`PROJ-A, PROJ-B`). NOT
|
|
177
181
|
# `Branch prefixes`, which sits next to it and holds
|
|
178
182
|
# `idea/`, `feature/`, `bug/` — that key is structural and
|
|
179
183
|
# names git branches; this one names tracker projects.
|
|
180
|
-
# Read by plot-host.sh's `issue-list
|
|
181
|
-
#
|
|
182
|
-
#
|
|
183
|
-
#
|
|
184
|
-
#
|
|
185
|
-
#
|
|
186
|
-
#
|
|
187
|
-
#
|
|
188
|
-
#
|
|
184
|
+
# Read by plot-host.sh's `issue-list`. ABSENT keeps
|
|
185
|
+
# today's query, byte for byte: person- and state-scoped,
|
|
186
|
+
# unchanged by this key's introduction. DECLARED turns the
|
|
187
|
+
# open and closed reads project-wide — every ticket of
|
|
188
|
+
# the named projects, not just the reader's own, which is
|
|
189
|
+
# what a shared instance needs; the unscoped default
|
|
190
|
+
# returned other customers' tickets. A LIST, because a
|
|
191
|
+
# repository mapping to several projects is the normal
|
|
192
|
+
# case; adoption seeds ONE prefix and a person adds the
|
|
193
|
+
# rest. `PLOT_JIRA_JQL` overrides the open and closed
|
|
194
|
+
# reads together. The reader's own open tickets are a
|
|
195
|
+
# SEPARATE read once this key is declared — the `issue-list
|
|
196
|
+
# --state inbox` call, today's exact old query, kept
|
|
197
|
+
# alive under its own name so *Waiting on you* still
|
|
198
|
+
# shows them once the lanes turn project-wide.
|
|
189
199
|
# NEVER WRITTEN EMPTY: an empty list reads as *this
|
|
190
200
|
# repository has no projects* and changes nothing about
|
|
191
201
|
# the query, so adoption omits the key instead.
|
package/plot-dispatch.sh
CHANGED
|
@@ -565,7 +565,7 @@ brief_present() { # $1 = branch → 0 if a usable brief exists on origin/<main>
|
|
|
565
565
|
#
|
|
566
566
|
# ABSENT IS NOT AN ERROR. A project with no `Brief command` behaves exactly as
|
|
567
567
|
# it does today: the gate refuses, and the refusal now names WHY nothing was
|
|
568
|
-
# called — `no-brief-command`, the shape `
|
|
568
|
+
# called — `no-brief-command`, the shape `idea.ts` gives `no-idea-command`.
|
|
569
569
|
# `none` reads the same way as it does for `Worker command`: asked, and answered
|
|
570
570
|
# "we write them by hand".
|
|
571
571
|
brief_command() { # → the usable `Brief command`, or empty
|
|
@@ -577,7 +577,7 @@ brief_command() { # → the usable `Brief command`, or empty
|
|
|
577
577
|
|
|
578
578
|
# Run the brief command for one branch, detached, and say what was done.
|
|
579
579
|
#
|
|
580
|
-
# DETACHED AND NOT WAITED ON, for the reason `
|
|
580
|
+
# DETACHED AND NOT WAITED ON, for the reason `idea.ts` gives: this is a
|
|
581
581
|
# `claude -p` session of unknown length, and a fan-out that blocks on one would
|
|
582
582
|
# hold every later branch behind it. The dispatch run reports that it asked; the
|
|
583
583
|
# brief lands in a later commit, and the NEXT dispatch of the same branch starts
|
|
@@ -1014,8 +1014,8 @@ resolve_launch() { # $1 = repo root, $2 = agent name ('' when none)
|
|
|
1014
1014
|
# makes `failed` safe to include — and including it is the point: a gate that
|
|
1015
1015
|
# simply refused `failed` would pass every refusal test and leave the verb
|
|
1016
1016
|
# unable to do the one thing it exists for.
|
|
1017
|
-
handover_refusal() { # $1=branch $2=worktree $3=state → 0 may hand over, 1 refused
|
|
1018
|
-
local branch="$1" wt="$2" state="$3" pr_json pr_num pr_state marker
|
|
1017
|
+
handover_refusal() { # $1=branch $2=worktree $3=state $4=plot_desk_loops line → 0 may hand over, 1 refused
|
|
1018
|
+
local branch="$1" wt="$2" state="$3" loop="${4:-none}" pr_json pr_num pr_state marker lpid lsrc lwait
|
|
1019
1019
|
|
|
1020
1020
|
if reached_review "$branch"; then
|
|
1021
1021
|
pr_json=$("$script_dir/plot-host.sh" pr-state "$branch" </dev/null 2>/dev/null || true)
|
|
@@ -1028,11 +1028,20 @@ handover_refusal() { # $1=branch $2=worktree $3=state → 0 may hand over, 1 ref
|
|
|
1028
1028
|
return 1
|
|
1029
1029
|
fi
|
|
1030
1030
|
|
|
1031
|
+
# A LIVE LOOP REFUSES WHATEVER THE STATE WORD SAYS (#1450). A loop sleeping on
|
|
1032
|
+
# checks, on a usage limit or between passes has no agent beneath it and reads
|
|
1033
|
+
# `stalled` or `finished`, yet a second loop beside it shares the desk.
|
|
1034
|
+
# `deskLoopAlive` reads all three recorded pids; an unread answer refuses too.
|
|
1035
|
+
case "$loop" in
|
|
1036
|
+
none) ;;
|
|
1037
|
+
alive*) IFS=$'\t' read -r _ lpid lsrc lwait <<<"$loop"
|
|
1038
|
+
[ "$lwait" = free ] && printf 'plot-dispatch: a free agent is waiting on %s (pid %s) — refusing.\n Its loop is idle, polling for a hand-over. Confirm before replacing it:\n plot-dispatch.sh --stop %s\n' "$branch" "$lpid" "$branch" >&2 && return 1
|
|
1039
|
+
case "$state" in running*) ;; *) printf 'plot-dispatch: a loop is alive on %s (pid %s, from %s) — refusing.\n It reads %s, which --stop leaves alone, as the reaper does. Let it\n finish its pass, or end pid %s yourself if you mean to replace it.\n' "$branch" "$lpid" "$lsrc" "${state%% *}" "$lpid" >&2; return 1 ;; esac ;;
|
|
1040
|
+
*) printf 'plot-dispatch: could not read whether a loop is alive on %s — refusing.\n' "$branch" >&2; return 1 ;;
|
|
1041
|
+
esac
|
|
1031
1042
|
case "$state" in
|
|
1032
1043
|
running*)
|
|
1033
|
-
|
|
1034
|
-
echo " Stop it first if you mean to replace it:" >&2
|
|
1035
|
-
echo " plot-dispatch.sh --stop $branch" >&2
|
|
1044
|
+
printf 'plot-dispatch: a worker is alive on %s (pid %s) — refusing.\n Stop it first if you mean to replace it:\n plot-dispatch.sh --stop %s\n' "$branch" "${state#running }" "$branch" >&2
|
|
1036
1045
|
return 1
|
|
1037
1046
|
;;
|
|
1038
1047
|
waiting*)
|
|
@@ -1824,14 +1833,12 @@ if [ "$mode" = "stop" ]; then
|
|
|
1824
1833
|
wt_guess="$wt_root_early/$wt_prefix_early$(printf '%s' "$stop_branch" | tr '/' '-')"
|
|
1825
1834
|
[ -n "$wt" ] && [ -d "$wt" ] || wt="$wt_guess"
|
|
1826
1835
|
if [ ! -d "$wt" ]; then
|
|
1827
|
-
|
|
1828
|
-
echo " Asked git for every worktree, and looked at $wt_guess." >&2
|
|
1829
|
-
echo " If a worker is running somewhere this cannot see, that machine is" >&2
|
|
1830
|
-
echo " where to stop it: /plot-dispatch --status names the desks here." >&2
|
|
1831
|
-
echo " Nothing was killed." >&2
|
|
1836
|
+
printf "plot-dispatch: no worktree holds '%s' — nothing to stop.\n Asked git for every worktree, and looked at %s.\n If a worker is running somewhere this cannot see, that machine is\n where to stop it: /plot-dispatch --status names the desks here.\n Nothing was killed.\n" "$stop_branch" "$wt_guess" >&2
|
|
1832
1837
|
exit 1
|
|
1833
1838
|
fi
|
|
1834
1839
|
st=$(worker_state "$wt" "$stop_branch")
|
|
1840
|
+
# A LIVE LOOP IS STOPPED WHATEVER ITS STATE WORD, so the loop `--restart`
|
|
1841
|
+
# refuses on is one this verb can end (`deskLoopAlive`, #1450).
|
|
1835
1842
|
case "$st" in
|
|
1836
1843
|
running*)
|
|
1837
1844
|
pid=${st#running }
|
|
@@ -1863,10 +1870,14 @@ if [ "$mode" = "stop" ]; then
|
|
|
1863
1870
|
else
|
|
1864
1871
|
echo " signalled its whole process group $stop_pgid"
|
|
1865
1872
|
fi
|
|
1873
|
+
# A PERSON'S STOP IS RECORDED AS ONE, so the supervisor's tick leaves the
|
|
1874
|
+
# desk alone. A worker that exits non-zero with no ending gets a fresh
|
|
1875
|
+
# agent from the tick (`killedWorkerEnding`); a `stopped` ending answers
|
|
1876
|
+
# `leave` in `endingAction`, and the desk keeps its claim.
|
|
1877
|
+
printf '{"reason":"stopped","actor":"operator","branch":"%s","detail":"plot-dispatch --stop"}\n' "$stop_branch" 2>/dev/null >"$wt/.plot-worker.ending.json" || true
|
|
1866
1878
|
# The worktree and its claim are left in place: the branch is still taken,
|
|
1867
1879
|
# and deleting either would be the kind of write this design avoids.
|
|
1868
|
-
|
|
1869
|
-
echo " plot-dispatch.sh --release $stop_branch"
|
|
1880
|
+
printf ' worktree kept at %s — the claim stands until you release it:\n plot-dispatch.sh --release %s\n' "$wt" "$stop_branch"
|
|
1870
1881
|
;;
|
|
1871
1882
|
finished*|waiting*|stalled*|failed*|ended*) echo "$stop_branch is not running ($st)" ;;
|
|
1872
1883
|
*) echo "$stop_branch has no worker" ;;
|
|
@@ -1894,9 +1905,7 @@ if [ "$mode" = "restart" ]; then
|
|
|
1894
1905
|
# stopped worker on it should be replaced. Refusing on phase would strand
|
|
1895
1906
|
# exactly the branch this exists to rescue.
|
|
1896
1907
|
if [ -z "$restart_branch" ]; then
|
|
1897
|
-
|
|
1898
|
-
echo " A slug is not enough: which stopped branch to hand to a new worker" >&2
|
|
1899
|
-
echo " is your call, not something this should guess." >&2
|
|
1908
|
+
printf 'plot-dispatch: --restart needs a branch name, e.g. --restart feature/x\n A slug is not enough: which stopped branch to hand to a new worker\n is your call, not something this should guess.\n' >&2
|
|
1900
1909
|
exit 1
|
|
1901
1910
|
fi
|
|
1902
1911
|
|
|
@@ -1908,9 +1917,7 @@ if [ "$mode" = "restart" ]; then
|
|
|
1908
1917
|
# them, and a hand-made worktree rarely follows dispatch's naming.
|
|
1909
1918
|
restart_wt=$(worktree_holding_branch "$restart_branch")
|
|
1910
1919
|
if [ -z "$restart_wt" ] || [ ! -d "$restart_wt" ]; then
|
|
1911
|
-
|
|
1912
|
-
echo " --restart hands an EXISTING checkout to a new worker; it creates none." >&2
|
|
1913
|
-
echo " To start this branch fresh, dispatch its plan." >&2
|
|
1920
|
+
printf "plot-dispatch: no worktree holds '%s' — nothing to restart.\n --restart hands an EXISTING checkout to a new worker; it creates none.\n To start this branch fresh, dispatch its plan.\n" "$restart_branch" >&2
|
|
1914
1921
|
exit 1
|
|
1915
1922
|
fi
|
|
1916
1923
|
|
|
@@ -1935,7 +1942,8 @@ if [ "$mode" = "restart" ]; then
|
|
|
1935
1942
|
# running here" — asked rather than re-derived, so this cannot drift from
|
|
1936
1943
|
# `--status` and the scan the way five of six states already did once.
|
|
1937
1944
|
restart_state=$(worker_state "$restart_wt" "$restart_branch")
|
|
1938
|
-
|
|
1945
|
+
restart_loop=$(printf '%s\n' "$restart_wt" | plot_desk_loops) || restart_loop="unread"
|
|
1946
|
+
handover_refusal "$restart_branch" "$restart_wt" "$restart_state" "${restart_loop:-unread}" || exit 1
|
|
1939
1947
|
# `stalled`, `failed`, `ended` and `no worker` all restart. The PR question
|
|
1940
1948
|
# above is what makes `failed` safe to include — and including it is the
|
|
1941
1949
|
# point: a gate that simply refused `failed` would pass every refusal test
|
|
@@ -2310,8 +2318,11 @@ if [ "$mode" = "start" ]; then
|
|
|
2310
2318
|
[ -n "$start_main" ] || start_main="main"
|
|
2311
2319
|
|
|
2312
2320
|
# HOW MANY WORKERS ARE ALREADY UP, counted from the desks on this disk rather
|
|
2313
|
-
# than from the registry. A manifest records a launch; a live
|
|
2314
|
-
# worker, and the question `--start` asks is about the machine's load.
|
|
2321
|
+
# than from the registry. A manifest records a launch; a live loop records a
|
|
2322
|
+
# worker, and the question `--start` asks is about the machine's load. A loop
|
|
2323
|
+
# counts whatever its state word: one sleeping on checks, on a usage limit or
|
|
2324
|
+
# between passes holds no agent and still loads the machine. `deskLoopAlive`
|
|
2325
|
+
# answers, through `plot_desk_loops`, the reading `--restart` refuses on. The
|
|
2315
2326
|
# count is what `fleetSize` subtracts, so asking for three twice gives three
|
|
2316
2327
|
# agents rather than six.
|
|
2317
2328
|
#
|
|
@@ -2338,14 +2349,7 @@ if [ "$mode" = "start" ]; then
|
|
|
2338
2349
|
if [ -n "${PLOT_START_ONE:-}" ]; then
|
|
2339
2350
|
start_count=1
|
|
2340
2351
|
else
|
|
2341
|
-
|
|
2342
|
-
[ -n "$wt" ] || continue
|
|
2343
|
-
[ -f "$wt/.plot-worker.pid" ] || continue
|
|
2344
|
-
p=$(cat "$wt/.plot-worker.pid" 2>/dev/null) || continue
|
|
2345
|
-
[ -n "$p" ] && ps -p "$p" >/dev/null 2>&1 && start_running=$((start_running + 1))
|
|
2346
|
-
done <<EOF
|
|
2347
|
-
$(git worktree list --porcelain </dev/null 2>/dev/null | awk '/^worktree /{print $2}')
|
|
2348
|
-
EOF
|
|
2352
|
+
start_running=$(git worktree list --porcelain </dev/null 2>/dev/null | awk '/^worktree /{print $2}' | plot_desk_loops --count) || start_running=""
|
|
2349
2353
|
fi
|
|
2350
2354
|
|
|
2351
2355
|
# THE MACHINE'S OWN READING, one timed fork. `machine-system.ts` samples five
|
|
@@ -2406,8 +2410,13 @@ EOF
|
|
|
2406
2410
|
# missing node, a module that throws all leave the answer empty. The direction
|
|
2407
2411
|
# is the reaper's: silence is never permission, and here permission would spawn
|
|
2408
2412
|
# detached processes.
|
|
2409
|
-
|
|
2410
|
-
|
|
2413
|
+
#
|
|
2414
|
+
# A COUNT THAT CANNOT BE READ IS THE SAME REFUSAL: an empty `start_running`
|
|
2415
|
+
# means `plot-desk-loop.mjs` answered nothing, and the refusal below names
|
|
2416
|
+
# that bundle, because an undercount would start too many agents.
|
|
2417
|
+
start_bundle="$script_dir/board/plot-fleet-size.mjs" start_answer=""
|
|
2418
|
+
[ -n "$start_running" ] || start_bundle="$script_dir/board/plot-desk-loop.mjs"
|
|
2419
|
+
[ -z "$start_running" ] || start_answer=$(printf '%s\t%s\t%s' "$start_count" "$start_running" "$start_cost" \
|
|
2411
2420
|
| node "$start_bundle" 2>/dev/null)
|
|
2412
2421
|
|
|
2413
2422
|
if [ -z "$start_answer" ]; then
|
|
@@ -2662,8 +2671,6 @@ if [ "$mode" = "migrate" ]; then
|
|
|
2662
2671
|
fi
|
|
2663
2672
|
|
|
2664
2673
|
n_moved=0 n_skipped=0 n_would=0
|
|
2665
|
-
dry_label="would move"
|
|
2666
|
-
[ "$migrate_yes" = 1 ] && dry_label="moved"
|
|
2667
2674
|
|
|
2668
2675
|
printf '%-8s %-52s %s\n' "verdict" "worktree" "reason"
|
|
2669
2676
|
|
|
@@ -2942,57 +2949,23 @@ else
|
|
|
2942
2949
|
fi
|
|
2943
2950
|
|
|
2944
2951
|
gate_meta=$("$script_dir/plot-plan-meta.sh" "$gate_blob" 2>/dev/null) || gate_meta=""
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
echo " Refusing rather than guessing — dispatching starts real work." >&2
|
|
2963
|
-
exit 1 ;;
|
|
2964
|
-
*)
|
|
2965
|
-
echo "plot-dispatch: plan '$slug' is in phase '$gate_phase', not Approved." >&2
|
|
2966
|
-
echo " Correct the 'State:' line in the plan and push it, or approve it:" >&2
|
|
2967
|
-
echo " /plot-approve $slug" >&2
|
|
2968
|
-
exit 1 ;;
|
|
2969
|
-
esac
|
|
2970
|
-
|
|
2971
|
-
# Fan-out only makes sense where implementation happens on its own branches
|
|
2972
|
-
# here. NONE means a pre-Plot-2 plan that never recorded an answer — allowed,
|
|
2973
|
-
# since those predate the question.
|
|
2974
|
-
case "$gate_impl" in
|
|
2975
|
-
own-branches|NONE|"") ;;
|
|
2976
|
-
same-branch)
|
|
2977
|
-
echo "plot-dispatch: plan '$slug' records 'Impl: same branch' — plan and code" >&2
|
|
2978
|
-
echo " travel on one branch, so there is nothing to fan out." >&2
|
|
2979
|
-
echo " Implement on that branch instead: /plot-implement $slug" >&2
|
|
2980
|
-
exit 1 ;;
|
|
2981
|
-
other-repo)
|
|
2982
|
-
echo "plot-dispatch: plan '$slug' records 'Impl: other repo' — implementation" >&2
|
|
2983
|
-
echo " happens elsewhere. Dispatch from the implementation repo instead." >&2
|
|
2984
|
-
exit 1 ;;
|
|
2985
|
-
none)
|
|
2986
|
-
echo "plot-dispatch: plan '$slug' records 'Impl: none' — knowledge-only work," >&2
|
|
2987
|
-
echo " nothing to implement." >&2
|
|
2988
|
-
exit 1 ;;
|
|
2989
|
-
*)
|
|
2990
|
-
echo "plot-dispatch: plan '$slug' records an unrecognised 'Impl:' answer" >&2
|
|
2991
|
-
echo " ('$gate_impl'). Refusing rather than guessing." >&2
|
|
2992
|
-
echo " Set the plan's 'Impl:' line to one of: own branches, same branch," >&2
|
|
2993
|
-
echo " other repo, none — then push it." >&2
|
|
2994
|
-
exit 1 ;;
|
|
2995
|
-
esac
|
|
2952
|
+
# The phase and `Impl:` rules live in the domain (`plangate`); this asks the
|
|
2953
|
+
# bundle and fails closed when it cannot answer. Exit 1 is the bundle's own
|
|
2954
|
+
# refusal, which it has already explained on stderr.
|
|
2955
|
+
gate_args=(--slug "$slug" --source "$gate_source" --default-branch "$MAIN")
|
|
2956
|
+
[ -n "$gate_sha" ] && gate_args+=(--ref-resolved)
|
|
2957
|
+
[ "$allow_local" = 1 ] && gate_args+=(--allow-local)
|
|
2958
|
+
gate_rc=127
|
|
2959
|
+
if [ -f "$script_dir/board/plot-ask.mjs" ]; then
|
|
2960
|
+
gate_rc=0
|
|
2961
|
+
printf '%s' "$gate_meta" | node "$script_dir/board/plot-ask.mjs" plangate "${gate_args[@]}" || gate_rc=$?
|
|
2962
|
+
fi
|
|
2963
|
+
if [ "$gate_rc" != 0 ]; then
|
|
2964
|
+
[ "$gate_rc" = 1 ] && exit 1
|
|
2965
|
+
echo "plot-dispatch: cannot ask the plan gate about the phase of '$slug' — board/plot-ask.mjs is missing or failed." >&2
|
|
2966
|
+
echo " Refusing rather than guessing — dispatching starts real work." >&2
|
|
2967
|
+
exit 1
|
|
2968
|
+
fi
|
|
2996
2969
|
|
|
2997
2970
|
# MAIN was resolved and origin fetched above, before the phase gate — the gate
|
|
2998
2971
|
# needs the shared ref to read the plan from it.
|
package/plot-fleet-scan.sh
CHANGED
|
@@ -221,7 +221,7 @@
|
|
|
221
221
|
#
|
|
222
222
|
# 2. `.plot/state/last-pulse.json` — the bridge, written by `write_bridge` on
|
|
223
223
|
# the success path of `--stream` (unless PLOT_SCAN_RECORD=0) and `--log-pulse`
|
|
224
|
-
# (what /plot-pulse passes). Those are the two callers that produce a pulse
|
|
224
|
+
# (what /plot-pulse passes; not while the fleet's writer holds the bridge). Those are the two callers that produce a pulse
|
|
225
225
|
# for somebody to READ; plain `--json` is a query and records nothing. That
|
|
226
226
|
# is a CACHE WITH AN EXPIRY: `pulse-bridge.ts` discards it after 15 minutes
|
|
227
227
|
# and on a version mismatch, so it can only ever be a shortcut to an answer
|
|
@@ -1880,7 +1880,7 @@ worktree_locked() { # $1=worktree path → 0 when a lock is held there
|
|
|
1880
1880
|
# ~10 s against GitHub's 461 ms, so a scan that cannot finish here cannot finish
|
|
1881
1881
|
# there at all. The board serves no rows without a completed pulse — a fresh
|
|
1882
1882
|
# process has no previous one to fall back on — so an over-budget scan is an
|
|
1883
|
-
# EMPTY
|
|
1883
|
+
# EMPTY Delivery tab, not a stale one.
|
|
1884
1884
|
#
|
|
1885
1885
|
# The tab-delimited-string-plus-`case` shape matches `WORKTREES` below and is
|
|
1886
1886
|
# kept for the same reason: no associative arrays, so it must work in POSIX sh.
|
|
@@ -3050,6 +3050,7 @@ add_ref_plan() { # $1=path in ref
|
|
|
3050
3050
|
plan_meta_files=()
|
|
3051
3051
|
plan_meta_phases=()
|
|
3052
3052
|
plan_meta_types=()
|
|
3053
|
+
plan_meta_spikes=()
|
|
3053
3054
|
plan_meta_waves=()
|
|
3054
3055
|
|
|
3055
3056
|
# WHERE THE LAST LOOKUP LANDED, so the next one starts there instead of at 0.
|
|
@@ -3107,7 +3108,16 @@ for line in sys.stdin:
|
|
|
3107
3108
|
f = d.get("file")
|
|
3108
3109
|
if not f:
|
|
3109
3110
|
continue
|
|
3110
|
-
|
|
3111
|
+
# EVERY MIDDLE COLUMN IS NEVER EMPTY — phase and type "-" when absent —
|
|
3112
|
+
# because `IFS=$'\t' read` collapses a run of tabs. FOUR SPIKE READINGS
|
|
3113
|
+
# follow: `Tracer: yes` (1/0), a `Spike approved:` record (1/0), the wave
|
|
3114
|
+
# index of each annotated branch (one entry per branch), and their count.
|
|
3115
|
+
# Facts only: which slice holds the plan spike is the domain answer, spikeSliceOf.
|
|
3116
|
+
spikes = [str(i) for i, w in enumerate(d.get("waves", []) or [])
|
|
3117
|
+
for b in w.get("branches", []) or [] if b.get("spike")]
|
|
3118
|
+
print("\t".join(["P", clean(f), clean(d.get("phase", "")) or "-", clean(d.get("type", "")) or "-",
|
|
3119
|
+
"1" if d.get("tracer") else "0",
|
|
3120
|
+
"1" if d.get("spike_approved_raw") else "0", ",".join(spikes) or "-", str(len(spikes))]))
|
|
3111
3121
|
for i, w in enumerate(d.get("waves", []) or []):
|
|
3112
3122
|
name = w.get("name")
|
|
3113
3123
|
for b in w.get("branches", []) or []:
|
|
@@ -3141,7 +3151,7 @@ for line in sys.stdin:
|
|
|
3141
3151
|
"W", f, str(i), ref, str(b.get("deferred")).lower(),
|
|
3142
3152
|
(b.get("deferred_reason") or "-"),
|
|
3143
3153
|
(",".join(waits_on) if isinstance(waits_on, list) else waits_on) or "-",
|
|
3144
|
-
name or "-", b.get("claimed") or "-"]))
|
|
3154
|
+
name or "-", b.get("claimed") or "-", ",".join(b.get("commits") or []) or "-"]))
|
|
3145
3155
|
' 2>/dev/null) || records=""
|
|
3146
3156
|
|
|
3147
3157
|
local kind file rest
|
|
@@ -3150,12 +3160,12 @@ for line in sys.stdin:
|
|
|
3150
3160
|
case "$kind" in
|
|
3151
3161
|
P)
|
|
3152
3162
|
plan_meta_files+=("$file")
|
|
3153
|
-
# `rest` is "<phase>\t<type>",
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3163
|
+
# `rest` is "<phase>\t<type>\t<tracer>\t<spike approved>\t<spike waves>\t<spikes>",
|
|
3164
|
+
# no token holding a tab. The last four travel together.
|
|
3165
|
+
IFS=$'\t' read -r _ph _ty _sp <<< "$rest"
|
|
3166
|
+
plan_meta_phases+=("${_ph#-}")
|
|
3167
|
+
plan_meta_types+=("${_ty#-}")
|
|
3168
|
+
plan_meta_spikes+=("$_sp")
|
|
3159
3169
|
plan_meta_waves+=("")
|
|
3160
3170
|
;;
|
|
3161
3171
|
W)
|
|
@@ -3878,7 +3888,21 @@ EOF
|
|
|
3878
3888
|
MAIN_TIP=$(remote_ref_oid "$MAIN")
|
|
3879
3889
|
[ -n "$MAIN_TIP" ] || MAIN_TIP="-"
|
|
3880
3890
|
|
|
3881
|
-
|
|
3891
|
+
# WHETHER EVERY COMMIT A SLICE LINE NAMES (`→ commit abc1234`) IS ON THE DEFAULT
|
|
3892
|
+
# BRANCH. A slice completed by a direct push has no PR, so this is its only
|
|
3893
|
+
# evidence. Like the merge subject it may only move a branch from `open` to
|
|
3894
|
+
# `merged` (a reversible wave step), never decide a delivery: the delivery gate
|
|
3895
|
+
# reads the same commits itself. A commit of another repository
|
|
3896
|
+
# (`owner/repo@sha`) is not a revision here, so the slice stays open.
|
|
3897
|
+
commits_landed() { # $1=comma-separated commits or "-" → 0 when all are on origin/$MAIN
|
|
3898
|
+
[ "${1:--}" != - ] || return 1
|
|
3899
|
+
for _c in ${1//,/ }; do
|
|
3900
|
+
# plot-ancestry: evidence — a commit named by hash is the exact object a direct push put on the default branch; no merge rewrites it, and the wave gate only settles a slice from it.
|
|
3901
|
+
git merge-base --is-ancestor "$_c" "origin/$MAIN" 2>/dev/null || return 1
|
|
3902
|
+
done
|
|
3903
|
+
}
|
|
3904
|
+
|
|
3905
|
+
branch_readings() { # $1=branch $2=deferred $3=plan-base $4=commits → readings
|
|
3882
3906
|
local br="$1" _bs_deferred="$2" _bs_plan="${3:-}" _bs_subject=false
|
|
3883
3907
|
local _bs_ahead=0 _bs_real=0 _bs_tip
|
|
3884
3908
|
local _bs_main="$MAIN_TIP"
|
|
@@ -3918,6 +3942,7 @@ branch_readings() { # $1=branch $2=deferred $3=plan-base → readings
|
|
|
3918
3942
|
# where an unstarted reused name read `merged`, its slice read complete,
|
|
3919
3943
|
# the next slice opened, and the reused slice was never offered.
|
|
3920
3944
|
merged_by_subject "$_bs_plan" "$br" && _bs_subject=true
|
|
3945
|
+
commits_landed "${4:--}" && _bs_subject=true
|
|
3921
3946
|
# A subject the age rule refused is reported apart from one that never
|
|
3922
3947
|
# existed: both read `unknown` under a refused host, and only this one has
|
|
3923
3948
|
# an explanation.
|
|
@@ -4139,7 +4164,7 @@ READ_REF=$(git rev-parse --short "origin/$MAIN" 2>/dev/null) || READ_REF=""
|
|
|
4139
4164
|
[ -n "$READ_REF" ] || READ_REF="unknown"
|
|
4140
4165
|
LOCAL_HEAD=$(git rev-parse --short HEAD 2>/dev/null) || LOCAL_HEAD=""
|
|
4141
4166
|
[ -n "$LOCAL_HEAD" ] || LOCAL_HEAD="unknown"
|
|
4142
|
-
# Kept as an alias for one release: the board reads `head` today (
|
|
4167
|
+
# Kept as an alias for one release: the board reads `head` today (Delivery tab),
|
|
4143
4168
|
# and renaming a field out from under a live consumer is a break nobody asked
|
|
4144
4169
|
# for. Removed once the board reads `read_ref`.
|
|
4145
4170
|
HEAD_SHORT="$LOCAL_HEAD"
|
|
@@ -4241,6 +4266,7 @@ for plan in "${plans[@]}"; do
|
|
|
4241
4266
|
# interpreted: this script collects and reports, and which column a row reads
|
|
4242
4267
|
# is a judgment that belongs one layer up (Manifesto Principle 3).
|
|
4243
4268
|
plan_phase="${plan_meta_phases[$meta_i]}"
|
|
4269
|
+
IFS=$'\t' read -r -a _plan_spike <<< "${plan_meta_spikes[$meta_i]}"
|
|
4244
4270
|
|
|
4245
4271
|
# THE RELEASE SCOPE, decided by the PHASE alone. A terminal plan stays in the
|
|
4246
4272
|
# pulse only while it is `delivered`: its work has landed and its version has
|
|
@@ -4258,7 +4284,6 @@ for plan in "${plans[@]}"; do
|
|
|
4258
4284
|
fi
|
|
4259
4285
|
|
|
4260
4286
|
n_plans=$((n_plans + 1))
|
|
4261
|
-
plan_target=$(readlink "$plan" 2>/dev/null && echo "" || true)
|
|
4262
4287
|
|
|
4263
4288
|
# The plan's DISPLAY NAME: the dated filename, never an index alias.
|
|
4264
4289
|
#
|
|
@@ -4364,12 +4389,12 @@ for plan in "${plans[@]}"; do
|
|
|
4364
4389
|
# main as `open` only when it is true; a capped list may omit a merged PR.
|
|
4365
4390
|
list_complete=false
|
|
4366
4391
|
[ -n "$HOST_STATE_CACHE" ] && [ -f "$HOST_STATE_CACHE/.list-complete" ] && list_complete=true
|
|
4367
|
-
while IFS=$'\t' read -r idx br deferred why waits wname claim; do
|
|
4392
|
+
while IFS=$'\t' read -r idx br deferred why waits wname claim commits; do
|
|
4368
4393
|
[ -n "$br" ] || continue
|
|
4369
4394
|
# "-" is the absent marker the shim writes, for the tab-collapse reason
|
|
4370
4395
|
# above. Normalized here so everything downstream tests emptiness.
|
|
4371
4396
|
[ "$waits" = "-" ] && waits=""
|
|
4372
|
-
readings+="$(branch_readings "$br" "$deferred" "$plan_base") ${waits:--} ? $list_complete ?"$'\n'
|
|
4397
|
+
readings+="$(branch_readings "$br" "$deferred" "$plan_base" "$commits") ${waits:--} ? $list_complete ?"$'\n'
|
|
4373
4398
|
# Read from the readings line just built rather than from the variable: the
|
|
4374
4399
|
# subshell `branch_readings` runs in cannot export it back.
|
|
4375
4400
|
# FIELD 6 is the host's own word, in both arms of `branch_readings`:
|
|
@@ -4558,7 +4583,11 @@ for plan in "${plans[@]}"; do
|
|
|
4558
4583
|
*) outstanding=$((outstanding + 1)) ;;
|
|
4559
4584
|
esac
|
|
4560
4585
|
done <<< "$states"
|
|
4561
|
-
|
|
4586
|
+
# THE THREE SPIKE COLUMNS, read by `plot-verdicts.mjs`: how many
|
|
4587
|
+
# `<!-- spike -->` branches this slice holds, whether the plan records
|
|
4588
|
+
# `Spike approved:`, and how many annotated branches the whole plan holds.
|
|
4589
|
+
_spike=0; for _w in ${_plan_spike[2]//,/ }; do if [ "$_w" = "$wid" ]; then _spike=$((_spike + 1)); fi; done
|
|
4590
|
+
wave_readings+="$outstanding $plan_phase $wave_states $_spike ${_plan_spike[1]} ${_plan_spike[3]:-0}"$'\n'
|
|
4562
4591
|
wave_degraded_list+="$_loose_degraded_branches"$'\n'
|
|
4563
4592
|
done
|
|
4564
4593
|
|
|
@@ -4986,6 +5015,7 @@ for plan in "${plans[@]}"; do
|
|
|
4986
5015
|
# branch's git state into a row phase; nothing here decides which column
|
|
4987
5016
|
# anything reads.
|
|
4988
5017
|
json_plan+=",\"phase\":\"$(json_str "$plan_phase")\""
|
|
5018
|
+
[ "${_plan_spike[0]}" = 1 ] && json_plan+=",\"tracer\":true"
|
|
4989
5019
|
json_plan+=",\"waves\":[$json_waves]}"
|
|
4990
5020
|
json_plans+="${json_plans:+,}$json_plan"
|
|
4991
5021
|
# THE STREAM'S POINT: this plan is fully derived, so a consumer can render
|
|
@@ -5122,8 +5152,8 @@ fi
|
|
|
5122
5152
|
# each with `toMap`, which yields an empty Map for anything it cannot use, and
|
|
5123
5153
|
# `branchUrlBase` falls back to `''`. So a scan-written bridge serves the rows,
|
|
5124
5154
|
# the verdicts and the counts, with unknown ages and no branch links — degraded
|
|
5125
|
-
# in the direction the board already handles
|
|
5126
|
-
#
|
|
5155
|
+
# in the direction the board already handles. While the fleet runs, its
|
|
5156
|
+
# `writeScan` writes the full bridge and `--log-pulse` writes none.
|
|
5127
5157
|
#
|
|
5128
5158
|
# TEMP FILE PLUS RENAME, carrying the pid, exactly as `writeBridge` does and for
|
|
5129
5159
|
# the same reason: `rename` is atomic within a filesystem, so a board reading
|
|
@@ -5173,8 +5203,11 @@ write_bridge() {
|
|
|
5173
5203
|
# git rather than assuming the two agree.
|
|
5174
5204
|
local root file tmp
|
|
5175
5205
|
root=$(git rev-parse --show-toplevel 2>/dev/null) || return 0
|
|
5176
|
-
[ -n "$root" ] || return 0
|
|
5177
5206
|
file="$root/.plot/state/last-pulse.json"
|
|
5207
|
+
# `--log-pulse` leaves a bridge the fleet's writer holds (`fleetHoldsBridge`):
|
|
5208
|
+
# one writer while a fleet runs. A missing, stale or thin bridge, or a failed
|
|
5209
|
+
# ask, writes as before, so a repository with no board and no fleet keeps its history.
|
|
5210
|
+
[ "$log_pulse" = 1 ] && [ -f "$file" ] && node "$script_dir/board/plot-delta.mjs" --held < "$file" 2>/dev/null && return 0
|
|
5178
5211
|
mkdir -p "$root/.plot/state" 2>/dev/null || return 0
|
|
5179
5212
|
tmp="$file.$$.tmp"
|
|
5180
5213
|
# `at` is when the scan COMPLETED, which is what `pulse-bridge.ts:81` asks for
|