fix(reachability): whole-identifier API-route match (kill substring false-green)#202
Open
agjs wants to merge 2 commits into
Open
fix(reachability): whole-identifier API-route match (kill substring false-green)#202agjs wants to merge 2 commits into
agjs wants to merge 2 commits into
Conversation
…alse-green)
The API-registration check used a bare `apiRoutes.includes(`${camel}Routes`)`, so a
feature named `count` matched an unrelated slice's `accountRoutes` (`account` ⊃ `count`)
and was reported reachable even when its own `countRoutes` mount was genuinely absent — a
false green in the very check meant to catch unregistered (hollow) features (#50 class).
Guard the match with \p{ID_Continue} boundary lookarounds (same idiom as fieldIsMentioned),
so only a whole-identifier mount counts, while every real idiom (`count: countRoutes`,
`.use(countRoutes)`, `[countRoutes]`) still matches. Adds two regression tests.
…rPart)
Panel advisory: \p{ID_Continue} omits $, a valid JS IdentifierPart, so $countRoutes
(a distinct identifier) matched as a whole-word countRoutes. Add $ to the boundary class
— the exact JS IdentifierPart set (ID_Continue already covers _, ZWJ, ZWNJ, verified at
runtime). Adds a $-prefixed-sibling regression test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
checkFeatureReachable(the static anti-hollow-feature check, #50 class) verified API registration with a bare substring:So a feature named
countmatched an unrelated slice'saccountRoutes(account⊃count) and was reported reachable even when its owncountRoutesmount was genuinely absent — a false green in the very check meant to catch unregistered features. Same defect class as #201 (fieldIsMentioned), but higher-severity: it lets a truly-unreachable feature pass rather than fabricating a spurious test. (The UI check on the same function is safe — its/path delimiters block the suffix collision.)Fix
Match
${camel}Routesas a whole identifier via boundary lookarounds over the JS IdentifierPart set —[\p{ID_Continue}$]— the same idiom asfieldIsMentioned. Every real mount idiom still matches (count: countRoutes,.use(countRoutes),[countRoutes]); a substring (accountRoutes) or$-glued ($countRoutes) sibling does not.$is added because\p{ID_Continue}omits it;_/ZWJ/ZWNJ are already in\p{ID_Continue}(verified at runtime).Tests
Three regression tests: substring sibling (
accountRoutespresent,countabsent → flagged),$-prefixed sibling ($countRoutes→ flagged), and superstring co-registration (account+countboth mounted →countreachable). 12/12 pass, lint + typecheck clean.Review
Local 4-model harness-review panel: PASS (4/4). Two advisory findings (agreement 1) both claimed
\p{ID_Continue}excludes ZWJ/ZWNJ — empirically false (bun -econfirms ZWJ ∈ ID_Continue and the regex rejectsother\u200DcountRoutes); the one real gap ($) was incorporated.