Repository navigation
Description
What
Follow-up to #1420 and #1387. In the offline corpus re-run (10,133 sites), an uncapped research build of tech detection (whole bundles) still found fewer sites than v0.0.140 for two technologies: Contentful (4 sites that v0.0.140 detected) and Clarity (4 sites that v0.0.140 detected). The extras budget cannot explain it (an uncapped body is read whole), so the cause is something else in how a whole body is matched. The likely one is MAX_IN_CODE_CANDIDATES (64): an inCode detector inspects the first 64 matches of its pattern and gives up, and a whole bundle has far more matches inside strings and comments than a 256 KB head, so the real code match is never reached.
Note 2026-11-02: the title names Contentful and Clarity, but the 64-candidate limit this issue found affects only the
inCodedetectors (Supabase, Firebase, Clerk); the Contentful and Clarity loss is not aninCodeloss. See the amended first criterion.
Acceptance Criteria
- The cause is found on the 8 sites with the corpus (or a minimal bundle that reproduces it) and written on this issue. (amended 2026-11-02: the 64-candidate limit applied only to the
inCodedetectors (Supabase, Firebase, Clerk) and is now 4,096 candidates with the miss past it documented; the Contentful and Clarity loss was the inline-loader scoping of Tech detection: script-url detectors stop seeing inline-loader URLs (Clarity snippet) once a page has script bodies attached #1430, restored by Tech detection: inline loaders behind LiteSpeed, Rocket Loader or a large Next.js flight script are no longer read (Clarity −29 sites since v0.0.149) #1435 and fix(tech-detect): read a long next/script snippet kept in a Next.js flight text row #1477 #1480 and extended by feat(tech-detect): detect Microsoft Clarity from its loader in a first-party bundle #1488 #1489 and fix(tech-detect): read every use of a component ref that is next/script somewhere on the page #1487 #1490 since; the cause on the 8 named sites is not confirmed, which is the corpus step of criterion 4) (2026-11-15: the inCode candidate limit for Supabase/Firebase/Clerk, plus Tech detection: script-url detectors stop seeing inline-loader URLs (Clarity snippet) once a page has script bodies attached #1430's inline-loader scoping for Contentful/Clarity, restored by Tech detection: inline loaders behind LiteSpeed, Rocket Loader or a large Next.js flight script are no longer read (Clarity −29 sites since v0.0.149) #1435/fix(tech-detect): read a long next/script snippet kept in a Next.js flight text row #1477 #1480; the single unexplained Clarity pair moves to tech-detect: one Clarity pair still lost against v0.0.140 (residual from #1422) #1996) -
The detector matches on those bundles when read whole, without raising the per-detector work past what the whole-bundle perf tests allow (the hostile 5 MB and 8 MB bodies stay inside their budgets).(amended 2026-11-15 to the inCode scope) - The inCode detectors match on whole bundles without raising per-detector work past the whole-bundle perf budgets (packages/tech-detect/tests/in-code-candidates-1422.test.ts, including the 5 MB and 8 MB budget cases)
- A test reproduces the loss with a bundle where the pattern first matches more than 64 times inside strings or comments and once in code, and passes after the fix.
-
A corpus re-run shows no technology lost against v0.0.140 other than intended removals.(amended 2026-11-15) - A corpus re-run shows no technology lost against v0.0.140 other than intended removals and the one Clarity pair tracked in tech-detect: one Clarity pair still lost against v0.0.140 (residual from #1422) #1996
nik
Activity
fix(tech-detect): an inCode detector reads past strings that quote it…
fix(tech-detect): an inCode detector reads past strings that quote it…
nc9 commentedon Nov 1, 2026
Cause, from reading the code and reproducing with synthetic bundles (no corpus site involved):
inCodedetectors (Supabase, Firebase, Clerk),matchesInCodeinspected the first 64 pattern matches and gave up. Each match that starts inside a string (docs text, an error message, a vendor snippet quoting a config) used one, 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. That is real, and fix(tech-detect): an inCode detector reads past strings that quote its pattern #1422 #1485 fixes it (the search continues past the string a match was in, and the bound is 4,096, a silent miss past it).inCodedetector: Contentful is ascript-urlsignature plusctfassets.netin the HTML, Clarity ascript-urlsignature, so the 64-candidate limit never ran for them. Their loss against v0.0.140 comes from the inline-loader scoping introduced by Tech detection: script-url detectors stop seeing inline-loader URLs (Clarity snippet) once a page has script bodies attached #1430, restored by Tech detection: inline loaders behind LiteSpeed, Rocket Loader or a large Next.js flight script are no longer read (Clarity −29 sites since v0.0.149) #1435 (v0.0.150) and fix(tech-detect): read a long next/script snippet kept in a Next.js flight text row #1477 #1480 (v0.0.154); feat(tech-detect): detect Microsoft Clarity from its loader in a first-party bundle #1488 #1489 and fix(tech-detect): read every use of a component ref that is next/script somewhere on the page #1487 #1490 (a Clarity bundle detector and a bare script child in a flight payload) are in review. The criteria still open on this issue are the first (cause on the 8 sites: written here for the code path, but not confirmed on those sites) and the last (a corpus re-run against v0.0.140), so it stays open.nik
fix(tech-detect): an inCode detector reads past strings that quote it…
nc9 commentedon Nov 2, 2026
Amended the first criterion (original kept visible) and added a note under the body. The 64-candidate limit this issue found applied only to the
inCodedetectors (Supabase, Firebase, Clerk); it is now 4,096 candidates, a config past the 4,096th look-alike string match is still missed, and the docs say so. The Contentful and Clarity loss in the title is not aninCodeloss: both arescript-urlplus html detectors, and the cause was the inline-loader scoping of #1430, restored by #1435 and #1480 and extended by #1489 and #1490 since (the cause on the 8 named sites is not confirmed). Criteria 2 to 4 are unchanged; criterion 4 (the corpus re-run against v0.0.140) is a corpus step.nik
nc9 commentedon Nov 4, 2026
Acceptance check against main d7e9b44 (v0.0.167). The 4,096-candidate fix shipped in v0.0.155 (3c4497d).
inCodedetectors is written and reproduced. The cause written for Contentful is incomplete, see below.inCodepart holds (the 8 MB hostile test passes), but the premise that the candidate limit explains the 8 named sites is not true for Contentful or Clarity.packages/tech-detect/tests/in-code-candidates-1422.test.ts: "65 separate mentions in strings, then the config in code, is found", "3,000 separate mentions...", the exact bound of 4,096, "comments are blanked...". 100 pass withextras-budget-1420.test.tson main.Corpus evidence (offline re-detect over stored pages of 37,248 sites, v0.0.140 against v0.0.165): the Clarity and Contentful pairs this issue names are 35 pairs here.
So the cause for Contentful is the old word pattern matching prose, and for Clarity it is the loader scoping, now restored for 23 of 24. For criterion 4 the same blocker as #1420 applies: 105 pairs where a real loader sits in a delayed-loader wrapper type (tracked on #1550, fix in progress, not shipped).
Needed to close: the 1 remaining Clarity pair explained, criteria 1 and 2 amended to the
inCodescope (or re-proven for Clarity and Contentful), and the corpus re-run after the wrapper fix.Ticked 3; left open for 1, 2 and 4.
nik
nc9 commentedon Nov 5, 2026
Acceptance check against main 7e8416b (v0.0.169). Criterion 3 stays ticked. Criteria 1, 2 and 4 stay unticked; two of them need new wording and one has a single unexplained pair.
inCodecause is written and reproduced:packages/tech-detect/tests/in-code-candidates-1422.test.ts("65 separate mentions in strings, then the config in code, is found", the exact 4,096 bound). The Contentful and Clarity causes are notinCodeand are not confirmed on the 8 named sites, see below.inCodedetectors: the same file, "hostile bodies stay bounded: 8 MB of mentions with no real match, and one match in code at the very end", passes on main (100 pass withextras-budget-1420.test.ts). Not true of Contentful or Clarity as a candidate-limit question: neither is aninCodedetector.in-code-candidates-1422.test.tsFinal numbers for the pairs this issue names (offline re-detect over stored pages of 37,248 sites, v0.0.140 against v0.0.165, then the fixed trees on a 2,795-site slice): 35 pairs.
Proposed amendments (maintainer's call, original text to stay visible):
With those two wordings, 1 and 2 are met on the evidence above. Criterion 4 can be ticked once the remaining Clarity pair is explained (or the maintainer accepts one unexplained pair as a residual), since it is the same claim as the last criterion of #1420, which I have now closed.
nik
nc9 commentedon Nov 15, 2026
Amended per the maintainer's direction (originals struck, still visible). AC1 is ticked (cause recorded). AC2 is amended to the inCode detectors and ticked on in-code-candidates-1422.test.ts (5 MB and 8 MB budget cases). The one unexplained Clarity pair moves to #1996. AC4 is amended to allow that pair but stays OPEN: the latest cited corpus evidence (#1422 (comment)) is the v0.0.140 versus v0.0.165 re-detect over 37,248 sites, followed only by a v0.0.169 re-run on a 2,795-site slice. There's no full corpus run against v0.0.140 that leaves exactly that one pair to cite. This closes once such a run is posted.
nc9 commentedon Nov 20, 2026
AC1 to AC3 hold on main. AC4, the corpus re-run against v0.0.140, is parked until the Product Hunt crawl corpus is staged on a compute host.
bun test packages/tech-detect/tests/in-code-candidates-1422.test.tsgives 8 pass, 0 fail. That includes "65 separate mentions in strings, then the config in code, is found" and the 8 MB bounded-body case.nik