Repository navigation
fix(test): reduce focused Bun test startup latency - #172967
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1146b11f08
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (existsSync(resolve(cwd, file))) { | ||
| return file; |
There was a problem hiding this comment.
Keep ignored files out of UI owner resolution
When a tracked UI test is renamed from .ts to .tsx while an ignored stale .ts remains on disk (for example via .git/info/exclude), this filesystem check selects the ignored file before consulting the Git inventory. The previous --exclude-standard inventory instead selected the tracked .tsx; now timing or node-driven ownership can execute stale local code and misroute or omit the tracked test. Keep the repository inventory authoritative when it is available, using filesystem checks only as its fallback.
AGENTS.md reference: AGENTS.md:L19-L19
Useful? React with 👍 / 👎.
|
Codex review: needs changes before merge. What this changesThis PR preserves Bun’s transpiler cache across isolated test homes and narrows exact-file test discovery. Example: Run pnpm test packages/markdown-core/src/fences.test.ts repeatedly with Bun.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 2 items remain Keep open: the measured startup improvement is worthwhile, but the UI ownership shortcut admits ignored files and breaks the planner’s filesystem-probe contract. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherRepository test tooling converts selected paths into Vitest projects, resolves UI execution owners, and launches children with isolated homes and owned caches. flowchart TD
A[Selected test paths] --> B[Test project router]
B --> C[Git inventory and UI ownership]
C --> D[Vitest project selection]
D --> E[Owned child process]
E --> F[Isolated HOME]
E --> G[Bun transpiler cache]
Technical reviewBest possible solution: Keep persistent Bun caching and bounded exact-file inventories while restoring authoritative, cached Git membership for UI ownership. Do we have a high-confidence way to reproduce the issue? Baseline source performs broad inventory discovery and removes isolated HOME; supplied CLI benchmarks exercise that overhead, while exact-head CI confirms the introduced planner-probe regression. Is this the best way to solve the issue? The cache and bounded-inventory changes address the measured causes, but filesystem-first UI resolution weakens an existing ownership contract and should be repaired. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 12c076d9d63e. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceTests +39, Docs +4, Other +7. Total +50 across 7 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 15, 2026, 5:14 AM ET / 09:14 UTC. |
Keep Bun transpiler caches across isolated test homes and avoid whole-repository Git inventories for exact-file test routing. Preserve sparse checkout and rename ownership, broad discovery, and explicit cache overrides.
Resolve UI owners through cached directory-scoped Git inventories and reuse a full snapshot when one is already available. This preserves sparse checkouts and TS/TSX renames without probing every owner during CI plan imports.
ca98363 to
551e8c2
Compare
|
Merged via squash.
|
* fix(test): reduce focused Bun test startup latency Keep Bun transpiler caches across isolated test homes and avoid whole-repository Git inventories for exact-file test routing. Preserve sparse checkout and rename ownership, broad discovery, and explicit cache overrides. * fix(test): keep CI planning free of filesystem probes Resolve UI owners through cached directory-scoped Git inventories and reuse a full snapshot when one is already available. This preserves sparse checkouts and TS/TSX renames without probing every owner during CI plan imports.
What Problem This Solves
Focused
pnpm test <file>runs on Bun paid for a whole-repository file inventory and discarded Bun's compiler cache when the test HOME was cleaned up.User Impact
The measured small-file runs start faster on both runtimes while keeping the same setup and test coverage. Bun remains slower than Node in that comparison; this change does not claim runtime parity or eliminate loaded-host variance.
Why This Change Was Made
.cache/bun-transpilerdirectory before isolating HOME. Explicit paths, empty values, and0remain unchanged. The cache ownership regression exercises real child processes.There are no product-code changes, dependency changes, new runtime skips, or timeout increases. Net LOC: product 0; harness +32; tests +16; documentation +4.
Evidence
Pinned Bun:
1.4.3-canary.1+65d94e715. Same shared macOS host, alternating Node/Bun order,--maxWorkers=1, short TMPDIR, first pair excluded. p90 uses nearest rank. Host contention varied substantially, so the timings quantify the observed runs rather than establish a stable speed ratio.Small file:
packages/markdown-core/src/fences.test.ts. Nine warm baseline samples and five warm final-candidate samples per runtime. Each cell is median / p90 seconds.Heavier file:
src/config/schema.test.ts(26 tests). Two warm samples per runtime/version, first pair excluded. Each cell is median / p90 seconds.The final candidate uses directory-scoped Git inventories for UI ownership. Timings from the superseded per-file filesystem-probe implementation are excluded from the after columns. The baseline heavy cold pair is excluded because it overlapped auxiliary cache tracing/review work.
session-actor.test.tspassed its baseline runs, but its candidate Node attempt was interrupted after about eight minutes; the completed schema comparison replaces it.Both runtimes passed all 34 applicable tests in the three-file harness proof. One existing Windows-only test remains skipped on macOS:
The initial PR CI found that resolving UI owners through
existsSyncviolated the planner's zero-probe contract. The final correction retains the original assertion and passes all 29 selected routing/TSX/no-scan tests on both runtimes:The other CI failure,
keeps selected Gateway and embedded-agent work within its runner capacity, reproduces on unchanged base39bad21f1fad(expected one concurrent job, got zero). It is inherited and left unchanged. The failed-CI helper initially classified it as unknown because no matching main job was available; the local baseline run proves attribution.Two default-thread attempts were interrupted after long pre-test waits; the complete proof above uses Vitest's supported fork pool. The latency benchmarks use the unchanged default pool. The new regression assertions fail against the original implementation: missing persistent Bun cache in two HOME modes and an unwanted broad inventory scan.
Formatting, scoped script/test lint,
pnpm tsgo:scripts, root tooling/root other test typechecks, andgit diff --checkpass. Codex autoreview is clean through P2.Investigation
DEBUG=vitest:cache:fsruns each recorded 37 reads, zero writes, zero misses, and zero cache clears. The checkout/config cache slot is stable; Vitest filesystem-cache misses are not the remaining slowdown. Bun's separate native transpiler cache previously lived under the disposable HOME. In the earlier cache-location probe (two warm samples each), shard medians were 46.84 s at the disposable default, 29.14 s at a persistent path, and 50.98 s with that cache disabled; changing host load limits causal timing claims.0and1both disable it on Node and Bun. Three alternating absent/present pairs gave median wall 16.58/19.46 s, but p90 29.03/20.06 s; later warm pairs were inconsistent. The existing disable setting stays. The earlier1versus0comparison is not used as evidence of enablement.Follow-up: Bun still has a measurable transform/setup gap after these two harness fixes. Further runtime profiling is warranted before claiming Node parity. No new runtime-only skip or fork workaround is introduced.