Skip to content

fix: discover transitive skills under pnpm's isolated linker#154

Merged
LadyBluenotes merged 3 commits into
mainfrom
fix/153-pnpm-transitive-discovery
Jun 13, 2026
Merged

fix: discover transitive skills under pnpm's isolated linker#154
LadyBluenotes merged 3 commits into
mainfrom
fix/153-pnpm-transitive-discovery

Conversation

@LadyBluenotes

@LadyBluenotes LadyBluenotes commented Jun 13, 2026

Copy link
Copy Markdown
Member

Problem

Under pnpm's isolated linker, skills from a transitive dep of a skill-bearing direct dep weren't discovered. In the repro, @tanstack/react-start (direct, ships skills) depends on @tanstack/start-client-core and @tanstack/start-server-core (both ship skills) — neither surfaced in intent list, and intent load for them failed. The tell: @tanstack/router-core was found, because its parents ship no skills.

Root cause

The walk dedups on realpath but visited the parent via its symlink path first. Resolving deps from that symlink dir fails (the .pnpm store isn't in its ancestor chain), so the transitive cores were skipped. The parent's realpath was then recorded in walkVisited, so the later real-path visit that would resolve correctly was deduped away. A package's skills were hidden because its parent ships skills.

Fix

Resolve each package's deps from its realpath (already the walkVisited key) instead of the symlink path. One-call change in walkDeps.

  • All three dedup layers and the public scanForIntents signature preserved.
  • No import()/require() of discovered code.
  • No-op for hoisted layouts (npm/yarn/bun).

Closes #153

Summary by CodeRabbit

  • Bug Fixes
    • Fixed transitive skill discovery when using pnpm’s isolated linker so skills from transitive dependencies are correctly found; npm/yarn/bun behavior unchanged.
  • Tests
    • Added tests covering pnpm isolated linking and multi-symlink resolution to prevent regressions.

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR fixes transitive skill discovery in pnpm's isolated linker by using each package's filesystem identity (pkgKey) when walking dependencies; core walker behavior updated, two regression tests added to cover pnpm layouts, and a changeset documents the patch release.

Changes

pnpm Isolated Linker Fix

Layer / File(s) Summary
Filesystem identity in dependency walker
packages/intent/src/discovery/walk.ts
walkDeps now uses pkgKey (filesystem identity) for deduplication and passes it as the fromDir to walkDepsOf; inline comment documents pnpm realpath/symlink interaction.
Transitive skill discovery test coverage
packages/intent/tests/scanner.test.ts
Adds two Vitest regression tests simulating pnpm isolated-linker layouts (store-only transitive and two symlink hops) asserting the transitive package and its skill are discovered and conflicts is empty.
Release documentation
.changeset/tangy-plants-hunt.md
Patch changeset for @tanstack/intent describing the fix and noting resolution now occurs from each package's realpath while hoisted npm/yarn/bun layouts remain unchanged.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Poem

🐰 A symlink curled where skills went shy,
I sniffed realpaths till the treasures lie,
pkgKey hopped in and cleared the view,
Now transitive skills peek out anew. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and concisely summarizes the main fix: discovering transitive skills under pnpm's isolated linker.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description comprehensively covers the problem, root cause, and fix with technical depth, and includes all required checklist items marked or addressed.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/153-pnpm-transitive-discovery

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 and usage tips.

@nx-cloud

nx-cloud Bot commented Jun 13, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 03b4539

Command Status Duration Result
nx run-many --targets=build --exclude=examples/** ✅ Succeeded 2s View ↗

☁️ Nx Cloud last updated this comment at 2026-06-13 17:13:00 UTC

@nx-cloud

nx-cloud Bot commented Jun 13, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 03b4539

Command Status Duration Result
nx run-many --targets=build --exclude=examples/** ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-06-13 17:18:38 UTC

@pkg-pr-new

pkg-pr-new Bot commented Jun 13, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 3ddf897

@LadyBluenotes LadyBluenotes merged commit d787ddc into main Jun 13, 2026
9 checks passed
@LadyBluenotes LadyBluenotes deleted the fix/153-pnpm-transitive-discovery branch June 13, 2026 17:26
@github-actions github-actions Bot mentioned this pull request Jun 13, 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.

Transitive skills of a skill-bearing direct dependency are not discovered under pnpm (start-core missing via react-start)

1 participant