Skip to content

Commit 5aca73c

Browse files
committed
refactor(pm): state the transparent loop's bound structurally instead of guarding it
A length guard no head can reach is a line no case can pin. `before` is the slice ending where a match begins that runs to the head's last character, so every pass drops two characters or more and an empty head matches nothing. Claude-Session: https://claude.ai/code/session_01AmH9bKvGoLjiY86Q4Z3og2 Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 4fbe743 commit 5aca73c

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

‎scripts/pm/check-widening-tells.mjs‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3107,11 +3107,13 @@ export function closedSetMembership(side, index) {
31073107
* worth. The behaviour is pinned where it is now decided: by `extract` and
31083108
* `exclude` being absent from {@link NON_SET_CALLEE_NAMES}.
31093109
*
3110-
* ⛔ The loop terminates on the head's own LENGTH: every transparent step
3111-
* replaces the head with the text left of that call, which is strictly shorter
3112-
* because the callee and its paren are gone. The guard below states that as an
3113-
* invariant rather than trusting it, and answers `unread` — the loud direction —
3114-
* if it is ever false.
3110+
* ⛔ The loop terminates STRUCTURALLY, and it is written that way on purpose. A
3111+
* transparent step replaces the head with `before`, the slice ending where a
3112+
* match begins that runs to the head's LAST character and spans at least a
3113+
* callee and its paren — so every pass drops two characters or more, and an
3114+
* empty head matches nothing and answers `unread`. ⛔ A length guard here would
3115+
* be a line no head can reach and no case can pin, which is the shape this
3116+
* round exists to stop adding.
31153117
*
31163118
* @param {string} head — a `[` frame's `head`, the text left of the delimiter
31173119
* @returns {'declared'|'refused'|'unread'}
@@ -3130,7 +3132,6 @@ function arrayHeadMembership(head) {
31303132
// it does not know leaves the tell where it was.
31313133
return NON_SET_CALLEE_NAMES.includes(call.callee) ? 'refused' : 'unread';
31323134
}
3133-
if (call.before.length >= text.length) return 'unread';
31343135
text = call.before;
31353136
}
31363137
}

0 commit comments

Comments
 (0)