Repository navigation
fix(tech-detect): read every use of a component ref that is next/script somewhere on the page #1487 - #1490
Closed
nc9 wants to merge 1 commit into
Closed
fix(tech-detect): read every use of a component ref that is next/script somewhere on the page #1487#1490nc9 wants to merge 1 commit into
nc9 wants to merge 1 commit into
Conversation
nc9
force-pushed
the
fix/flight-script-ref-1487
branch
from
November 1, 2026 06:08
6fbe6e0 to
71ab480
Compare
5 of 6 tasks
…pt somewhere on the page #1487 Signed-off-by: Nik Cubrilovic <[email protected]>
nc9
force-pushed
the
fix/flight-script-ref-1487
branch
from
November 1, 2026 06:53
71ab480 to
dcd55a1
Compare
This was referenced Nov 1, 2026
Merged
Contributor
Author
|
Landed in v0.0.155 as nik |
This was referenced Nov 1, 2026
Closed
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 #1487. (#1480 has merged; this is on main.)
#1487's residual: a Clarity loader in a Next.js layout
<head>that the reader skipped. Evidence: a masked row from a real corpus site shows the layout passing the Clarity loader as a bare{ "type": "text/javascript", "children": "<snippet>" }beside two uses of the same component reference that carrysrcplusstrategy: "afterInteractive"andidplusstrategypluschildren; the loader use has noidand nostrategy, and the reference resolves to a numeric module id with no path. The earlier\\\"was only JSON escaping.flightLoaderText: the refs that arenext/scriptsomewhere on the page, i.e. any use with astrategythat is one of the fournext/scripttakes (afterInteractive,lazyOnload,beforeInteractive,worker). Only rows that mention"strategy"are parsed for it, so a payload without one pays a substring search. Pass 2 (unchanged) then reads every use of such a ref as a script:src,__html,children, with the data-type check. Tighter than accepting a bare{ type, children }by shape: a ref never seen with a strategy is not read, and a lookalike component's ownstrategyprop (not one of the four) does not promote it.parseRowsis unchanged); tested with ASCII and multi-byte text.flight-script-narrow-1437.test.ts, 58 in the file; the two positives fail without the promotion): the bare instance is read whichever order the three uses come in; a JSON row right after a text row; a ref never seen with script props that shows a code sample is not read; a lookalikestrategydoes not promote; a code sample in apreand a data-typed use stay dropped; 20,000 refs, half with script props, stay under 1 s (about 170 ms measured). The fix(tech-detect): read a long next/script snippet kept in a Next.js flight text row #1477 #1480 amplification and the tech-detect: a Next.js flight script re-opens the prose, link and metadata false-positive classes for script-url signatures #1437 negatives still pass; the other flight, markup and bundle suites pass; tsgo is clean.Review round 1: tests that kill the pass-1 guards: once the node budget is spent no later row is parsed for pass 1 (JSON.parse is spied: 3 calls, not 53), a strategy use nested past the depth guard does not promote its ref while one 10 levels deep does, and only rows that mention a strategy are parsed (103 parses for 100 plain rows, not 203). Pass 1 now ends at its budget for the page, not per row. Rebased onto main as a single commit (the #1480 commits are in main).
Skill: no change needed.
nik