Skip to content

tech-detect: a whole-bundle scan loses Contentful and Clarity that v0.0.140 found (inCode candidate limit?) #1422

Open

Description

@nc9

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 inCode detectors (Supabase, Firebase, Clerk); the Contentful and Clarity loss is not an inCode loss. See the amended first criterion.

Acceptance Criteria

nik

Activity

  1. added
    bug
    size: S
    on Oct 31, 2026
  2. added theissue type on Oct 31, 2026
  3. nc9 commented on Nov 1, 2026

    @nc9
    ContributorAuthor

    Cause, from reading the code and reproducing with synthetic bundles (no corpus site involved):

    nik

  4. nc9 commented on Nov 2, 2026

    @nc9
    ContributorAuthor

    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 inCode detectors (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 an inCode loss: both are script-url plus 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

  5. nc9 commented on Nov 4, 2026

    @nc9
    ContributorAuthor

    Acceptance check against main d7e9b44 (v0.0.167). The 4,096-candidate fix shipped in v0.0.155 (3c4497d).

    # Criterion Result Evidence
    1 Cause found on the 8 sites (or a minimal bundle) and written here NOT TICKED Cause for the inCode detectors is written and reproduced. The cause written for Contentful is incomplete, see below.
    2 The detector matches on those bundles read whole, within the whole-bundle perf budgets NOT TICKED The inCode part 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.
    3 A test with more than 64 string matches then one in code, passing after the fix PASS 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 with extras-budget-1420.test.ts on main.
    4 A corpus re-run shows no technology lost against v0.0.140 other than intended removals NOT TICKED Not met as worded, see below.

    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.

    • Clarity, 24 pairs: detected again in v0.0.164 and v0.0.165 for 23; 1 still lost (cause not found).
    • Contentful, 11 pairs: not detected in v0.0.164 or v0.0.165. This is not the inline-loader scoping written in the earlier comment: the v0.0.140 evidence was prose (for example "Largest Contentful Paint") matched by a word pattern that has since been tightened. That is an intended removal.

    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 inCode scope (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

  6. nc9 commented on Nov 5, 2026

    @nc9
    ContributorAuthor

    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.

    # Criterion Result Evidence
    1 Cause found on the 8 sites (or a minimal bundle) and written here NOT TICKED (wording) The inCode cause 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 not inCode and are not confirmed on the 8 named sites, see below.
    2 Detector matches on those bundles read whole, within the whole-bundle perf budgets NOT TICKED (wording) Holds for the inCode detectors: 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 with extras-budget-1420.test.ts). Not true of Contentful or Clarity as a candidate-limit question: neither is an inCode detector.
    3 A test with more than 64 string matches then one in code PASS (ticked earlier) in-code-candidates-1422.test.ts
    4 Corpus re-run shows no technology lost against v0.0.140 other than intended removals NOT TICKED The class that blocked it, 105 pairs in delay and consent wrapper script types, is fixed (77 of 77 deferred-loader, 3 of 3 consent-wrapper and 20 of 20 bundler-list pairs detected again on the v0.0.169 tree, details on #1550 and #1420). One pair named in this issue is still unexplained, see below.

    Final 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.

    • Clarity, 24 pairs: 23 are detected again since v0.0.164, 1 is still lost and its cause has not been found. The v0.0.169 re-run added 16 Clarity detections that the wrapper fix recovered; the corpus reports do not say whether the one open pair is among them, so I cannot claim it is explained.
    • Contentful, 11 pairs: not detected on v0.0.164, v0.0.165 or later. The v0.0.140 evidence was prose (for example "Largest Contentful Paint") matched by a word pattern that has since been tightened. This is an intended removal (the Contentful fingerprint now needs a URL or package form, Tech detection: script-url detectors stop seeing inline-loader URLs (Clarity snippet) once a page has script bodies attached #1430), not a candidate-limit loss.

    Proposed amendments (maintainer's call, original text to stay visible):

    1. The cause is found and written on this issue: the 64-candidate limit hit the inCode detectors (Supabase, Firebase, Clerk), reproduced on a minimal bundle; the Contentful loss is the old word pattern matching prose; the Clarity loss is 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, fix(tech-detect): read a long next/script snippet kept in a Next.js flight text row #1477 #1480, 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.
    2. The inCode detectors match on bundles read whole without raising per-detector work past what the whole-bundle perf tests allow (the hostile 5 MB and 8 MB bodies stay inside their budgets).

    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

  7. nc9 commented on Nov 15, 2026

    @nc9
    ContributorAuthor

    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.

  8. added
    blocked
    on Nov 20, 2026
  9. nc9 commented on Nov 20, 2026

    @nc9
    ContributorAuthor

    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.

    • AC2 and AC3: re-run today on main at f25906f: bun test packages/tech-detect/tests/in-code-candidates-1422.test.ts gives 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.
    • AC4: the re-run needs the 105 GB Product Hunt crawl corpus (165 archives). Today it is only on the local backup drive.
      • The Boat sandboxes the 37,248-site v0.0.140 vs v0.0.165 run used no longer exist.
      • The Modal page corpus doesn't hold these crawls.
      • The run stays parked until the corpus is on a compute host, and the issue stays blocked until then.

    nik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedbugclisize: S

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions