fix(board): anchor the NESTE marker to the heading form

The awk reader matched /NESTE/ unanchored, so any prose line that merely
mentioned the word (not just the real ## NESTE heading) set the flag and the
excerpt became whatever line followed the false match, not the real next
step.

Closed by operator decision 2026-08-02: one anchor form for all repos,
^#+[[:space:]].*NESTE. Measured 26/27 repos already use the heading form;
the one exception now renders "(tom NESTE-blokk)" instead of a misleading
fragment, which is the intended, honest failure mode until it switches
over - already flagged directly and on the same shape as the existing
"MERK: N repo mangler board-linje" line.

board-selftest 116 -> 118 (new fixture proves the false-match failure before
the fix, both checks green after).
This commit is contained in:
Kjell Tore Guttormsen 2026-08-02 20:51:13 +02:00
commit 917a902172
2 changed files with 25 additions and 2 deletions

View file

@ -345,6 +345,27 @@ mkrepo "$ROOT/repo-f"
{ echo "# STATE - repo-f"; printf '## %s NESTE %s START HER\n' "$HAND" "$EMDASH"; } > "$ROOT/repo-f/STATE.md"
"$BOARD" --roots "$ROOT" >/dev/null 2>&1; check "empty NESTE block does not crash" $?
# The NESTE marker must be anchored to the heading form, not any line
# containing the word. A prose line mentioning "NESTE" earlier in the file
# must not be mistaken for the marker - that would make the excerpt the line
# AFTER the false match instead of the real next step under the real heading.
mkrepo "$ROOT/repo-neste-lookalike"
{
echo "# STATE - repo-neste-lookalike"
echo "## Fakta"
echo "Noe forklaring om NESTE-formen som ble diskutert i gaar."
echo "Dette er en tilfeldig linje som IKKE er det ekte neste steget."
echo ""
printf '## %s NESTE %s START HER\n' "$HAND" "$EMDASH"
echo "<!-- board: status=in-progress; blocked-on=-; next-cost=sonnet/xhigh -->"
echo "Det ekte neste steget er aa fikse boardskriptet."
} > "$ROOT/repo-neste-lookalike/STATE.md"
NESTE_OUT="$("$BOARD" --roots "$ROOT" 2>/dev/null)"
printf '%s' "$NESTE_OUT" | grep -qE 'repo-neste-lookalike.*ekte neste steget'
check "NESTE marker anchored to heading, not any content line mentioning it" $?
printf '%s' "$NESTE_OUT" | grep -qE 'repo-neste-lookalike.*tilfeldig linje'
[ $? -ne 0 ]; check "content line mentioning NESTE is not mistaken for the marker" $?
"$BOARD" --help >/dev/null 2>&1; check "--help exits 0" $?
# Unreadable root is a no-op, not a crash.

View file

@ -231,9 +231,11 @@ printf '%s\n' "$REPOS" | while IFS= read -r d; do
[ -n "$cost" ] || cost="?"
# First content line under the NESTE heading: skip blanks, HTML comments and
# the heading itself; strip markdown bold/bullet noise.
# the heading itself; strip markdown bold/bullet noise. Anchored to the
# heading form (measured 26/27 real repos, decided 2026-08-02) so a prose
# line that merely mentions the word is never mistaken for the marker.
neste="$(awk '
/NESTE/ { flag=1; next }
/^#+[[:space:]].*NESTE/ { flag=1; next }
flag {
if ($0 ~ /^[[:space:]]*$/) next
if ($0 ~ /^[[:space:]]*<!--/) next