Skip to content
Source
Sign inSign up
TanStack/intent

perf: share the filesystem cache across validate and repair #340

MergedLadyBluenotes(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/340/headmerged by LadyBluenotes(GitHub profile, opens in a new tab)

🎯 Changes

  • runValidateCommandInternal and runRepairCommand previously destructured const { findSkillFiles } = createIntentFsCache() and discarded the IntentFsCache instance, so every resolveProjectContext and findWorkspacePackages call created a fresh cache or ran uncached, and collectPackagingWarnings and the packageName lookup before checkSkillBlocks re-read and parsed package.json from disk.
  • Keep fsCache in runValidateCommandInternal and runRepairCommand and pass it through resolveProjectContext, collectDefaultSkillsDirs, findWorkspacePackages, collectPackagingWarnings, repairRoot, and the packageName lookup before checkSkillBlocks.
  • On a single-package repository, intent validate now reads package.json once instead of 4–5 times.
  • Command output, packaging warnings, and exit codes do not change.
Benchmark (benchmarks/intent/validate.bench.ts, Vitest 4.1.11 on Windows Node)main (79d7cc2) mean (rme)PR (505b3d0) mean (rme)Change
checks a shipped skills tree33.53 ms (±1.43%)25.06 ms (±0.72%)-25.3% (1.34x)

✅ 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

  • Performance
    • Validation and repair now reuse filesystem reads while resolving project context, discovering workspace packages and skills, and reading package manifests. This reduces repeated reads during a run.
  • Behavior
    • Validation and repair continue to behave as before. Missing package manifests still produce no warning, while other manifest read or parsing errors produce a warning.
    1. 🦋 Changeset detected

      Latest commit: 505b3d0009f251a2c33a6ff920696c93eb36f604

      The changes in this PR will be included in the next version bump.

      This PR includes changesets to release 1 package
      NameType
      @tanstack/intentPatch

      Not sure what this means? Click here to learn what changesets are.

      Click here if you're a maintainer who wants to add another changeset to this PR

    2. Review in Change Stack →

      Note

      Currently processing new changes in this PR. This may take a few minutes, please wait...

      ⚙️ Run configuration
      • Configuration used: defaults
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: a8d1bb16-8e01-43bf-8b65-c019985da78d
      📥 Commits

      Reviewing files that changed from the base of the PR and between 79d7cc2694dd95ad438afef9d85836835a140885 and 505b3d0009f251a2c33a6ff920696c93eb36f604.

      📒 Files selected for processing: 4
      • .changeset/validate-share-fs-cache.md
      • packages/intent/src/commands/repair.ts
      • packages/intent/src/commands/validate.ts
      • packages/intent/tests/repeated-work.test.ts
      +-------------------------------------------------------+
      | Cancel my subscriptions ... I'm tired of your issues. |
      +-------------------------------------------------------+
        \
         \     /)/)
              ( '')
              /  |
            o(___)
      ✨ Finishing Touches
      📝 Generate docstrings
      • Commit to this branch
      • Create a new PR
      🧪 Generate unit tests (beta)
      • Commit to this branch
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      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.
    3. nx-cloud[bot](GitHub profile, opens in a new tab)commented

      View your CI Pipeline Execution ↗ for commit 505b3d0009f251a2c33a6ff920696c93eb36f604

      CommandStatusDurationResult
      nx affected --targets=test:eslint,test:sherif,t...✅ Succeeded50sView ↗
      nx run-many --targets=build✅ Succeeded2sView ↗

      ☁️ Nx Cloud last updated this comment at 2026-10-19 00:49:55 UTC

    4. Open in StackBlitz

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

      commit: 505b3d0

    5. Merging this PR will not alter performance

      :warning: 7 benchmarks spent significant time in system calls

      System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

      Measurement and system calls

      ✅ 12 untouched benchmarks


      Comparing perf/validate-share-fs-cache (505b3d0) with main (79d7cc2) Open in CodSpeed

Sign in to join this conversation.