Repository navigation
Conversation
nc9
force-pushed
the
fix/in-code-candidates-1422
branch
from
November 1, 2026 06:13
55019d6 to
3c87b71
Compare
…s pattern, up to 4,096 candidates #1422 Signed-off-by: Nik Cubrilovic <[email protected]>
nc9
force-pushed
the
fix/in-code-candidates-1422
branch
from
November 1, 2026 06:13
3c87b71 to
a7c86b1
Compare
This was referenced Nov 1, 2026
Merged
Merged
Contributor
Author
|
Landed in v0.0.155 as nik |
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.
Refs #1422 (the candidate limit and its test; the corpus criteria are runs over stored crawls and are not done here).
Cause, for the
inCodedetectors.matchesInCodeinspected the first 64 matches of the pattern and gave up; each match that starts inside a string (docs text, an error message, a vendor snippet quoting a config) used one of the 64, so a whole bundle (the local scan reads up to 8 MB, against a 256 KB head) could hold more than 64 before the real config in code, which was never reached. This affects Supabase, Firebase and Clerk, theinCodedetectors.Not the cause for Contentful and Clarity. Neither is an
inCodedetector: Contentful is ascript-urlsignature plusctfassets.netin the HTML, and Clarity ascript-urlsignature, so the 64-candidate limit never ran for them. The loss against v0.0.140 for those two is the inline-loader scoping that #1430 introduced and #1435 (v0.0.150) and the flight-payload fixes (#1437, #1477) then restored; the issue's own sites need a corpus re-run on the current head to confirm nothing is left. I could not reproduce them without the stored crawls.matchesInCode: after a match that starts in a string, the search continues past that string (stringEnd, new injs-scan.ts), so many mentions inside one string are one candidate. The candidate bound is 4,096 (was 64): the matches go forward over the body once, so this bounds the work per detector (and the hostile 8 MB test stays under its budget), not correctness.in-code-candidates-1422.test.ts, 5; 3 fail on main): 65 and 3,000 separate string mentions then the config in code are found; 20,000 mentions in one string then the config is found; a config only in comments and strings is still not detected; 8 MB of mentions with no real match, and one real match past the bound, finish under the time budget. The bundle-content, fingerprint, pattern-bound, local-caps, real-build, supabase-signature and extras-budget suites pass.Review round 1: rebased onto main (the
COLLECTED_TAGSimport kept besidestringEnd); a test pins the boundary (the config after 4,095 string mentions is the 4,096th candidate and is found; after 4,096 or 4,097 it is not reached), directstringEndtests (inside, opening quote, code, past the end, and agreement withinStringfor every index of a mixed body), and thebundle-sample.tscomment now says the matcher's bound is 4,096. The cap is a silent miss: a config after more than 4,095 look-alike matches in strings is not found and no truncation signal says so;MAX_HIT_SCANS_PER_HINT(512 hits per hint in a capped scan) is a second silent cap of the same kind. Both are stated in the docs and the CHANGELOG; this PR adds no new behaviour for them. Stays "Refs": #1422 is not closed by this (see its comment).Skill: no change needed.
nik