From dd3f0c66c2d7f19a3fcd42eecee5d272545ea260 Mon Sep 17 00:00:00 2001 From: OffgridwithJD Date: Sat, 12 Sep 2026 00:41:24 +0000 Subject: [PATCH] docs: name the repair for the deeper-subshell premise, which is depth not looser (#961) #985's premise -- exactly one 'if (' at any indent in the extracted block -- closes a hole where a write inside a deeper subshell leaves the opener on the OUTER block, which holds one one-tab 'if (' and one stamp write, so every premise passed on a block wider than the call site. It cannot tell legitimate nesting from the case it exists for. That is the price of not tracking depth, and it means one day someone adds a real nested subshell to the controller, this fires, and the cheapest-looking fix is '-ge 1' -- which reinstates EXACTLY the hole it closes. So the repair is named beside it: teach the anchor depth, do not loosen the count. Raised by @linuxhikerpm as non-blocking on #985, and it is the same shape as the unset 'start' comment one premise above -- a guard that fires on a valid change invites a repair that looks like tidying up, and the comment is what stops it. Comment only: 14 lines added, ZERO non-comment lines changed, 859 checks on this branch and on main, ledger and budget untouched, docs_style 9/9, shellcheck clean. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01Uf6UoeBRZYLQZa4KxNiw8a --- .../460-the-controller-must-record-the-binary.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/selftest/460-the-controller-must-record-the-binary.sh b/test/selftest/460-the-controller-must-record-the-binary.sh index e2e60acf..c80c6da7 100644 --- a/test/selftest/460-the-controller-must-record-the-binary.sh +++ b/test/selftest/460-the-controller-must-record-the-binary.sh @@ -96,6 +96,20 @@ check "premise: the controller's stamp block was extracted exactly once" \ # Counting `if (` at ANY indent is what distinguishes them: the real block has one, # the nested shape has two. Cheaper than teaching the anchor to track depth, and it # fails closed -- a shape this does not understand is refused rather than driven. +# +# THE REPAIR, WHEN THIS EVENTUALLY FIRES ON A LEGITIMATE CHANGE: teach the anchor +# depth. DO NOT LOOSEN THE COUNT. +# +# It refuses legitimate nesting as well as the case it exists for, because it cannot +# tell them apart -- that is the price of not tracking depth. So one day someone adds +# a real nested subshell to the controller, this fires, and the cheapest-looking fix +# is `-ge 1`. That reinstates EXACTLY the hole this closes: a write inside a deeper +# subshell leaves the opener on the outer block, which holds one one-tab `if (` and +# one stamp write, so every premise here passes on a block wider than the call site. +# Measured when this was written: eight lines out, all premises green. +# +# Named beside the premise for the same reason the unset `start` above is named: a +# guard that fires on a valid change invites a repair that looks like tidying up. check "premise: nothing opens a deeper subshell inside the extracted block" \ "$(printf '%s\n' "$_c961_block" | grep -cE '^[[:space:]]*if \($')" "1" check "premise: and it holds exactly one stamp write" \