Commit 9799ffe
fix(devx): reject an interpolating template literal in check-cross-package-test-inputs' NEW_URL_LITERAL (#12113)
`NEW_URL_LITERAL`'s character class is byte-identical to `PATH_LITERAL`'s
(#11487/#12087) and shares the same blind spot: a backtick-delimited argument
holding no quotes matches it even when it is an interpolating template, so
`` new URL(`${someVar}`, import.meta.url) `` reads `${someVar}` as the literal
segment text and `walkLiteral()` counts it as one ordinary descent — biasing
the depth walk upward and, when the climb lands outside the package, adding a
fabricated NAME to the roster.
Unlike `PATH_LITERAL`'s call site, this one has no "cannot read, keep depth"
fallback to route into: `NEW_URL_LITERAL` has exactly one call site, directly
inside `pathExpression()`, with no enclosing loop. So the fix (a
`readableNewUrlLiteral()` wrapper, mirroring `readablePathLiteral()`'s shape
but scoped to this call site rather than sharing it) makes an interpolating
match return `null`, which flows straight into `pathExpression()`'s existing
"no call matched" path and returns `undefined` for the WHOLE `new URL(...)`
seed -- the same outcome as any other unrecognised seed shape, not a
depth-kept one. The self-test pins that outcome explicitly (does not flag, no
name), plus a control proving a non-interpolating backtick `new URL()` literal
is unaffected, and a control proving `${` inside a quoted (non-backtick)
literal is ordinary text, never interpolation.
Measured (Zone 2.3 of #12085): before this fix, an escaping interpolating
`new URL()` seed CAN push a fabricated NAME onto the roster (confirmed via a
temporary export of `scanPathExpressions()` and a fixture that climbs out of
its package), but `findEscapingPackages()`'s downstream
`statSync(...).isFile()` filter throws ENOENT on the fabricated literal and
drops it -- the same safety net #11487's Zone 2.3 found for `PATH_LITERAL`.
Today's blast radius was therefore smaller than the card's open question
implied; this fix closes the gap at the source regardless.
Both directions ablated: reverting the call-site wrapper alone (tests intact)
turns exactly the two new discriminating self-test cases red and leaves the
other 115 green, then the wrapper was restored and reverified at 117/117.
Fixes #12085
Co-authored-by: Claude <noreply@anthropic.com>1 parent d2cacbc commit 9799ffe
1 file changed
Lines changed: 56 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
578 | 578 | | |
579 | 579 | | |
580 | 580 | | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
581 | 602 | | |
582 | 603 | | |
583 | 604 | | |
| |||
659 | 680 | | |
660 | 681 | | |
661 | 682 | | |
662 | | - | |
| 683 | + | |
663 | 684 | | |
664 | 685 | | |
665 | 686 | | |
| |||
1991 | 2012 | | |
1992 | 2013 | | |
1993 | 2014 | | |
| 2015 | + | |
| 2016 | + | |
| 2017 | + | |
| 2018 | + | |
| 2019 | + | |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
| 2026 | + | |
| 2027 | + | |
| 2028 | + | |
| 2029 | + | |
| 2030 | + | |
| 2031 | + | |
| 2032 | + | |
| 2033 | + | |
| 2034 | + | |
| 2035 | + | |
| 2036 | + | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
1994 | 2049 | | |
1995 | 2050 | | |
1996 | 2051 | | |
| |||
0 commit comments