Commit 8d5c724
fix(devx): reject an interpolating template literal in check-cross-package-test-inputs' PATH_LITERAL (#12087)
`PATH_LITERAL`'s character class excludes only quote characters, so a
backtick-delimited argument holding no quotes matches it even when it is an
interpolating template — `` `${someVar}` `` reads as the literal segment text
`${someVar}` and `walkLiteral()` counts it as ONE ordinary descent, biasing
the depth walk upward instead of taking the documented cannot-read path. That
inverts the file's own stated invariant ("an argument this scan cannot read
leaves the DEPTH walk where it was ... since the escape verdict is a lower
bound"): an unreadable argument is safe, and a template read as readable was
LESS safe than unreadable.
`PATH_LITERAL` has exactly one call site in this file (inside
`pathExpression()`'s `resolve`/`join` argument walk), so narrowing it moves no
other consumer's verdict. The fix wraps that one call in
`readablePathLiteral()`, which rejects a backtick literal containing `${` and
falls back to the existing unreadable-argument branch (name dropped, depth
preserved) — the resolver itself now makes "never a wrong name" true by
construction, rather than relying on `findEscapingPackages()`'s downstream
`statSync(...).isFile()` filter to drop a fabricated roster entry. A
non-interpolating backtick literal is unaffected and continues to be read
(and named) exactly as a quoted literal would.
Both directions pinned in --self-test with the card's own fixture pair (same
climb, same file, only the middle argument differs), plus a control proving
the narrowing does not overshoot a plain backtick literal.
`NEW_URL_LITERAL` has the identical character-class shape and is filed
separately as #12085 — a structurally different call path, out of scope here.
Claude-Session: https://claude.ai/code/session_01UjM2ia8Av1v5NqfqQEQmC6
Co-authored-by: Claude <noreply@anthropic.com>1 parent 93949f1 commit 8d5c724
1 file changed
Lines changed: 52 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
557 | 557 | | |
558 | 558 | | |
559 | 559 | | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
560 | 581 | | |
561 | 582 | | |
562 | 583 | | |
| |||
650 | 671 | | |
651 | 672 | | |
652 | 673 | | |
653 | | - | |
| 674 | + | |
654 | 675 | | |
655 | 676 | | |
656 | 677 | | |
| |||
1940 | 1961 | | |
1941 | 1962 | | |
1942 | 1963 | | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
1943 | 1994 | | |
1944 | 1995 | | |
1945 | 1996 | | |
| |||
0 commit comments