Skip to content

ripple: depend on the content of files that root paths name, and add ripple why - #344148

Merged
Alexandru Dima (alexdima) merged 2 commits into
mainfrom
agents/improve-ripple-test-selection-logic
Oct 25, 2026
Merged

Alexandru Dima (alexdima) merged 2 commits into
mainfrom
agents/improve-ripple-test-selection-logic

Conversation

@alexdima

@alexdima Alexandru Dima (alexdima) commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

ripple selected githubFileSystemProvider.test.ts for #344129, which only changes agent host node code, so macOS ran that browser test alone in WebKit. The test's fake GitHub tree lists { path: 'src/main.ts' }.

Cause

A string that names an existing repository file from the root becomes a root spec with a Ref::All edge, like a dynamic import. The linker resolved it like a module specifier, to the surface node of src/main.ts: the node standing for the whole module, which depends on all of its nodes and so on everything the module loads. These are the u32::MAX nodes of the investigation. ripple why (below), with this fix reverted, prints the chain:

src/vs/sessions/contrib/fileTreeView/test/browser/githubFileSystemProvider.test.ts :: tree.tree
  -> src/main.ts (whole module)
  -> src/main.ts :: <init>
  -> src/mainImpl.ts (whole module)
  -> src/mainImpl.ts :: startup
  -> src/vs/code/electron-main/main.ts (whole module)
  -> src/vs/code/electron-main/main.ts :: CodeMain.prototype.startup  (method opened by its name in src/vs/code/electron-main/main.ts :: CodeMain.prototype.main)
  -> src/vs/code/electron-main/app.ts :: CodeApplication
  -> src/vs/code/electron-main/app.ts :: CodeApplication.prototype.startup  (method opened by its name in src/vs/code/electron-main/main.ts :: CodeMain.prototype.main)
  -> src/vs/platform/agentHost/electron-main/electronAgentHostStarter.ts :: ElectronAgentHostStarter
  -> src/vs/platform/agentHost/electron-main/electronAgentHostStarter.ts :: ElectronAgentHostStarter.prototype.start  (method opened by its name in src/vs/base/common/event.ts :: Emitter.prototype.fire)
  -> src/vs/platform/agentHost/node/agentHostMain.ts (whole module)
  -> src/vs/platform/agentHost/node/agentHostMain.ts :: startAgentHost
  -> src/vs/platform/agentHost/node/agentHostBootstrap.ts :: createAgentHostRuntime
  -> src/vs/platform/agentHost/node/agentServiceComposition.ts :: createAgentServiceComposition
  -> src/vs/platform/agentHost/node/agentService.ts :: AgentService
  -> src/vs/platform/agentHost/node/agentService.ts :: AgentService.prototype._applyPassiveChatFlags  (method opened by its name in src/vs/platform/agentHost/node/agentService.ts :: AgentService.prototype.dispatchAction)  (changed)

Fix

No module specifier is a path from the repository root, so code reads the file that such a string names (a grammar, a fixture), or the string only looks like a path. A root path now resolves to a read of the file, through the same non-transitive mechanism as the folders that tests read by path, generalized from folders to files (Res::Dir is Res::Read, Graph::dir_dependents is Graph::readers). The reader is selected when the file changes, also by a comment, since code that reads a file sees its text, but not when what the module loads changes. Relative and path alias strings, such as the 'vs/platform/agentHost/node/agentHostMain' entry point, workers and FileAccess module ids, still depend on the module and what it loads.

Why only root paths: on main, 15 root path strings name modules, all of them fake data (this tree, the URI.file('src/vs/workbench/browser/workbench.ts')-style names of fuzzyScorer.test.ts, the file lists of component fixtures). 58 relative or path alias strings name modules, nearly all genuine loads in positions that only a repository-specific list could recognize (entryPoint:, VSCODE_ESM_ENTRYPOINT:, esmModuleLocation:, moduleId:, FileAccess.asFileUri(), new URL(), fork()).

ripple why

ripple why --test PATH --base REV [--head REV] prints how a change reaches a test that it selects: the path from the test's code to what the change changed, with whole modules, packages and globals labeled, the code whose use of a name opened each instance method, and (reads X by path) for file reads. It shares the search of reaches_from through a const TRACE: bool parameter, so selection keeps its depth-first search without per-edge checks: select() takes the same time within ±1%.

Effect

  • agentHost: keep a promoted session's read state in sync with its chat #344129: 125 → 124 test files; only githubFileSystemProvider.test.ts drops. ripple plan lists 94 unit test files, none of the browser or common layers, and the same 30 integration test files. With ci: skip macOS and Windows Browser unit jobs without browser tests, and report a failed ripple plan #344108, the macOS and Windows Browser unit jobs are skipped for it, where main alone still runs them for that one test.
  • ripple replay of Oct 18 to 25 (670 first-parent commits): 190 commits select fewer tests, none more. They drop githubFileSystemProvider.test.ts (175 commits) and fuzzyScorer.test.ts (31). On 63 commits, the browser test runners have nothing left to run. The share of unit test work hardly moves (mean 10.6%, median 2.0%, p90 24.6% before and after): both files are small.
  • The README's window (Oct 13 to 20, 708 commits): 161 commits select fewer tests, none more, and 59 no longer run the browser test runners. The README's table had drifted since earlier changes (9.0%, 1.9%, 24.1%, 14.5% selecting nothing); it now shows the current numbers (9.1%, 2.0%, 24.1%, 13.4%), which this change does not move at that precision.
  • Files read by path select the same tests as before: the grammars and the theme that fixtureSyntaxHighlighting.test.ts reads by root path, test/package.json, fixture folders (pfs, zip), __snapshots__ folders and the keyboard mapper's golden files. A change to startAgentHost in agentHostMain.ts still selects nodeAgentHostStarter.test.ts through the entry point string.

Trade-off: a comment-only edit of a module that a root path names now selects the code that names it, where it selected nothing before: editing src/main.ts selects githubFileSystemProvider.test.ts. That added no selection in either replay window. The README's known limits describe it, and that a root path never follows the loads of the module it names (the unit tests run the compiled modules in out, which no root path names).

How to test

cd build/ripple
cargo test --release --locked    # passed: 77 tests, 2 of them new
cargo build --release --locked   # passed
cd ../..
build/ripple/target/release/ripple affected --config build/ripple/vscode.jsonc --base 4f383697191fef7129052d5396d5709d5799934a --head 40a0d6d71d7b555b376b3c7780baa27cad0093c4
# 124 test files, without githubFileSystemProvider.test.ts (125 with it before)
build/ripple/target/release/ripple why --config build/ripple/vscode.jsonc --test src/vs/platform/agentHost/test/node/agentHostChangesetCoordinator.test.ts --base 4f383697191fef7129052d5396d5709d5799934a --head 40a0d6d71d7b555b376b3c7780baa27cad0093c4
# the path from the test to AgentHostStateManager.prototype._applyAndEmit (changed)

cargo fmt --check passed and cargo clippy reports no new warnings. Since this changes build/ripple, the Ripple check runs and this pull request runs every unit test.

A string such as `'src/main.ts'` in a test's fake GitHub tree names an
existing module from the repository root, and ripple linked it like a
dynamic import: to the node standing for the whole module, which depends
on all of it and on everything it loads. So that test depended on all
that the Electron main process starts, the agent host included, and
#344129, which only changes agent host code, ran it alone in WebKit on
macOS. Of the 670 commits of the last week, 175 selected that test this
way, and 31 selected `fuzzyScorer.test.ts`, whose `URI.file(...)`
fixtures name workbench modules.

No module specifier is a path from the repository root, so code reads
the file that such a string names, or the string only looks like a
path. It now reads the file, like the folders that tests read by path:
the code depends on the file's content, also for a module, but not on
what the module loads. Relative and path alias strings, such as entry
points, still reach what the module loads. On the same 670 commits, 190
select fewer tests and none select more; on 63 of them, the browser test
runners have nothing left to run. The README's replay table had drifted
since earlier changes; it now shows the current numbers.

`ripple why --test PATH --base REV [--head REV]` prints how a change
reaches a test that it selects: the path from the test's code to what
the change changed, through declarations, whole modules, packages and
globals, and the code whose use of a name opened each instance method on
the way. It shares the search of `reaches_from`, so it follows the same
rules as selection.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 25, 2026 16:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The reviewed dependency and tracing changes are consistent with their callers and regression coverage, with no unresolved blocking issues.

No open issues 🎉

What changed in this PR

This PR reduces false-positive test selection in Ripple by treating repository-root paths as file-content dependencies rather than transitive module dependencies. It also adds diagnostics for explaining why a change selects a test.

Changes:

  • Track root-path file reads without following module dependencies, while preserving relative and alias module behavior.
  • Add ripple why with labeled dependency paths and method-opening context.
  • Add regression tests and update documentation, known limitations, and replay statistics.
File Description
build/​ripple/​src/​main.rs Registers and implements the why command.
build/​ripple/​src/​graph.rs Generalizes file-read tracking and adds traced dependency searches and labels.
build/​ripple/​src/​engine.rs Integrates readers into selection, exposes change seeds, and adds regression tests.
build/​ripple/​README.md Documents dependency semantics, diagnostic usage, limitations, and updated statistics.

Review effort: Balanced

Resolves the conflicts in build/ripple/README.md by keeping both sides: main's integration test selection and this branch's root path reads.

Co-authored-by: Copilot <[email protected]>
@alexdima
Alexandru Dima (alexdima) marked this pull request as ready for review October 25, 2026 19:58
@alexdima
Alexandru Dima (alexdima) merged commit 471b308 into main Oct 25, 2026
44 checks passed
@alexdima
Alexandru Dima (alexdima) deleted the agents/improve-ripple-test-selection-logic branch October 25, 2026 20:16
@vs-code-engineering vs-code-engineering Bot added this to the 1.144.0 milestone Oct 25, 2026
Alexandru Dima (alexdima) added a commit that referenced this pull request Oct 25, 2026
…mization-flaky-tests

Resolves the conflicts with #344146 and #344148: a pull request that only disables tests also forces the new selected-node-integration-tests and selected-agent-host-e2e outputs to false, so that the Windows Agent Host E2E job skips too, and ripple's new COMMANDS list includes disables.

Co-authored-by: Copilot <[email protected]>
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.

3 participants