@plot-pm/board 0.23.0 → 0.23.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plot-pm/board",
3
- "version": "0.23.0",
3
+ "version": "0.23.1",
4
4
  "description": "Local Kanban board for Plot — a glanceable view of plan phases from docs/plans, with sprint and story filters",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -403,11 +403,9 @@ fi
403
403
  # degrades to strict and says so: an unverifiable claim of readiness is not
404
404
  # readiness.
405
405
  loose_verifiable=0
406
- if [ "$loose" = 1 ]; then
407
- if [ "$do_fetch" = 1 ] && "$script_dir/plot-host.sh" backend >/dev/null 2>&1 \
408
- && [ "$("$script_dir/plot-host.sh" backend 2>/dev/null)" != "none" ]; then
409
- loose_verifiable=1
410
- fi
406
+ if [ "$loose" = 1 ] && [ "$do_fetch" = 1 ]; then
407
+ loose_backend=$("$script_dir/plot-host.sh" backend 2>/dev/null)
408
+ [ -n "$loose_backend" ] && [ "$loose_backend" != "none" ] && loose_verifiable=1
411
409
  fi
412
410
 
413
411
  # ---------------------------------------------------------------------------
@@ -597,10 +595,32 @@ fi
597
595
  # `REF_TMP` trap below replaced it, so every scan left one `tmp.*` directory of
598
596
  # ~955 files behind (measured 2026-09-30).
599
597
  HOST_STATE_CACHE=""
598
+ # WHAT THIS SCAN SPENT ON THE HOST, ON STDERR AND TAGGED like `listing:` and
599
+ # `terminal:` — `fleet-scan.ts`'s `onErrorLine` parses all three the same way.
600
+ # TypeScript sees only the in-process `askPrList` calls; the two `pr-list`
601
+ # calls in `prefill_pr_states` and every real `pr-state` call `host_pr_state
602
+ # --ask` makes are this script's own (#2815). It runs at exit, because
603
+ # `--stream`, which fleetd starts, leaves through its own `exit 0`, and it
604
+ # prints only under `--stream`: `--next` and the other modes promise silence on
605
+ # both streams, and no `--json` caller reads stderr. Registered BEFORE the
606
+ # cache, because the exit handler runs in registration order and removes the
607
+ # cache that holds the count. A scan that spent nothing prints no line.
608
+ plot_on_exit '[ "$stream" = 1 ] && [ -s "$HOST_STATE_CACHE/.spend" ] && printf "spend: %s\n" "$(wc -c < "$HOST_STATE_CACHE/.spend" | tr -d " ")" >&2'
600
609
  if [ "$HOST_LOOKUP_OK" = 1 ]; then
601
610
  plot_tmpdir HOST_STATE_CACHE fleet-host-state 2>/dev/null || HOST_STATE_CACHE=""
602
611
  fi
603
612
 
613
+ # ONE LINE PER REAL HOST CALL, APPENDED RATHER THAN HELD IN A VARIABLE.
614
+ # `host_pr_state` is called from inside `$(...)` at two sites (`:1524`,
615
+ # `:4469`), and a variable it incremented would die with that subshell —
616
+ # exactly the trap `branch_state`'s own comment names above. The file
617
+ # survives every subshell this scan makes, because it is the same
618
+ # `HOST_STATE_CACHE` directory `host_pr_state`'s own per-branch cache
619
+ # already lives in and is cleaned up by.
620
+ spend_tick() {
621
+ [ -n "$HOST_STATE_CACHE" ] && printf '.' >> "$HOST_STATE_CACHE/.spend" 2>/dev/null
622
+ }
623
+
604
624
  # The cache key. Shared by the join and by `host_pr_state`, because the two
605
625
  # must agree on it EXACTLY: a prefill written under one spelling and read under
606
626
  # another is a cache that silently never hits, which restores the per-branch
@@ -921,7 +941,7 @@ EOF
921
941
  # the direction that errs costs a fabricated `NONE`. The MARKER carries the
922
942
  # claim, so arrival decides and the row count does not.
923
943
  [ "$arrived" = 1 ] || return 1
924
- printf '1' > "$HOST_STATE_CACHE/.list-arrived" 2>/dev/null || true
944
+ printf '1' > "$HOST_STATE_CACHE/.list-arrived" 2>/dev/null
925
945
  [ "$complete" = 1 ] && { printf '1' > "$HOST_STATE_CACHE/.list-complete" 2>/dev/null || true; }
926
946
  # `ok`, AND A NEW WORD HERE WOULD STOP THE FLEET. `reachFrom`
927
947
  # (`entry/branch-state.ts:113`) maps any word it does not know to `failed`, so
@@ -1047,6 +1067,7 @@ prefill_pr_states() {
1047
1067
  open_err=$("$script_dir/plot-host.sh" pr-list --state open --limit "$PR_LIST_LIMIT" --rich \
1048
1068
  ${_branch_args[@]+"${_branch_args[@]}"} \
1049
1069
  </dev/null 2>&1 >"$open_list_out"); rc_open=$?
1070
+ spend_tick
1050
1071
  # THE VERDICT IS THE WORSE OF THE TWO, never the last one. A rich call
1051
1072
  # throttled while the plain one answers leaves `checks` absent for every open
1052
1073
  # PR, so `--loose` degrades to strict — and a footer reading `host=ok` would
@@ -1063,6 +1084,7 @@ prefill_pr_states() {
1063
1084
  host_err=$("$script_dir/plot-host.sh" pr-list --state settled --limit "$PR_LIST_LIMIT" \
1064
1085
  ${_branch_args[@]+"${_branch_args[@]}"} \
1065
1086
  </dev/null 2>&1 >"$host_list_out"); rc=$?
1087
+ spend_tick
1066
1088
  pr_list_verdict "$rc" "$host_err"; _v_all=$_plv
1067
1089
  pr_list_verdict_rank "$_v_open"; _r_open=$_plr
1068
1090
  pr_list_verdict_rank "$_v_all"
@@ -1136,7 +1158,7 @@ prefill_pr_states() {
1136
1158
  # Cache format: STATE<TAB>checks<TAB>draft — one line per branch.
1137
1159
  # `checks` is one of: green, failing, pending, none, unknown (or empty when
1138
1160
  # the response was not `--rich`); `draft` is true or false (or empty).
1139
- printf '%s\t%s\t%s' "$st" "$chk" "$dft" > "$HOST_STATE_CACHE/$br" 2>/dev/null || true
1161
+ printf '%s\t%s\t%s' "$st" "$chk" "$dft" > "$HOST_STATE_CACHE/$br" 2>/dev/null
1140
1162
  done <<EOF
1141
1163
  $(printf '%s\n' "$js" \
1142
1164
  | sed -n -e 's/.*"state":"\([A-Z]*\)","head":"\([^"]*\)","draft":\([a-z]*\),"checks":"\([a-z]*\)".*/\1 \4 \3 \2/p' \
@@ -1175,7 +1197,7 @@ EOF
1175
1197
  # collide with one: `git check-ref-format` rejects a branch whose name starts
1176
1198
  # with a dot, and the key encoding maps only `_` and `/`, so no branch key can
1177
1199
  # begin with one either. The separation is git's rule, not a lucky prefix.
1178
- printf '1' > "$HOST_STATE_CACHE/.list-arrived" 2>/dev/null || true
1200
+ printf '1' > "$HOST_STATE_CACHE/.list-arrived" 2>/dev/null
1179
1201
  # THE LIST WAS WHOLE — a stronger claim than `.list-arrived`, and the only one
1180
1202
  # that licenses deriving `NONE` from a cache miss.
1181
1203
  #
@@ -1267,10 +1289,10 @@ EOF
1267
1289
  return 1
1268
1290
  }
1269
1291
  if _list_whole "$host_err" && _list_whole "$open_err"; then
1270
- printf '1' > "$HOST_STATE_CACHE/.list-complete" 2>/dev/null || true
1292
+ printf '1' > "$HOST_STATE_CACHE/.list-complete" 2>/dev/null
1271
1293
  elif [ "$_pr_rows" -gt 0 ] && [ "$_pr_rows" -lt "$PR_LIST_LIMIT" ] \
1272
1294
  && [ "$_pr_open_rows" -lt "$PR_LIST_LIMIT" ] 2>/dev/null; then
1273
- printf '1' > "$HOST_STATE_CACHE/.list-complete" 2>/dev/null || true
1295
+ printf '1' > "$HOST_STATE_CACHE/.list-complete" 2>/dev/null
1274
1296
  fi
1275
1297
  report_listing
1276
1298
  }
@@ -1354,6 +1376,7 @@ host_pr_state() { # $1=branch [--ask] → OPEN|MERGED|CLOSED|NONE|-
1354
1376
  if [ "$ask" = "--ask" ]; then
1355
1377
  # Exit code first: non-zero is a transport failure and its stdout is not an
1356
1378
  # answer. Only then is the payload read.
1379
+ spend_tick
1357
1380
  if js=$("$script_dir/plot-host.sh" pr-state "$br" </dev/null 2>/dev/null); then
1358
1381
  st=$(printf '%s' "$js" | sed -n 's/.*"state":"\([A-Z]*\)".*/\1/p')
1359
1382
  [ -n "$st" ] || st='-'
@@ -3111,13 +3134,17 @@ for line in sys.stdin:
3111
3134
  # follow: `Tracer: yes` (1/0), a `Spike approved:` record (1/0), the wave
3112
3135
  # index of each annotated branch (one entry per branch), and their count.
3113
3136
  # Facts only: which slice holds the plan spike is the domain answer, spikeSliceOf.
3114
- spikes = [str(i) for i, w in enumerate(d.get("waves", []) or [])
3115
- for b in w.get("branches", []) or [] if b.get("spike")]
3137
+ spikes = [str(i) for i, w in enumerate(d.get("waves", []) or []) for b in w.get("branches", []) or [] if b.get("spike")]
3138
+ # unread_branch_items: a non-claim list item naming a branch, plan-level —
3139
+ # `landed()` (packages/domain/src/rules/deliverable.ts) refuses delivery on
3140
+ # one. Rendered here as its own JSON array (json.dumps escapes everything
3141
+ # the bash side would otherwise need json_str for), so the consumer below
3142
+ # has only to store the row — never to parse or re-escape one.
3143
+ unread_json = json.dumps([{k: u.get(k) or "" for k in ("wave", "branch", "line")} for u in d.get("unread_branch_items", []) or []])
3116
3144
  print("\t".join(["P", clean(f), clean(d.get("phase", "")) or "-", clean(d.get("type", "")) or "-",
3117
- "1" if d.get("tracer") else "0",
3118
- "1" if d.get("spike_approved_raw") else "0", ",".join(spikes) or "-", str(len(spikes))]))
3145
+ "1" if d.get("tracer") else "0", "1" if d.get("spike_approved_raw") else "0",
3146
+ ",".join(spikes) or "-", str(len(spikes)), clean(unread_json)]))
3119
3147
  for i, w in enumerate(d.get("waves", []) or []):
3120
- name = w.get("name")
3121
3148
  for b in w.get("branches", []) or []:
3122
3149
  ref = b.get("branch") or ""
3123
3150
  # Not every prefixed token in a ## Branches section is
@@ -3149,7 +3176,7 @@ for line in sys.stdin:
3149
3176
  "W", f, str(i), ref, str(b.get("deferred")).lower(),
3150
3177
  (b.get("deferred_reason") or "-"),
3151
3178
  (",".join(waits_on) if isinstance(waits_on, list) else waits_on) or "-",
3152
- name or "-", b.get("claimed") or "-", ",".join(b.get("commits") or []) or "-"]))
3179
+ w.get("name") or "-", b.get("claimed") or "-", ",".join(b.get("commits") or []) or "-"]))
3153
3180
  ' 2>/dev/null) || records=""
3154
3181
 
3155
3182
  local kind file rest
@@ -3158,8 +3185,10 @@ for line in sys.stdin:
3158
3185
  case "$kind" in
3159
3186
  P)
3160
3187
  plan_meta_files+=("$file")
3161
- # `rest` is "<phase>\t<type>\t<tracer>\t<spike approved>\t<spike waves>\t<spikes>",
3162
- # no token holding a tab. The last four travel together.
3188
+ # `rest` is "<phase>\t<type>\t<tracer>\t<spike approved>\t<spike waves>\t<spikes>\t<unread JSON>".
3189
+ # The last five travel together; `unread_branch_items` is JSON text
3190
+ # with no raw tab or newline byte, so it cannot be mistaken for a
3191
+ # field boundary.
3163
3192
  IFS=$'\t' read -r _ph _ty _sp <<< "$rest"
3164
3193
  plan_meta_phases+=("${_ph#-}")
3165
3194
  plan_meta_types+=("${_ty#-}")
@@ -5012,6 +5041,11 @@ for plan in "${plans[@]}"; do
5012
5041
  # anything reads.
5013
5042
  json_plan+=",\"phase\":\"$(json_str "$plan_phase")\""
5014
5043
  [ "${_plan_spike[0]}" = 1 ] && json_plan+=",\"tracer\":true"
5044
+ # A non-claim list item naming a branch, plan-level — `landed()`
5045
+ # (packages/domain/src/rules/deliverable.ts) refuses delivery on one.
5046
+ # The filter already rendered this as JSON (json.dumps), so there is
5047
+ # nothing left to escape here.
5048
+ json_plan+=",\"unreadBranchItems\":${_plan_spike[4]:-[]}"
5015
5049
  json_plan+=",\"waves\":[$json_waves]}"
5016
5050
  json_plans+="${json_plans:+,}$json_plan"
5017
5051
  # THE STREAM'S POINT: this plan is fully derived, so a consumer can render
@@ -5187,7 +5221,6 @@ read_previous_pulse() {
5187
5221
  # here leaves PREVIOUS_PULSE empty, which reads as a first run — the same
5188
5222
  # answer the scan gave before this existed.
5189
5223
  PREVIOUS_PULSE=$(cat "$file" 2>/dev/null | tr -d '\n') || PREVIOUS_PULSE=""
5190
- return 0
5191
5224
  }
5192
5225
 
5193
5226
  write_bridge() {
@@ -5214,7 +5247,6 @@ write_bridge() {
5214
5247
  return 0
5215
5248
  }
5216
5249
  mv -f "$tmp" "$file" 2>/dev/null || rm -f "$tmp" 2>/dev/null
5217
- return 0
5218
5250
  }
5219
5251
 
5220
5252
  # THE READING, COMPOSED ONCE. Two consumers read it — `--json`/`--stream` print
package/plot-host.sh CHANGED
@@ -652,10 +652,15 @@ ISSUE_PAGE_ROWS=100
652
652
  # that failed, as opposed to exit 4 (cannot be asked) or an answered empty list.
653
653
  # An empty message or a recognised lookup miss is an answer; anything else exits 3.
654
654
  miss_or_exit3() { [ -z "$1" ] || is_lookup_miss "$1" || die3 "$1"; }
655
- # `pr-merged`'s own third value for a failed call: a lookup miss still means
656
- # not-merged, anything else prints the host's words and answers `unknown`
657
- # rather than exiting — the caller already branches on this word, not a code.
658
- miss_or_unknown() { if [ -z "$1" ] || is_lookup_miss "$1"; then echo "not-merged"; else echo "plot-host: $1" >&2; echo "unknown"; fi; }
655
+ # `pr-merged`'s own third value for a failed call: a genuine PR-lookup miss
656
+ # still means not-merged — matched here on the same two phrases
657
+ # `is_lookup_miss` uses, minus its bare "not found" alternative, which also
658
+ # matches a failure naming no PR ("repository not found", 404) and would read
659
+ # as permission to delete the branch. Empty stderr is not a miss either: it
660
+ # is the host failing to say anything at all. Anything else answers `unknown`
661
+ # and prints the host's words when there are any, rather than exiting — the
662
+ # caller already branches on this word, not a code.
663
+ miss_or_unknown() { if [ -n "$1" ] && LC_ALL=C grep -qiE 'no (pull request|pullrequest)s? (found|match)|could not find.*pull request' <<<"$1"; then echo "not-merged"; else echo "${1:+plot-host: $1}" >&2; echo "unknown"; fi; }
659
664
  gh_fail() { echo "plot-host: $(cat "$HOST_ERR" 2>/dev/null)" >&2; rm -f "$HOST_ERR"; exit 3; }
660
665
  # Reads the last host call's stderr into `err` and removes the file, so the
661
666
  # next call starts empty. Every failed-call branch below starts with it.
@@ -1388,6 +1393,7 @@ bb_window_listing() { # global bb args… --state <s> --json → one JSON array
1388
1393
  echo "bitbucket window state=$_st is short ($_got of $_size matches after $_pages pages); refusing it rather than printing it as whole" >&2
1389
1394
  return 3
1390
1395
  fi
1396
+ echo "plot-host: bitbucket pr-list state=$_st window complete ($_got matches, every page read) — this window holds every pull request the host has in this state since the stamp" >&2
1391
1397
  printf '%s' "$_rows"
1392
1398
  }
1393
1399
 
@@ -1953,7 +1959,7 @@ jenkins_job_url_path() { # $1 = job path, $2 = branch or ""
1953
1959
  # names no parenthesized host. The caller decides what an unresolved host
1954
1960
  # means, same contract as every other helper here.
1955
1961
  jenkins_resolve_host() {
1956
- local line; line=$(jen -I "$1" auth status 2>&1 | grep -iE '^Instance:' | head -1) || true
1962
+ local line; line=$(jen -I "$1" auth status 2>&1 | grep -iE '^Instance:' | head -1)
1957
1963
  [ -n "$line" ] || return 1
1958
1964
  sed -nE 's/.*\(https?:\/\/([^)\/]+).*/\1/p' <<<"$line" | grep . || return 2
1959
1965
  }
package/plot-plan-meta.sh CHANGED
@@ -243,6 +243,21 @@
243
243
  # heading's branch is read instead (see the heading handler).
244
244
  # `wave` is the wave NAME, not an index. ALWAYS present; []
245
245
  # when every such item was attributed.
246
+ # unread_branch_items
247
+ # `{ wave, branch, line }` triples, in document order, for a
248
+ # list item in a slice section that is NOT a claim
249
+ # (branch_claim_re) and yet holds a token matching a
250
+ # configured branch prefix, inside or outside a code span —
251
+ # a report, not a refusal. Catches a foreign-repository
252
+ # branch named in prose rather than claimed, which the claim
253
+ # grammar never reads at all (unlike unread_heading_items,
254
+ # whose items are already claims the heading cannot
255
+ # attribute). `idea/` tokens, names holding `*`, and file
256
+ # paths (a `.` after the prefix) are not read as a branch. An
257
+ # item carrying `<!-- deferred: ... -->` is excluded: a
258
+ # person already accepted it has no branch yet. `wave` is the
259
+ # wave NAME, "" when the item precedes any heading. ALWAYS
260
+ # present; [] when none.
246
261
  # issues tracker issue numbers this plan answers, from the `## Status`
247
262
  # `Issue:` line or front matter `issue:` (sorted, unique).
248
263
  # A DEDICATED field, never a scan of the body for `#NNN`: a
@@ -337,7 +352,7 @@ if [ ${#files[@]} -eq 0 ] && [ ${#missing[@]} -eq 0 ]; then
337
352
  fi
338
353
 
339
354
  for f in ${missing[@]+"${missing[@]}"}; do
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' \
355
+ 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":[],"unread_branch_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' \
341
356
  "$(printf '%s' "$f" | sed 's/\\/\\\\/g; s/"/\\"/g')"
342
357
  done
343
358
 
@@ -384,11 +399,14 @@ function sorted_insert(arr, n, v, j) {
384
399
  arr[j+1] = v
385
400
  return n + 1
386
401
  }
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) {
402
+ # Renders `n` `{"k1":"...","k2":"...",["k3":"..."]}` objects, reading
403
+ # arr1[i]/arr2[i][/arr3[i]] for i=1..n. k3 "" omits the third field — the two-key
404
+ # shape unread_waits and unread_heading_items emit; unread_branch_items passes
405
+ # k3 for its third, "line".
406
+ function emit_pairs(n, k1, arr1, k2, arr2, k3, arr3, i, out) {
390
407
  for (i = 1; i <= n; i++)
391
- out = out (i > 1 ? "," : "") "{\"" k1 "\":\"" jesc(arr1[i]) "\",\"" k2 "\":\"" jesc(arr2[i]) "\"}"
408
+ out = out (i > 1 ? "," : "") "{\"" k1 "\":\"" jesc(arr1[i]) "\",\"" k2 "\":\"" jesc(arr2[i]) "\"" \
409
+ (k3 != "" ? ",\"" k3 "\":\"" jesc(arr3[i]) "\"" : "") "}"
392
410
  return out
393
411
  }
394
412
  # Every `<!-- waits: … -->` marker on a line, each value split on commas, in
@@ -555,6 +573,7 @@ function reset_state() {
555
573
  delete branch_heading; delete waits_of; delete waits_set; delete waits_n
556
574
  delete unread_waits_branch; delete unread_waits_value; n_unread_waits = 0
557
575
  delete unread_heading_item_wave; delete unread_heading_item_branch; n_unread_heading_items = 0
576
+ delete unread_branch_item_wave; delete unread_branch_item_branch; delete unread_branch_item_line; n_unread_branch_items = 0
558
577
  heading_branch = ""; heading_branch_n = 0
559
578
  delete builds_of; delete agent_of; delete commits_of; delete started; n_started = 0
560
579
  fm_changelog = ""
@@ -778,6 +797,7 @@ function emit_record( fmt, praw, palt_raw, traw, title, sprint, story, assigne
778
797
  # store_waits(), so it stays silent, as today.
779
798
  out = out ",\"unread_waits\":[" emit_pairs(n_unread_waits, "branch", unread_waits_branch, "value", unread_waits_value) "]"
780
799
  out = out ",\"unread_heading_items\":[" emit_pairs(n_unread_heading_items, "wave", unread_heading_item_wave, "branch", unread_heading_item_branch) "]"
800
+ out = out ",\"unread_branch_items\":[" emit_pairs(n_unread_branch_items, "wave", unread_branch_item_wave, "branch", unread_branch_item_branch, "line", unread_branch_item_line) "]"
781
801
  out = out ",\"review_raw\":\"" jesc(review) "\",\"review\":\"" norm_review(review) "\""
782
802
  out = out ",\"impl_raw\":\"" jesc(impl) "\",\"impl\":\"" norm_impl(impl) "\""
783
803
  out = out ",\"design_raw\":\"" jesc(design) "\""
@@ -1035,6 +1055,45 @@ function extract_prs(raw, defer, line, p) {
1035
1055
  line = raw
1036
1056
  while (match(line, /→#[0-9]+/)) { malformed_prs[++n_malformed_prs] = substr(line, RSTART, RLENGTH); line = substr(line, RSTART + RLENGTH) }
1037
1057
  }
1058
+ # The first branch-prefixed token on a NON-CLAIM list item, read for
1059
+ # unread_branch_items. Scans $0 AS WRITTEN — backticks included — since the
1060
+ # 3819 line (`` - Umsetzung: `bug/…` ``) names its branch inside a code span,
1061
+ # unlike mask_code() callers, which strip spans before reading. A boundary
1062
+ # character ahead of the prefix keeps "feature/x" from matching inside a
1063
+ # longer word such as "mifeature/x"; none of the real prefixes end a word
1064
+ # that would otherwise collide.
1065
+ #
1066
+ # Three kinds of token read as something OTHER than a branch, and are
1067
+ # skipped rather than reported: `idea/` names a plan, not a branch a slice
1068
+ # can claim; a name holding `*` is a glob a plan writes to mean "every
1069
+ # branch"; and a `.` anywhere after the prefix means a file path
1070
+ # (`docs/plans/x.md`), since no branch name in this estate ever carries one.
1071
+ # Loops past a skipped token rather than stopping at the first
1072
+ # match, so a line naming an excluded token before a real one (prose citing
1073
+ # both an `idea/` plan and a `bug/` branch) still reports the real one.
1074
+ function unread_branch_token(s, re, tok, pfx, rest) {
1075
+ re = "(^|[^A-Za-z0-9_/-])(" PREFIXES ")/[^ \t,)`:]+"
1076
+ while (match(s, re)) {
1077
+ tok = substr(s, RSTART, RLENGTH)
1078
+ sub("^[^A-Za-z0-9_/-]*", "", tok)
1079
+ s = substr(s, RSTART + RLENGTH)
1080
+ pfx = tok; sub(/\/.*/, "", pfx)
1081
+ rest = substr(tok, length(pfx) + 2)
1082
+ if (pfx != "idea" && index(tok, "*") == 0 && index(rest, ".") == 0) return tok
1083
+ }
1084
+ return ""
1085
+ }
1086
+ # Records $0 into unread_branch_items when it is a non-claim list item naming
1087
+ # a branch token — the one guard and the one recording shape both slice
1088
+ # dialects share in their non-claim arm.
1089
+ function record_unread_branch_item( utok) {
1090
+ if ($0 !~ /^[ \t]*-[ \t]+/ || $0 ~ /<!--[ \t]*(deferred|moved)[ \t]*(:|-->)/) return
1091
+ utok = unread_branch_token($0)
1092
+ if (utok == "") return
1093
+ unread_branch_item_wave[++n_unread_branch_items] = (n_waves > 0 ? wave_names[n_waves] : "")
1094
+ unread_branch_item_branch[n_unread_branch_items] = utok
1095
+ unread_branch_item_line[n_unread_branch_items] = trim($0)
1096
+ }
1038
1097
  # The longest wave name that still reads as a label, not prose. A JUDGEMENT, not
1039
1098
  # a measurement: the longest legitimate name in the estate is `Offered first`
1040
1099
  # (13), and the offender this exists to catch is a 53-character sentence, so the
@@ -1328,6 +1387,8 @@ section == "slices" && slice_shape != "heading" {
1328
1387
  if (n_waves == 0) { wave_names[++n_waves] = "" }
1329
1388
  wave_of[n_branches] = n_waves; ++wave_count[n_waves]
1330
1389
  keep_branch(n_branches, b, 0)
1390
+ } else {
1391
+ record_unread_branch_item()
1331
1392
  }
1332
1393
  extract_prs($0)
1333
1394
  next
@@ -1432,6 +1493,10 @@ section == "slices" && slice_shape == "heading" {
1432
1493
  # reported rather than silently dropped and never read as a second claim.
1433
1494
  unread_heading_item_wave[++n_unread_heading_items] = wave_names[n_waves]; unread_heading_item_branch[n_unread_heading_items] = item_branch
1434
1495
  }
1496
+ } else {
1497
+ # Not a claim at all — a non-claim item in a `## Waves` section can still
1498
+ # name a branch in prose, exactly as a list item in the old shape can.
1499
+ record_unread_branch_item()
1435
1500
  }
1436
1501
  next
1437
1502
  }