Skip to content

perf: share package context, path checks, and frontmatter across maintainer batches - #337

Merged
LadyBluenotes merged 1 commit into
mainfrom
perf/maintainer-setup-batch
Oct 19, 2026
Merged

LadyBluenotes merged 1 commit into
mainfrom
perf/maintainer-setup-batch

Conversation

@LadyBluenotes

Copy link
Copy Markdown
Member

🎯 Changes

  • intent maintainer setup discovered existing skills in findExistingSkills and then passed them to planAddSkills, which repeated projectPath lstatSync walks, uncached resolveProjectContext ancestor walks, package.json reads, and SKILL.md frontmatter reads across the batch.
  • resolveProjectContext now caches findOwningPackageRoot results per IntentFsCache and uses a single statSync(path, { throwIfNoEntry: false }) probe in toSearchDir.
  • projectPath, skillPath, recordPath, readRecord, and skillEntries accept a per-batch Set<string> of verified non-symlink paths so shared directory prefixes are checked once per operation.
  • findExistingSkills, planSetupRecords, and planAddSkills share one IntentFsCache, verified path set, and parsed SKILL.md frontmatter across maintainer setup (planMaintainerSync also shares fsCache and verified paths across its skill loop), and findExistingSkills counts duplicate names in a Map instead of an $O(N^2)$ skills.some(...) scan.
  • Command output, validation rules, and exit codes do not change.
Benchmark (benchmarks/intent/maintainer.bench.ts, Vitest 4.1.11 on Windows Node) main (ab9877c) mean (rme) PR (2156afb) mean (rme) Change
maintainer setup with 20 existing skills 493.33 ms (±4.50%) 240.12 ms (±1.89%) -51.3% (2.05x)
maintainer setup with 200 existing skills 1,509.42 ms (±5.68%) 397.76 ms (±4.87%) -73.6% (3.79x)

✅ 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).

@changeset-bot

changeset-bot Bot commented Oct 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2156afb

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

This PR includes changesets to release 1 package
Name Type
@tanstack/intent Patch

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

@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

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: 8e822157-7451-49be-8a2e-1300f779a878
📥 Commits

Reviewing files that changed from the base of the PR and between ab9877c and 2156afb.

📒 Files selected for processing: 8
  • .changeset/maintainer-setup-batch.md
  • packages/intent/src/commands/maintainer.ts
  • packages/intent/src/core/project-context.ts
  • packages/intent/src/maintainer/add.ts
  • packages/intent/src/maintainer/existing.ts
  • packages/intent/src/maintainer/project.ts
  • packages/intent/src/maintainer/sync.ts
  • packages/intent/tests/repeated-work.test.ts
+-----------------------------------------+
| Code review, I will. Find bugs, I must. |
+-----------------------------------------+
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ 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.

@nx-cloud

nx-cloud Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 2156afb

Command Status Duration Result
nx affected --targets=test:eslint,test:sherif,t... ✅ Succeeded 1m 2s View ↗
nx run-many --targets=build ✅ Succeeded 1s View ↗

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

@pkg-pr-new

pkg-pr-new Bot commented Oct 19, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 2156afb

@LadyBluenotes
LadyBluenotes merged commit 79d7cc2 into main Oct 19, 2026
8 of 9 checks passed
@LadyBluenotes
LadyBluenotes deleted the perf/maintainer-setup-batch branch October 19, 2026 00:37
@codspeed

codspeed Bot commented Oct 19, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ 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/maintainer-setup-batch (2156afb) with main (ab9877c)

Open in CodSpeed

@github-actions github-actions Bot mentioned this pull request Oct 19, 2026
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