Repository navigation
fix(ci): select mock consumers when module exports change - #164666
Conversation
Retain module-mock consumers when changed runtime exports or newly consumed imports/re-exports can outgrow a closed factory. Reuse the pre-install source scanner, import resolver, and bounded Node planner, including shared mock installers and package aliases. Strip TypeScript syntax with the existing native parser before comparing runtime signatures. Unknown syntax and missing historical source retain mock coverage; current checkout read failures reject preflight. Existing runtime tiers and matrix bounds remain owned by the planner.
|
🦞👀 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: needs maintainer review before merge. Reviewed October 3, 2026, 9:27 PM ET / October 4, 2026, 01:27 UTC. ClawSweeper reviewWhat this changesThe PR updates CI test selection to retain tests whose module mocks may become incomplete when exports or consumed bindings change, with regression coverage and documentation. Merge readiness✅ Ready for maintainer review The repair remains useful: current main lacks the added mock-consumer protection, and no blocking patch defect was found. Likely related people: @steipete (routing candidate; high confidence). Priority: P2 Review scores
Verification
How this fits togetherCI preflight turns changed repository paths into a bounded test plan before dependencies are installed. The source scanner and import graph identify affected tests, which the existing planner assigns to CI jobs. flowchart TD
A[Changed files and comparison revision] --> B[Source scanner]
B --> C[Runtime export and import comparison]
B --> D[Import and mock consumers]
C --> E[Affected test selection]
D --> E
E --> F[Existing CI job planner]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +557, Docs +1, Other +299. Total +857 across 6 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep mock-contract protection in the existing source scanner and bounded selector while preserving established CI scheduling limits. Do we have a high-confidence way to reproduce the issue? Yes, from source: a changed module can outgrow a closed mock beyond the ordinary importer-depth limit. The added planner fixtures exercise that selection boundary, but this review did not run them. Is this the best way to solve the issue? Yes. The patch extends the existing scanner, resolver, and selector with conservative fallbacks instead of restoring full-suite PR selection or adding another planning owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against fd69a4eedd30. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
…64666) * fix(ci): select consumers of changed mocked module contracts Retain module-mock consumers when changed runtime exports or newly consumed imports/re-exports can outgrow a closed factory. Reuse the pre-install source scanner, import resolver, and bounded Node planner, including shared mock installers and package aliases. Strip TypeScript syntax with the existing native parser before comparing runtime signatures. Unknown syntax and missing historical source retain mock coverage; current checkout read failures reject preflight. Existing runtime tiers and matrix bounds remain owned by the planner. * style(ci): format mock selection regression guard * test(ci): require cross-area mock consumer coverage
What Problem This Solves
Fixes PR test-selection gaps when a first-party module gains exports that a test's closed
vi.mockfactory does not provide; eight hourly failures on 2026-10-03 exposed this class.User Impact
No product behavior changes. PR CI retains affected mock consumers so missing mock exports are caught before the hourly run, preserving existing test cases and assertions.
Why This Change Was Made
The existing selection owner compares runtime export sets syntactically against preflight's comparison revision and selects every
vi.mock/vi.doMockconsumer of a changed module, including tests using shared mock installers. It reuses relative, workspace-package, and TypeScript-path resolution. Newly consumed bindings also retain tests shared by the caller and mock consumer, covering the observed case where the export already existed.Missing history or unknown syntax retains coverage; unreadable current source fails preflight. No compiler program, parallel planner, new CI job, tier change, or worker increase is introduced. Main/hourly coverage is unchanged. Handwritten object fakes remain outside this module-export mechanism.
Evidence
0c96fd043ab3, both SQLite suites frome6ec522a023d, and the recovery case from3a8abe6955cc. The handwritten terminal fake fromaff22764a883remains out of scope by design.bench-sqlite-reliability.test.tsfailure: the unchanged SQLite worker argv owner drops--no-concurrent-sparkplug, failing an inherited compiler-policy probe. Shard 4/4 never executed due admission timeouts; the fallback fleet was at capacity. This is an explicitly accepted proof gap, not a whole-tooling pass.65fe6d98da24); its full 16-case file passed on Linux after incorporation. The final rebase preserved all six reviewed source/test/doc files byte-for-byte. Natural PR CI supplies the remaining CI-shape evidence; no dispatches or reruns.