perf: hoist relative package paths and reuse project context in intent stale #341
main fromrefs/pull/341/head·merged by LadyBluenotes(GitHub profile, opens in a new tab) 🎯 Changes#
- Thread the per-run
fsCachethroughresolveStaleTargets,findWorkspaceRoot,findWorkspacePackages,scanForPolicedIntents, andfilterStaleReportSkillssointent stalereuses cached project-context, workspace-pattern, andpackage.jsonreads instead of re-readingpnpm-workspace.yamlfour times and rootpackage.jsontwice. - Compile
compileSkillSourcePolicyonce infilterStaleReportSkillsinstead of callingisSourcePermitted(which recompiled the source policy) on every reported skill. - Hoist
getRelativePackageDir(artifactRoot, packageDir)out of the per-artifact loops inbuildArtifactSignalsandbuildWorkspaceCoverageSignalssopath.relativeis computed once per package instead of once per_artifactsentry, and checkhasGeneratedSkillbefore computing uncovered-package metadata inbuildWorkspaceCoverageSignals. - Reported staleness, coverage signals, and exit codes do not change.
- Adds a patch changeset.
Benchmark (benchmarks/intent/stale.bench.ts, Node v24.14.1 win32 x64) | Baseline (main cb45f14) | Candidate (PR) | Change |
|---|---|---|---|
reports workspace drift | 53.45 hz (mean 18.71 ms, p75 19.46 ms, ±0.81%, N=535) | 58.54 hz (mean 17.08 ms, p75 17.22 ms, ±1.56%, N=586) | -8.7% mean (1.10x hz) |
reports workspace drift with shared artifacts | 46.80 hz (mean 21.37 ms, p75 22.29 ms, ±0.84%, N=469) | 55.52 hz (mean 18.01 ms, p75 18.36 ms, ±0.52%, N=556) | -15.7% mean (1.19x hz) |
✅ Checklist#
- I have followed the steps in the Contributing guide.
- I have tested this code locally with
pnpm run test:pr(runpnpm build:allfirst).
🚀 Release Impact#
- This change affects published code, and I have generated a changeset.
- This change is docs/CI/dev-only (no release).
- 1
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:
d00df163-c19b-4521-835b-a09b825e19d5
📥 Commits
-
Reviewing files that changed from the base of the PR and between cb45f14ef6a6ba452ee85f5e2c4a3d98a90c8a05 and 447adafbe180384119c130a1bad31d509f4306fb.
📒 Files selected for processing: 6
-
.changeset/stale-reuse-context-and-relpath.mdpackages/intent/src/commands/stale.tspackages/intent/src/commands/support.tspackages/intent/src/core/source-policy.tspackages/intent/src/staleness/check.tspackages/intent/tests/repeated-work.test.ts
+-----------------------------------------------------------+ | Veni, Vidi, Codici Fixi. I came, I saw, I fixed the code. | +-----------------------------------------------------------+ \ \ (\__/) (•ㅅ•) / づ✨ 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.
Comment `@coderabbitai help` to get the list of available commands.-
View your CI Pipeline Execution ↗ for commit 447adafbe180384119c130a1bad31d509f4306fb
Command Status Duration Result nx affected --targets=test:eslint,test:sherif,t...✅ Succeeded 41s View ↗ nx run-many --targets=build✅ Succeeded 1s View ↗
☁️ Nx Cloud last updated this comment at
2026-10-19 01:06:03UTCMerging this PR will not alter performance#
:warning: 9 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.
✅ 12untouched benchmarks
Comparingperf/stale-reuse-context-and-relpath(16c71b9) withmain(cb45f14)
Sign in to join this conversation.
🦋 Changeset detected#
Latest commit: 16c71b9c2f9b8388911cedb07a71722cb9922349
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
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