fix(board): FILENAME== the focus-filter join, matching the file's own rule
F12: a third NR==FNR survived at the focus-filter join in plan() (fp_names x pf), next to two comments that already state this file's rule -- never by NR==FNR. Measured before fixing: unlike the two prior instances, this join has no third file whose lookup table a misroute could corrupt, and FOCUS_SLUGS is provably a subset of what focus_slugs() finds in the same $RECORDS focus_declares() re-checks -- so fp_names cannot be empty while the filter applies, and even forced empty the old and new form produce identical output. No reachable defect to pin behaviourally; the fix closes the file's own stated invariant instead. Pinned structurally in selftest section 21: no live NR==FNR outside a comment, with a known-positive control proving the filter can still find one. board-selftest: 239/239 (was 237). coord/route/orders/guard unchanged and green (220/69/99/40), npm test 11/11. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YkJ1rKh5YNfVUr5UDKpfh
This commit is contained in:
parent
6b26b8e94b
commit
2928c28044
3 changed files with 62 additions and 2 deletions
31
CLAUDE.md
31
CLAUDE.md
|
|
@ -564,6 +564,35 @@ marketplace plugin. Three components, one boundary:
|
||||||
known-positive controls that a genuinely absent board line still reads `?`
|
known-positive controls that a genuinely absent board line still reads `?`
|
||||||
and a genuinely valid route line still derives a real command.
|
and a genuinely valid route line still derives a real command.
|
||||||
|
|
||||||
|
**F12 (2026-08-17): a third `NR==FNR` survived at the focus-filter join in
|
||||||
|
`plan()` (`fp_names` x `pf`), next to two comments (the block above and the
|
||||||
|
one on `--brief`'s OWED join) that already state the file's own rule -
|
||||||
|
"never by `NR==FNR`" - as prose. Measured, not assumed, before touching
|
||||||
|
it: for a plain two-file keep-set join with no THIRD file whose lookup
|
||||||
|
table a misroute could corrupt, an empty `fp_names` produces the SAME
|
||||||
|
output (0 kept) under `NR==FNR` and under `FILENAME==` alike - run
|
||||||
|
standalone with both forms against both an empty and a non-empty first
|
||||||
|
file, output was identical every time. That is because when `fp_names` is
|
||||||
|
genuinely empty (0 repos anywhere declare the resolved focus slug), 0 kept
|
||||||
|
IS the correct answer, unlike the two prior instances in this file where an
|
||||||
|
empty first file corrupted a lookup table (`ub[]`/`ow[]`) consumed by a
|
||||||
|
THIRD file and silently dropped repos that should have stayed. Stronger
|
||||||
|
than that: `FOCUS_SLUGS` is provably a subset of what `focus_slugs()` finds
|
||||||
|
by scanning the same `$RECORDS`, and `focus_declares()` re-checks the
|
||||||
|
identical regex against the identical `$RECORDS`, so `fp_names` cannot be
|
||||||
|
empty while the filter is applied in normal use - there is no reachable,
|
||||||
|
observable defect here to pin behaviourally, and a `--focus` fixture
|
||||||
|
asserting one would pass identically before and after the fix, which this
|
||||||
|
repo's own CLAUDE.md already names as the "unmeasured assumption wearing a
|
||||||
|
passing test" defect class. The fix is applied anyway, but for a different
|
||||||
|
reason: it is a live counter-example to a rule the file states about
|
||||||
|
itself, and a trap for the next session that greps `NR==FNR` expecting
|
||||||
|
every hit to be a bug and finds one that quietly works. Selftest section 21
|
||||||
|
pins it structurally - `board.sh` has no `NR==FNR` outside a comment line,
|
||||||
|
with a known-positive control proving the comment-stripping grep can still
|
||||||
|
find a live one when planted - never behaviourally, because there is no
|
||||||
|
behaviour to pin.**
|
||||||
|
|
||||||
- **Route (`scripts/route.sh`):** pure calculator for the next session's model
|
- **Route (`scripts/route.sh`):** pure calculator for the next session's model
|
||||||
and effort. Takes four scored traits of the next task plus a required
|
and effort. Takes four scored traits of the next task plus a required
|
||||||
rationale, and prints one block of `key=value` lines: the rubric row, the rule
|
rationale, and prints one block of `key=value` lines: the rubric row, the rule
|
||||||
|
|
@ -686,7 +715,7 @@ obligations in another repo.
|
||||||
builtins only in hook and tests.
|
builtins only in hook and tests.
|
||||||
- TDD: no behavior change without a failing selftest check first.
|
- TDD: no behavior change without a failing selftest check first.
|
||||||
`bash scripts/coord-selftest.sh` must exit 0 (220/220),
|
`bash scripts/coord-selftest.sh` must exit 0 (220/220),
|
||||||
`bash scripts/board-selftest.sh` must exit 0 (237/237),
|
`bash scripts/board-selftest.sh` must exit 0 (239/239),
|
||||||
`bash scripts/route-selftest.sh` must exit 0 (69/69),
|
`bash scripts/route-selftest.sh` must exit 0 (69/69),
|
||||||
`bash scripts/orders-selftest.sh` must exit 0 (99/99) and
|
`bash scripts/orders-selftest.sh` must exit 0 (99/99) and
|
||||||
`bash scripts/state-line-guard-selftest.sh` must exit 0 (40/40).
|
`bash scripts/state-line-guard-selftest.sh` must exit 0 (40/40).
|
||||||
|
|
|
||||||
|
|
@ -1905,6 +1905,37 @@ printf '%s' "$ORD_OUT" | grep -q 'summeres ALDRI'
|
||||||
check "the legend states that INN and ORDRE are never summed" $?
|
check "the legend states that INN and ORDRE are never summed" $?
|
||||||
/bin/rm -rf "$ORD_ROOT" 2>/dev/null
|
/bin/rm -rf "$ORD_ROOT" 2>/dev/null
|
||||||
|
|
||||||
|
# --- 21. board.sh contains no live NR==FNR (structural invariant) ----------
|
||||||
|
# F12: a third NR==FNR survived at the focus-filter join in plan() (fp_names x
|
||||||
|
# pf), next to two comments (1131-1138, 1294) that state the file's own rule -
|
||||||
|
# "never by NR==FNR" - as prose. Measured before writing this section (not
|
||||||
|
# assumed): for a plain two-file keep-set join with no third file whose lookup
|
||||||
|
# table a misroute could corrupt, an empty fp_names produces the SAME output
|
||||||
|
# (0 kept) under NR==FNR and under FILENAME== alike, because when fp_names is
|
||||||
|
# genuinely empty (0 repos anywhere declare the resolved focus slug) 0 kept
|
||||||
|
# IS the correct answer - unlike the two prior instances in this file, where
|
||||||
|
# an empty first file silently dropped a lookup table (ub[]/ow[]) consumed by
|
||||||
|
# a THIRD file. FOCUS_SLUGS is provably a subset of what focus_slugs() finds
|
||||||
|
# in $RECORDS, and focus_declares() re-checks the identical regex against the
|
||||||
|
# identical $RECORDS, so fp_names cannot be empty while fp_applied=1 in normal
|
||||||
|
# use - there is no reachable, observable defect here to pin behaviourally,
|
||||||
|
# and a --focus fixture asserting one would pass identically before and after
|
||||||
|
# this fix (verified with a standalone awk run, both forms, both empty and
|
||||||
|
# non-empty first files: identical output every time). The fix is therefore
|
||||||
|
# structural, not behavioural: line 1195 is a live counter-example to a rule
|
||||||
|
# this file states about itself, which is a trap for the next session that
|
||||||
|
# greps NR==FNR expecting every hit to be a bug and finds one that works.
|
||||||
|
grep -v '^[[:space:]]*#' "$BOARD" | grep -c 'NR==FNR' | grep -q '^0$'
|
||||||
|
check "board.sh has no live NR==FNR outside comments (the file's own stated rule)" $?
|
||||||
|
|
||||||
|
# Known-positive control: without this, the check above could be finding
|
||||||
|
# nothing because the filter is broken, not because the file is clean.
|
||||||
|
NRFNR_FIXTURE="${TMPDIR:-/tmp}/board-nrfnr-fixture.$$"
|
||||||
|
printf ' awk NR==FNR live code, not a comment\n' > "$NRFNR_FIXTURE"
|
||||||
|
grep -v '^[[:space:]]*#' "$NRFNR_FIXTURE" | grep -q 'NR==FNR'
|
||||||
|
check "the same filter+grep DOES find a live NR==FNR in a known-positive fixture" $?
|
||||||
|
/bin/rm -f "$NRFNR_FIXTURE" 2>/dev/null
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "board-selftest: $PASS passed, $FAIL failed"
|
echo "board-selftest: $PASS passed, $FAIL failed"
|
||||||
[ "$FAIL" -eq 0 ] || exit 1
|
[ "$FAIL" -eq 0 ] || exit 1
|
||||||
|
|
|
||||||
|
|
@ -1192,7 +1192,7 @@ plan() {
|
||||||
[ -n "$fp_d" ] && [ -f "$fp_d/STATE.md" ] || continue
|
[ -n "$fp_d" ] && [ -f "$fp_d/STATE.md" ] || continue
|
||||||
focus_declares "$fp_d" && printf '%s\n' "$fp_n"
|
focus_declares "$fp_d" && printf '%s\n' "$fp_n"
|
||||||
done > "$fp_names"
|
done > "$fp_names"
|
||||||
awk -F'|' 'NR==FNR{keep[$0]=1;next} keep[$4]' "$fp_names" "$pf" > "$fp_kept"
|
awk -F'|' -v NAMES="$fp_names" 'FILENAME==NAMES{keep[$0]=1;next} keep[$4]' "$fp_names" "$pf" > "$fp_kept"
|
||||||
/bin/rm -f "$fp_names" 2>/dev/null
|
/bin/rm -f "$fp_names" 2>/dev/null
|
||||||
mv "$fp_kept" "$pf"
|
mv "$fp_kept" "$pf"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue