Repository navigation
Test selection finds tests for NodeNext .js imports and Rails specs - #4679
Merged
Merged
Conversation
Test selection now follows a TypeScript import written with the emitted extension (./x.js for x.ts) to its source, and maps a Rails file under app/ or lib/ to its RSpec spec by path, so these files no longer report no test lane. Fixes #4398; rebuilt from #4401 and #4211. Co-authored-by: mikhailsal <[email protected]> Co-authored-by: Ikraam Ghoor <[email protected]> Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
|
😎 This pull request was merged. |
…e specs An import written as ./x.js now resolves to x.ts or x.tsx before a compiled x.js, as tsc does; filesystem literals keep their path as written, so a .js-named fixture directory keeps its edge; and an RSpec spec under an engine's own spec/ maps to that engine's app/ and lib/ files. The changelog fragment now says exactly which cases are covered. Review-Finding: p1v/adversarial-native#1 reader=adversarial-native Review-Finding: p1v/adversarial-native#2 reader=adversarial-native Review-Finding: p1v/adversarial-native#3 reader=adversarial-native Review-Finding: p1v/outside-voice#2 reader=outside-voice Review-Finding: p1v/outside-voice#3 reader=outside-voice Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…uide docs/pregate.md now lists the RSpec spec-to-source convention, including engine roots, and explains that NodeNext imports written with the .js extension resolve to their TypeScript source first. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This was referenced Nov 22, 2026
Merged
3 tasks done
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.
In TypeScript repos that import
./x.jsforx.ts(NodeNext) and in Rails repos, touched source files now get their tests instead of none.Why:
/verifyand/shipfound no tests for these files even though tests covered the files (#4398, #4211).Nothing to do: a Rails file maps only when its spec exists at the conventional path.
What changed
lib/pregate/import-graph.ts: an import written as./x.js(or.jsx,.mjs,.cjs) resolves to its TypeScript source first (x.ts, thenx.tsx;.tsx,.mts,.cts), as tsc does, then to the path as written. Path string literals keep naming the file as written.[<root>/]spec/<path>_spec.rbselects[<root>/]app/<path>.rbor[<root>/]<path>.rbwhen that file exists, at the repo root or under an engine's root.test/pregate-import-graph-paths.test.tsand the newtest/pregate-rspec-convention.test.ts;docs/pregate.mddocuments both rules.Why
Test selection found no tests for these files, so the checks stopped or asked for hand-written mappings (#4398). Rebuilt on current main from #4401 by @mikhailsal and #4211 by @ikraamg, credited as co-authors.
Blast radius
Only test selection changes, and almost always more files map to tests. One narrow loss: when a committed
x.jssits beside itsx.tssource, a plain-JS file that imports./x.jsnow maps tox.ts, so a test that reachesx.jsonly through that file is no longer selected locally for a change tox.js(CI still runs it). A repo whose declared runner cannot run Ruby treats a mapped spec as not run and not counted, as it does for Python today; with no remote check configured, nothing then runs that spec before CI. The docs' note that request and system specs are not mapped holds only because noapp/requests/orapp/system/source normally exists; the rule itself does not exclude them.Documentation
Scope: the branch diff against c2b4f0d2. It changes the test selector in
lib/pregate/import-graph.ts, adds two tests, and adds a changelog.d fragment. The working tree had no staged, unstaged or untracked changes. Result:docs/pregate.md(test selection) now lists RSpec's spec/_spec.rb to app/.rb or .rb convention, including engine roots, and says request and system specs are not mapped. It also documents that NodeNext emitted-extension imports (./x.js for x.ts or x.tsx, .jsx to .tsx, .mjs to .mts, .cjs to .cts) resolve to their TypeScript source first, before the path as written. The changelog.d fragment was already accurate. Debt: none found; no other doc describes selector resolution.Agent notes
Plan: exempt: bug fix
Ruled note: lib/pregate/import-graph.ts:556:outside-voice at 549f94b ruled by GSTA-36 (relayed from GSTA-36:2026-11-22T06:36:45Z) at 2026-11-22T06:36:45.607Z: documented pass-with-note policy for runner-dropped files; below the blocking floor (approval a-6a010a528991)
Review notes (below the blocking floor, not fixed): a nested
spec/lib/spec/path loses its root mapping; TS-first resolution also applies when the importer is plain.js;vi.mock('../x.js')literals do not reachx.ts(no worse than main).Fixes #4398
Refs #4211
Refs #4401
Refs p1v/adversarial-native#1
Refs p1v/adversarial-native#2
Refs p1v/adversarial-native#3
Refs p1v/outside-voice#2
Refs p1v/outside-voice#3
Related: #4401 (@mikhailsal)
Approvals
Approved: yes (record r-de9ed29ebdfc). The full approval record stays private.
Plan: exempt: bug fix
Plan check: exempt bug fix