Repository navigation
Conversation
The import graph read tsconfig paths and baseUrl from the repository root only, so a test under apps/mobile that imports '@/media/close-bar' through apps/mobile/tsconfig.json was invisible and the source file it covers had no test to run. Each importing file now takes its aliases from the nearest tsconfig.json or jsconfig.json above it that declares paths or baseUrl; a nested config that declares neither defers to the next one up, and the root config governs the rest. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
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 |
5 tasks done
capy-ai Bot
added a commit
that referenced
this pull request
Nov 17, 2026
…wn @/ alias (#4464) /ship's pre-push test selection now finds the tests of a monorepo app that imports through its own `@/` alias (for example `apps/mobile` mapping `@/*` to `./src/*`). Why: only the root tsconfig was read, so every touched file in such an app failed with `PREGATE_NO_LANE` even with a test beside it. Rebuilt from #4462 by @dtoelke, who found and fixed it; thank you. Nothing to do: a repo whose only tsconfig is at the root (gstack itself) resolves exactly as before. Co-authored-by: stackpt-agent <[email protected]> Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: p1/specialist-batched#1 reader=testing Review-Finding: p2v/outside-voice#1 reader=outside-voice
Contributor
|
Thank you, @dtoelke. You found a real gap and diagnosed it clearly: monorepo apps with their own |
Contributor
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.
The checks that run before a PR opens now find the tests of a monorepo app that imports through its own
@/alias.Why: only the repository root's tsconfig was read for
paths, so every source file in such an app failed as having no test, even with a test right beside it.Nothing to do: a repo whose only tsconfig is at the root resolves exactly as before.
Why (in your own words)
Our monorepo has an Expo app at
apps/mobilewhosetsconfig.jsonmaps@/*to./src/*. Its tests import the code they cover as@/media/close-bar./shipstopped on 14 touched files in that app withPREGATE_NO_LANE, because the import graph readspathsandbaseUrlfrom the root tsconfig only and could not follow any@/import underapps/mobile. The--explainoutput even names the gap ("specifiers in test files that resolve to no repo file ... or report the resolver gap"). The only workaround was adependenciesentry per source file.This change reads each file's aliases from the nearest tsconfig.json or jsconfig.json above it that declares
pathsorbaseUrl(itself or through a relativeextends). A nested config that declares neither defers to the next one up, and the root config governs everything else, so no file loses an alias it has today.Live evidence
repro.shbuilds a throwaway repo: a policy with adependencieskey,apps/mobile/tsconfig.jsonwith"paths": { "@/*": ["./src/*"] },apps/mobile/src/media/close-bar.ts, and a test beside it that imports@/media/close-bar. A branch editsclose-bar.ts, then it runsgstack-pregate --base main --allow-repo-commands --stage tests --only lanes --explain. Temp paths are shortened to<tmp>.Before, on main at e1cfcea:
After, on this branch:
The three new tests in
test/pregate-import-graph-paths.test.tsfail on main and pass here:The reproduction script:
Scope
lib/pregate/import-graph.ts(readPathAliasestakes a directory; newpathAliasResolverpicks the governing config per importing file;buildGraphuses it), three tests, one paragraph indocs/pregate.md, a changelog fragment.bun run typecheck;test/pregate-import-graph-paths.test.ts; the six other test files that use the import graph, where no test fails here that does not also fail on main. It has also run in a private pnpm monorepo's/shipsince 2026-11-11.bun run test).Liveness proof (required for external contributors)
Checklist
GSTACK PRtyped live into a real surface) or PR author is @garrytan (owner exemption)