fix(render): stop my own comment from re-arming the grep trap #19

Merged
bosun merged 1 commit from i/defuse-grep into main 2026-07-13 14:14:06 +02:00
Owner

I planted a landmine in the commit that defused one. Engineer caught it.

PR #16's comment quoted the buggy copy verbatim to explain it. So a grep for the bug string hits the prose explaining that the bug is gone — the identical false positive that cost Surveyor ten seconds this morning, re-armed inside the very commit that fixed the bug. The code that removes the lie contained prose quoting the lie.

It is still armed on main right now:

main/src/render.js:247   // It used to say "SPACE FOR BLOCK n+1" ...   <- prose
main/src/render.js:248   // it promised "SPACE FOR BLOCK 6" ...        <- prose
main/src/render.js:259   : `BLOCK ${s.level} DOWN — SPACE FOR BLOCK ${s.level + 1}`   <- the CODE, correct

Three hits, zero bugs. And PR #16 made it worse than it was: the string is now also legitimate live code on the mid-campaign branch, so even a careful reader has to work out which of three hits is real.

The fix

The lie is described, never quoted. The string now appears exactly once in the file — in the code, on the branch where it's correct.

Grep cannot tell code from commentary about code. Don't make it try.

Also folded in, because it belongs next to the code and not in a PR nobody re-reads

Engineer's proof that the restored line cannot lie:

!isFinalLevel  =>  levelIndex <= levelCount - 2
               =>  level + 1  <= levelCount      the promised block always exists

The promise is fenced by the exact predicate that makes it true — there's no off-by-one left to find.

And the property that makes it safe structurally rather than luckily (Surveyor's tier-3): isFinalLevel is derived on read, not stored, so no future update path can forget to set it. An absent field would be falsy, take the else branch, and silently promise a block that isn't there — the original bug restored by a missing field rather than a missing fact. That hazard is closed by construction, and the comment now says so.

Verification

Bug string occurrences in render.js: 1 (was 3). Surveyor's gate clean; both branches of the final-wall check still PASS.

🤖 Generated with Claude Code

**I planted a landmine in the commit that defused one.** Engineer caught it. PR #16's comment **quoted the buggy copy verbatim** to explain it. So a `grep` for the bug string hits the prose explaining that the bug is *gone* — the identical false positive that cost Surveyor ten seconds this morning, **re-armed inside the very commit that fixed the bug.** The code that removes the lie contained prose quoting the lie. It is still armed on `main` right now: ``` main/src/render.js:247 // It used to say "SPACE FOR BLOCK n+1" ... <- prose main/src/render.js:248 // it promised "SPACE FOR BLOCK 6" ... <- prose main/src/render.js:259 : `BLOCK ${s.level} DOWN — SPACE FOR BLOCK ${s.level + 1}` <- the CODE, correct ``` Three hits, zero bugs. And PR #16 made it worse than it was: the string is now *also* legitimate live code on the mid-campaign branch, so even a careful reader has to work out which of three hits is real. ## The fix The lie is **described**, never **quoted**. The string now appears **exactly once** in the file — in the code, on the branch where it's correct. **Grep cannot tell code from commentary about code. Don't make it try.** ## Also folded in, because it belongs next to the code and not in a PR nobody re-reads Engineer's proof that the restored line *cannot* lie: ``` !isFinalLevel => levelIndex <= levelCount - 2 => level + 1 <= levelCount the promised block always exists ``` The promise is fenced by the exact predicate that makes it true — there's no off-by-one left to find. And the property that makes it safe **structurally rather than luckily** (Surveyor's tier-3): `isFinalLevel` is **derived on read, not stored**, so no future update path can forget to set it. An absent field would be falsy, take the else branch, and silently promise a block that isn't there — the original bug restored by a missing *field* rather than a missing *fact*. That hazard is closed by construction, and the comment now says so. ## Verification Bug string occurrences in `render.js`: **1** (was 3). Surveyor's gate clean; both branches of the final-wall check still PASS. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
PR #16's comment QUOTED the buggy copy verbatim to explain it. So a grep for the
bug string hit the prose explaining the bug was GONE — the identical false
positive that cost Surveyor ten seconds this morning, re-armed inside the very
commit that fixed it. The code that removes the lie contained prose quoting the
lie. Engineer caught it.

The lie is now DESCRIBED, never quoted. The string appears exactly once in this
file: in the code, on the branch where it is correct. Grep cannot tell code from
commentary about code — don't make it try.

Also records, next to the code, why the line cannot lie — Engineer's proof, which
belongs here rather than in a PR nobody re-reads:

  !isFinalLevel  =>  levelIndex <= levelCount - 2
                 =>  level + 1  <= levelCount     the promised block always exists

And names the property that makes it safe STRUCTURALLY rather than luckily:
isFinalLevel is derived on read, not stored, so no future update path can forget
to set it. An absent field would be falsy, would take the else branch, and would
silently promise a block that isn't there — which is the original bug restored by
a missing field rather than a missing fact.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbnWrAAh3iGuPAQF53nuXG
bosun merged commit c37ef778a0 into main 2026-07-13 14:14:06 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
frankenbit/breakout!19
No description provided.