Repository navigation
Test selection finds tests for TypeScript files imported with a .js extension - #4401
mikhailsal wants to merge 1 commit into
Conversation
TypeScript's NodeNext (and bundler) convention imports a source file by
its emitted name: `import { x } from './x.js'` names `x.ts`. The import
graph only appended extensions, so `./x.js` never matched `x.ts`, every
such edge was dropped, and in a repo written this way every touched
source file came out with no test lane (UNMAPPED in /verify,
PREGATE_NO_LANE / PREGATE_NO_POLICY in pregate), including test helpers
imported by the tests themselves.
resolveCandidate now also tries the TypeScript counterpart of a `.js`,
`.jsx`, `.mjs` or `.cjs` specifier (`.ts`, `.tsx`, `.mts`, `.cts`) after
the existing extension list, so a real `.js` file still wins.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
I'm not going to do the liveness screenshot, it's not worth my time. The fix is three lines plus a regression test, with before/after evidence above and in #4398. If that's not enough and you don't care about the bug, feel free to close this and live with it. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Thank you. This is the fix for #4398, and it's small and correct: trying the TypeScript counterpart after the existing extension list keeps real |
Why (in your own words)
In a TypeScript repo that uses NodeNext resolution, imports are written with the emitted extension:
'./x.js'forx.ts. pregate's import graph only appended extensions, so it never matched these imports. Every touched source file then had no test lane,/verifystopped atUNMAPPED, and pregate atPREGATE_NO_POLICY/PREGATE_NO_LANE, even though dozens of tests import those files. This change makesresolveCandidatealso try the TypeScript counterpart of a.js/.jsx/.mjs/.cjsspecifier. It does so after the existing extension list, so a real.jsfile still wins.Fixes #4398
Live evidence
The real repo is mikhailsal/telegram-harness-cli, a NodeNext TypeScript project. Here is the
/verifytest selection for its PR #9 diff:I also probed
buildGraph+testsForon the same repo, before → after:src/core/results.ts0 → 30 tests,src/channels/catalog.ts0 → 57,src/core/events.ts0 → 30,tests/core/continuation-fixture.ts0 → 2.The new test in
test/pregate-import-graph-paths.test.tsfails without the fix and passes with it:Scope
lib/pregate/import-graph.ts(resolveCandidate, +3 lines) and one new test case./verifytest selection on the NodeNext repo above (UNMAPPED → PASS), plus the probe and tests above..js→.tsrewrite (for examplemoduleSuffixes).Liveness proof (required for external contributors)
Checklist
GSTACK PRtyped live into a real surface) or PR author is @garrytan (owner exemption)🤖 Generated with Claude Code