Skip to content

Add forward containment traversal for touched roots - #24

Merged
V3RON merged 1 commit into
masterfrom
feat/issue-22-forward-containment
Jun 30, 2026
Merged

V3RON merged 1 commit into
masterfrom
feat/issue-22-forward-containment

Conversation

@V3RON

@V3RON V3RON commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

What is this?

This PR adds explicit containment-based test selection for touched app roots. Sniffler can now mark a module as a subtree root via tests.invalidateSubtreeWhenTouched, so changes inside shared code can still fan out through a designated root like src/App.tsx and select tests below it.

How does it work?

Sniffler still runs normal reverse dependency traversal first. After that, it checks touched modules against the new path or glob rules. For each matched root, it walks forward through the existing import graph, records the shortest containment path, and matches tests against the reachable declared targets. Text and JSON output now distinguish dependency reasons from containment reasons, and config loading validates and defaults the new option.

Why is this useful?

  • Keeps containment explicit instead of inferring router or filename relationships.
  • Preserves existing reverse dependency selection and run-all behavior.
  • Gives clearer explanations for why a test was selected, including changed file, invalidated root, reverse path, and forward containment path.
  • Benchmark on tests/benchmark.bench.ts: shared-root 67.3052 hz, deep-branch 94.5765 hz.

Closes #22.

Add explicit subtree invalidation roots, forward graph traversal, and containment test selection/output.
@V3RON
V3RON merged commit 87d1711 into master Jun 30, 2026
6 checks passed
@V3RON
V3RON deleted the feat/issue-22-forward-containment branch June 30, 2026 09:59
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.

Add forward containment traversal for touched app roots

1 participant