Skip to content

Verify efficiency 2/3: affected-scope verify, node --test (#390) - #665

Merged
currentbits merged 2 commits into
coder/verify-cache-390from
coder/verify-scope-core-390
Aug 22, 2026
Merged

currentbits merged 2 commits into
coder/verify-cache-390from
coder/verify-scope-core-390

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Second of three stacked PRs for #390. Based on #664, review that one first.

What

scopeVerifyCommand() rewrites the verify command to cover only what the diff touches. This PR adds the framework plus one runner — node --test, since that is what this repo actually uses. The other six runners are in 3/3.

Changed paths come from the pre-existing worktrees.listChangedPaths (exported here), diffed against the project default branch and including the working tree.

npm run <script> is unwrapped through package.json first, so a single-command script still matches a runner. Compound scripts containing ;, & or | are left alone.

When it does NOT scope

This is the whole safety story, so it is the part worth reviewing hardest. Falls back to the full suite when:

  • any changed path is a lockfile, build config, tsconfig/jsconfig, Dockerfile, CMakeLists.txt, or a CI workflow under .github/workflows or .circleci
  • more than 40 files changed
  • the command is already scoped: --filter, --affected, --findRelatedTests, --testPathPattern, --all, vitest related
  • the runner is unknown, or git cannot list the diff (remote and WSL projects included, which never scope)
  • changedPaths comes back null — unknown means full, never empty

Docs-only diffs (.md, .mdx, .rst, docs/, README/LICENSE/CHANGELOG…) short-circuit to exit 0.

Visibility

A rewrite is never silent. The log is prefixed [verify] affected scope (or no testable changes), and the rewritten command is what appears in the Verified: … passed event and in VerifyResult.command.

Testing

npm run test:electron: 1941 pass / 0 fail, run from this branch alone.

Reviewer notes

  • This rewrites the user's verify command, so a heuristic that scopes too narrowly means the gate goes green on a suite that was not fully run. The bail-out list above is the only thing standing between a bad match and a false pass. There is currently no setting to disable scoping — worth deciding whether one is wanted before this lands.
  • Source-to-test path guessing (candidateTests) is convention-based. It maps electron/store.js → electron/test/store.test.js correctly, but misses this repo's renderer naming (src/components/Sidebar.tsx → test/sidebar.test.tsx), which simply falls back to the full suite. Missing a mapping is safe; a wrong mapping would not be.

Part of #390.

Rewrite the verify command to the tests the diff touches when the
runner is node --test. Docs-only diffs skip the suite; lockfiles, --all,
unknown diffs, and compound npm scripts stay full-suite. Wired into
the runner gate and Verify now. Post-merge verify is unchanged.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

)

Add the remaining verify-command matchers on top of the node --test
framework. Unknown runners and already-filtered commands stay full-suite.

Co-authored-by: Willem <[email protected]>
@currentbits
currentbits merged commit 5f2991e into coder/verify-cache-390 Aug 22, 2026
5 of 6 checks passed
currentbits added a commit that referenced this pull request Aug 22, 2026
* feat(verify): share turbo/nx/cargo cache across worktrees (#390)

Point every worktree of a repo at ~/.solenta/build-cache/<repo> so
thread B reuses thread A's task results. Injected into the verify
spawn and every agent CLI. Does not override env the user already set.

* Verify efficiency 2/3: affected-scope verify, node --test (#390) (#665)

* feat(verify): affected-scope node --test selection (#390)

Rewrite the verify command to the tests the diff touches when the
runner is node --test. Docs-only diffs skip the suite; lockfiles, --all,
unknown diffs, and compound npm scripts stay full-suite. Wired into
the runner gate and Verify now. Post-merge verify is unchanged.

* feat(verify): affected-scope turbo/nx/jest/vitest/pytest/go (#390) (#666)

Add the remaining verify-command matchers on top of the node --test
framework. Unknown runners and already-filtered commands stay full-suite.

Co-authored-by: Willem <[email protected]>

---------

Co-authored-by: Willem <[email protected]>

---------

Co-authored-by: Willem <[email protected]>
@currentbits
currentbits deleted the coder/verify-scope-core-390 branch October 3, 2026 16:07
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