Skip to content
Source
Sign inSign up
TanStack/intent

fix: match nested review sources before the node_modules exclude #302

Mergedviclafouch(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/302/headmerged by LadyBluenotes(GitHub profile, opens in a new tab)

🎯 Changes

Fixes #301.

review lists the files of each source with git ls-files -- <source> <node_modules exclude>. When one include comes before the exclude, Git drops matches for some nested paths, so a valid source such as packages/client/src/** reports Source matched no available files.

list() now passes dependencyExclude before the patterns. diff() is unchanged: git diff returns the right files in both orders.

The new test in review.test.ts fails without the fix and passes with it.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr (run pnpm build:all first).

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Bug Fixes
    • Review checks now correctly include files matching a nested source path, even when that path appears before installed-dependency exclusions. Files within node_modules remain excluded from the review snapshot. This resolves cases where a valid nested source was incorrectly reported as having no available files, while preserving the existing exclusion of dependency files from review results.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration

      Configuration used: defaults

      Review profile: CHILL

      Plan: Advanced

      Run ID: 39e684af-345f-497a-912c-4ff4915e87c2

      📥 Commits

      Reviewing files that changed from the base of the PR and between 5bebfd29498f7140d5caf05eebba3381dba89c92 and f8932af9d539039fc57c09e85be9019b85ee9533.

      📒 Files selected for processing (2)
      • packages/intent/src/review/review.ts
      • packages/intent/tests/review.test.ts

      Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.


      📝 Walkthrough

      Walkthrough

      The review file-list call now places the dependency exclusion before supplied source patterns. A regression test checks that a nested source glob finds its file without reporting problems.

      Changes

      Review source matching

      Layer / File(s)Summary
      Order file-list arguments
      packages/intent/src/review/review.ts, packages/intent/tests/review.test.ts, .changeset/review-source-pathspec-order.md
      The Git file-list call applies the dependency exclusion before source patterns. A regression test covers a nested source glob, and a changeset records the patch.

      Priority: ➖ Normal

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix · Severity of issue fixed: Medium

      Suggested reviewers: ladybluenotes

      Merge Risk: ⚪ Minimal · up to f8932

      This fix lets the review command match nested source paths that previously reported no available files. The change is small, tested, and narrowly scoped, so there are no known merge-blocking risks.

      Architecture Summary

      Architecture risk: 🟡 Medium · up to f8932

      The change affects 1 system.

      Changed systems: packages/intent

      Architecture concerns No architecture-level concerns identified.

      Review details

      Systems and components

      • observed — packages/intent (library) was modified; 2 changed files map to changed impact.

      Before / after behavior

      • observed — Modified behavior in packages/intent/src/review/review.ts: The list helper now orders Git pathspecs with dependencyExclude before caller-supplied patterns; previously the patterns preceded the dependency exclusion.
      • observed — Modified behavior in packages/intent/tests/review.test.ts: Added a nested-source-glob test that commits a package source file and a dependency file beneath src/node_modules, then checks that the review has no problems and snapshots only the package source file and the skill.
      • observed — Modified behavior in .changeset/review-source-pathspec-order.md: Adds patch-release metadata for @tanstack/intent and a changeset note describing the reported nested-source path-matching failure.

      Reliability and maintainability

      • inferred — Risk-relevant change factors for packages/intent: blast_radius_1; direct_dependents_1
      🚥 Pre-merge checks | ✅ 4 | ❌ 1

      ❌ Failed checks (1 warning)

      Check nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files.Write docstrings for the functions missing them to satisfy the coverage threshold.
      ✅ Passed checks (4 passed)
      Check nameStatusExplanation
      Title check✅ PassedThe title clearly identifies the primary fix: ordering nested review source matching before the node_modules exclude.
      Description check✅ PassedThe description explains the problem, the code change, the unchanged behavior in diff(), the added regression test, and the required checklist and release impact information.
      Linked Issues check✅ PassedIssue #301 requires review to pass dependencyExclude before source patterns in list(). packages/intent/src/review/review.ts changes the argument order. The added review.test.ts case verifies…
      Out of Scope Changes check✅ PassedThe source change directly implements issue #301. The regression test verifies the required behavior. The changeset documents the user-facing fix. No unrelated change is identified in the supplied who…
      • Fix all pre-merge checks with AI
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR
      • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Autopilot is currently an internal CodeRabbit preview.


      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. nx-cloud[bot](GitHub profile, opens in a new tab)commented

      View your CI Pipeline Execution ↗ for commit f8932af9d539039fc57c09e85be9019b85ee9533

      CommandStatusDurationResult
      nx affected --targets=test:eslint,test:sherif,t...✅ Succeeded1m 3sView ↗
      nx run-many --targets=build✅ Succeeded3sView ↗

      ☁️ Nx Cloud last updated this comment at 2026-10-03 01:59:40 UTC

    3. pkg-pr-new[bot](GitHub profile, opens in a new tab)commented

      Open in StackBlitz

      npm i https://pkg.pr.new/@tanstack/intent@302

      commit: f8932af

    4. @@ -404,4 +404,4 @@
      404404 '--exclude-standard',
      405405 '-z',
      406406 '--',
      407- ...patterns,
      407+ // Git drops matches when one include precedes the exclude (#301).
    5. The test mentions excluding installed dependencies but doesn’t create any. Could you add a dependency fixture under a matching glob and assert that the snapshot includes the source file but excludes the dependency?

    6. codspeed[bot](GitHub profile, opens in a new tab)commented

      Merging this PR will not alter performance

      ✅ 12 untouched benchmarks


      Comparing viclafouch:fix-review-source-pathspec-order (f8932af) with main (4fbc23c)[^unexpected-base] Open in CodSpeed
    7. The test mentions excluding installed dependencies but doesn’t create any. Could you add a dependency fixture under a matching glob and assert that the snapshot includes the source file but excludes the dependency?

      Good point, test added

Sign in to join this conversation.