Skip to content

Pre-push test selection finds tests in monorepo apps that use their own @/ alias - #4464

Merged
capy-ai[bot] merged 3 commits into
mainfrom
nested-tsconfig-path-aliases
Nov 17, 2026
Merged

capy-ai[bot] merged 3 commits into
mainfrom
nested-tsconfig-path-aliases

Conversation

@garrytan

@garrytan garrytan commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

/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.

What changed

A monorepo app's own @/ alias now maps its source file to the test beside it

A monorepo app's own @/ alias now maps its source file to the test beside it.

Before/after as text: A monorepo app's own @/ alias now maps its source file to the test beside it
--- Before · before.txt · captured output
+++ After · after.txt · captured output
 $ testsFor apps/mobile/src/media/close-bar.tsx   # apps/mobile/tsconfig.json maps @/* to ./src/*
+tests: apps/mobile/src/media/close-bar.test.tsx
-tests: (none) -> PREGATE_NO_LANE
 

"My app's tests sit right next to the file, but /ship says there is no test for it." Each JS/TS file now takes its paths and baseUrl from the nearest tsconfig.json or jsconfig.json above it that declares them, itself or through a relative extends inside the repository. A nested config that declares neither defers to the next one up, and the root config governs the rest. Config files are read only when they resolve inside the repository and are under 1 MB, so a tracked tsconfig that is a symlink to a file outside the repository, or to a device such as /dev/zero, is skipped instead of read.

Why

"Every touched file in apps/mobile failed with PREGATE_NO_LANE even though its test was right beside it" (#4462). Monorepos with per-app aliases now get their tests picked before the push, and gstack's own single-tsconfig layout is unchanged.

Blast radius

Only buildGraph in lib/pregate/import-graph.ts changes: its callers (test selection, the flaky-exception check, the policy draft and the test-impact cache key) take the same graph type, and lib/test-impact/key.ts already hashes every nested tsconfig*.json, so no stale cache can reuse an old graph (file:line read by two reviewers). Reading configs through the existing readRepoFile also applies to the root config, so a root tsconfig larger than 1 MB, or a symlink out of the repository, is now treated as unreadable (test run).

Pre-Landing Review

Two full review passes and one focused re-check of the last fix found nothing left that blocks. One finding was fixed in each round. In the first pass, a test reached into an internal helper, so the helper is now private and the test checks only the graph. In the second-model review, nested config files were read without a size or location check. They are now read through the existing bounded, in-repository reader, and a new test that failed before the fix passes now. The re-check confirmed that fix and noted one narrower gap, listed below. Four smaller notes are listed under Review notes and are left as follow-ups.

Review notes

Below the blocking floor (advisory, informational, test-gap or wording items); recorded here and not fixed in this PR.

  • INFORMATIONAL lib/pregate/import-graph.ts:283 notes from every nested config are printed for every file with no test found (same as red-team#1)
  • INFORMATIONAL lib/pregate/import-graph.ts:293 root fallback can apply aliases TypeScript would not, including through an unfollowed package-name extends (same as red-team#2; not a regression)
  • INFORMATIONAL lib/pregate/import-graph.ts:284 a nested config with only baseUrl now governs its files, so root alias edges they had before (e.g. @repo/* to packages/*) disappear; matches TypeScript and fails closed with PREGATE_NO_LANE
  • INFORMATIONAL lib/pregate/import-graph.ts:216 an unparseable nested config drops its aliases with no note in the explanation printed when no test is found (root config always behaved this way)
  • INFORMATIONAL lib/pregate/import-graph.ts:83 readRepoFile checks containment only when the last path part is a symlink, so a relative extends through a tracked directory symlink can still read an outside file (size and file-type limits still apply; it already worked this way before this PR)
  • INFORMATIONAL test/pregate-import-graph-paths.test.ts a nested config whose aliases come only through an unfollowed package-name extends falls back to the root aliases (identical on main; reproduced in QA)
Exploratory QA

A functional smoke test ran on a throwaway monorepo built outside the checkout, calling buildGraph and testsFor. In the success case, apps/mobile/src/media/close-bar.tsx maps to its @/ test. In the riskiest edge, a nested config whose aliases come only through an unfollowed package-name extends falls back to the root aliases and names that config in the notes, as the docs describe. Both captures were rerun after the review fix and passed (2 probes, 4 captures, verdict pass). The jsconfig-only and deleted-file paths were not probed.

Design Review

No frontend files changed — design review skipped.

Eval Results

No prompt-related files changed — evals skipped.

Review bot comments

No review bot comments.

Scope Drift

Scope Check: CLEAN

Verification Results

No plan file, so there were no plan checks to run (0 PASS, 0 FAIL, 0 BLOCKED, 0 NOT RUN).

TODOS

No TODO items completed in this PR.

Documentation

Status: current. The release docs already match the code, so no edits were needed.

Audited scope: base da98d0a to head c77fe7f, 3 commits and 4 files: lib/pregate/import-graph.ts, test/pregate-import-graph-paths.test.ts, docs/pregate.md and changelog.d/nested-tsconfig-path-aliases.md. Nothing was staged, unstaged or untracked. I also searched the repository's Markdown files and templates for stale claims about root-only tsconfig aliases and found none.

Documentation health:

  • docs/pregate.md: current. The branch adds a paragraph on nested tsconfig/jsconfig paths and baseUrl resolution, and it matches the resolver.
  • changelog.d/nested-tsconfig-path-aliases.md: current. It is consistent with the code and credits the reporter.
  • CHANGELOG.md and VERSION: consistent with each other (1.100.0.0). Neither was touched.

Coverage debt: the nested alias resolution has reference coverage in docs/pregate.md and test coverage in test/pregate-import-graph-paths.test.ts. It needs no how-to or tutorial. The docs leave out a small hardening detail: a nested config must be inside the repository and under the 1 MiB read limit.

Diagram drift: none. The change touches no diagram entities.

Tests
  • Full free suite in CI at c77fe7f (Free Tests run 44189468225): green, 1687 test files carried
  • macOS named regressions (run 44189468225) and Windows smoke (run 44189468157) at c77fe7f: green
  • bun test test/pregate-import-graph-paths.test.ts test/pregate-selection.test.ts at c77fe7f: 76 pass, 0 fail (22 in the paths file)
  • New symlink test before the fix: 1 fail; after: pass
  • bun run typecheck: clean; module-size ratchet: 6 pass
Agent notes

Credit: Co-authored-by stackpt-agent (the author of #4462's commit, 431b800); PR author @dtoelke. GST-3029.
Outside code was read as text only (gh pr diff 4462); the branch was never checked out, built or run. The change reads only tsconfig/jsconfig files listed by git ls-files (now through the bounded in-repo reader), spawns nothing, and touches no network, secrets, workflows, install scripts or dependencies.

REVIEW_LOOP: passes=2 blocking_found=1 deferred=0 noted=1 fixed=2 scope=frozen ledgers_read=5 fix_checks=1 dispatches=8
Review-loop exception: accepted by Captain GStack Minder (GSTA-36) 2026-11-17 via a-4c06134a82c5: one scoped fix-check covering the readRepoFile change for config reads (fix-check at c77fe7f, 1 finding)
Gate edits: none detected (2 listed, 0 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)
Outside review: openai/gpt-6.1-sol (second-model review) completed; 1 blocking finding, fixed in c77fe7f.

Approvals

Approved: yes (record r-3cd1834d1d6f). The full approval record stays private.
Plan: exempt: bug fix
Plan check: exempt bug fix

{
  "schema_version": 1,
  "pr": 4464,
  "head": "c77fe7fd83f27610459b34091cb2f19c68bdbd40",
  "version": "1.100.0.0",
  "base": "main",
  "gate": {
    "test": {
      "pass": 1687,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "test",
      "run": 44189468225,
      "attempt": 1,
      "tree": "e9e55acd418f21c10ff0afafa25bb81b737b2573"
    }
  ],
  "calls": 31,
  "session_kind": "unattended",
  "run": "gsta599-ship",
  "head_tree": "e9e55acd418f21c10ff0afafa25bb81b737b2573",
  "product_patch_id": "68a57334d7691d0a3cdf1cde505c60184359329e",
  "gstack_version": "1.100.0.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 69,
    "rules": "eea6cc4231b53b9e",
    "base": "da98d0a0eb0072bc5825b1f361a92aa34bdb273b",
    "registry": "da98d0a0eb0072bc5825b1f361a92aa34bdb273b",
    "gate_scan": {
      "tagged": 0,
      "head": "c77fe7fd83f27610459b34091cb2f19c68bdbd40"
    },
    "reasons": [
      "gate-class",
      "runtime=69"
    ],
    "risk": [],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @e9e55acd418f (8 checks, current for c77fe7fd83f2)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/44189468225/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/44189468157/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=e9e55acd418f tests=37585 skipped=67 runs=44189468225/1 profiles=ci-reuse/free-tests heads=c77fe7fd83f2 verified=2026-11-17T22:32:45.360Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/, README.md, ARCHITECTURE.md, CONTRIBUTING.md and changelog.d/nested-tsconfig-path-aliases.md against base da98d0a0 to head c77fe7f"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 1,
    "deferred": 0,
    "noted": 1,
    "fixed": 2,
    "scope": "frozen",
    "fix_checks": 1,
    "rounds": 3,
    "ledgers_read": 5,
    "dispatches": {
      "specialist": 6,
      "red-team": 2
    }
  },
  "review_loop_exception": {
    "accepted_by": "Captain GStack Minder (GSTA-36)",
    "date": "2026-11-17",
    "via": "a-4c06134a82c5",
    "reason": "one scoped fix-check covering the readRepoFile change for config reads",
    "fix_check": {
      "head": "c77fe7fd83f27610459b34091cb2f19c68bdbd40",
      "findings": 1
    }
  },
  "gate_dispositions": []
}

The pre-push test selection read tsconfig paths and baseUrl only from the
repository root, so in an app such as apps/mobile whose tsconfig maps @/*
to ./src/* every touched source file failed with PREGATE_NO_LANE, even with
a test right beside it. Each 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 upward, the root config
governs the rest, and extends still never leaves the repository.

Rebuilt from gstack#4462 by dtoelke.

Co-authored-by: stackpt-agent <[email protected]>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 2 commits November 17, 2026 22:11
…he import graph

Review-Finding: p1/specialist-batched#1 reader=testing
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ize limit

Review-Finding: p2v/outside-voice#1 reader=outside-voice
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot merged commit 44c904f into main Nov 17, 2026
54 of 55 checks passed
stackpt-agent added a commit to dtoelke/gstack that referenced this pull request Nov 17, 2026
…ytan#4464)

Upstream's version of lib/pregate/import-graph.ts and its tests replaces the
fork's; docs/pregate.md keeps the fork's removed-path text beside upstream's
alias paragraph; fork/README.md no longer lists the alias fix.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This was referenced Nov 18, 2026
capy-ai Bot added a commit that referenced this pull request Nov 18, 2026
- A test, or a scratch repository in the temp directory, can no longer write approval rows into your real Capy Drive (GST-3027). (#4466)
- An unattended /autoplan run on Claude Code no longer says the publication guard is off while it is on. (#4481)
- A phase report written only in reasoning now gets a denial that says so and names the fix. (#4481)
- `gstack-autoplan revise` no longer refuses a plan that the first `next` accepted. (#4470)
- `revise --plan` with a different file now says the run follows that file. (#4470)
- A second-model plan review in `/autoplan` is no longer reported as unavailable when it actually ran (GST-3051). (#4471)
- The /ship conductor trial plan now lets case reverts that conflict with later code be resolved by hand in docs, tests and the planted file, so large pull requests can be cases (GST-3003). (#4460)
- A locked plan for a trial of /ship without its separate conductor subagent (GST-3003). (#4456)
- A driven /ship now runs each phase as one command, counts its calls, and stops itself at 100 minutes. (#4451)
- /ship stops asking owners to clear two kinds of bookkeeping noise: base-side merge text and a reviewer's confirmation prose. (#4458)
- A base merge that only touched base-side text no longer stops `/ship` finish for an owner's grant. (#4458)
- A reviewer's confirmation prose no longer becomes a Critical finding that only an owner can clear. (#4458)
- A CI run that passed only after its failed jobs were re-run is now marked wherever gstack reuses it. (#4473)
- /ship reuses CI's passing test run when merging the base changed no file, and stops instead of quietly starting hour-long test runs or reviewing an empty diff (GST-3019). (#4461)
- /ship on Codex no longer stops at the test coverage audit. (#4489)
- A cold first-use check before an app build reaches its owner (GST-3025). (#4465)
- `skill_prefix=true` now survives updates when gbrain is installed. (#4454)
- The OpenClaw docs no longer send you to ClawHub, which held only April 2026 builds of office-hours, ceo-review and retro and no longer has gstack skills (the docs also said four skills while listing three). (#4454)
- `gstack-issue-links` no longer reads other repositories' issues as gstack's. (#4454)
- /ship's pre-gate finds the tests of a monorepo app that imports through its own `@/` alias. (#4464)
- /office-hours explains why it recommends a mode. (#4450)
- /office-hours keeps its 34 founder videos and essays out of the skill file. (#4463)
- Two `gstack-owner-answers add` runs for the same answer no longer collide. (#4490)
- A Captain can check an ask against the owner's earlier answers before sending it. (#4467)
- `gstack-post` stops reading /ship's own receipt identifiers as phone numbers, so posting a /ship PR body no longer needs a confirm. (#4488)
- GitHub release notes now list every change in plain words, with a link to its pull request. (#4390)
- gstack's router no longer gives bug reports a special rule, so the model fixes a bug the way it would without gstack. (#4442)
- /ship's review plan now sorts Swift and Xcode files by risk instead of sending every iOS PR to the full review panel (GST-3041). (#4469)
- /ship's review plan now sends Swift code that touches private user data to the full review panel (GST-3052). (#4472)
- A round grant at /ship's review round cap now buys the fix round it names, in the same run or the next (GST-2968). (#4479)
- The secrets check stops flagging three kinds of ordinary code as a secret, and catches two misses. (#4457)
- A security finding's location and reason no longer go into a PR body. (#4486)
- The token-capped /ship child on Claude Code now starts its prompt with the typed `/ship` command, so the skill actually loads. (#4487)
- A /ship receipt now counts the second-model review's blocking findings, and refuses to be written while one is still open. (#4485)
- A `/ship` with a token cap on Claude Code no longer stops at its first handoff. (#4452)
- /ship's push step now always ends with one line that says whether it pushed (GST-3053). (#4474)
- A PR's review-round count can no longer be overwritten by the body `/ship` posts. (#4440)
- One queued record with a malformed path no longer stops artifacts sync for every project. (#4455)
- A failed artifacts push stays reported until a push succeeds. (#4455)
- The /sync-gbrain memory row no longer says OK when pages failed to import. (#4455)
- ### Tests (#4495)
- A policy-floor test no longer fails once gstack's own version reaches the minor after the newest policy key; it now checks a floor above both, so the v1.101.0.0 release can pass CI. (#4495)
- CI now uploads free-suite test results to Trunk with analytics-uploader v2.1.8 and analytics-cli 0.17.0, up from v2.1.6 and 0.16.2. (#4453)
- Packing a checkout for a Ubicloud run no longer fails when git beside it is rewriting a ref. (#4447)
- The /plan-ceo-review HOLD SCOPE eval no longer fails a review because its follow-up question didn't repeat the mode name. (#4447)
- Unattended /autoplan now records the owner's relayed gate reply instead of refusing it. (#4484)
- Unattended /autoplan now runs the second-model review you turned on, and waits for it instead of ending the session. (#4459)
- Two /autoplan runs started in the same second no longer share a run id. (#4459)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant