False positives for pnpm package source aliases What happened? fallow dead-code reports…
- User
False positives for pnpm package source aliases
What happened?
fallow dead-codereports incorrect unused/unlisted dependency findings when pnpm package sources are used through catalogs.Example
pnpm-workspace.yaml:yamlpackages: - apps/* catalog: '@std/csv': jsr:1.0.6 unstorage: npm:unstorage-nightly@2.0.0-alpha.5The package manifests depend on the declared names:
json{ "dependencies": { "@std/csv": "catalog:" } }json{ "dependencies": { "unstorage": "catalog:" } }Source imports also use the declared names:
tsimport { stringify } from '@std/csv/stringify';tsimport { createStorage } from 'unstorage';But Fallow can report the declared package names as unused:
json{ "package_name": "@std/csv", "location": "dependencies", "path": "apps/cli/package.json" }json{ "package_name": "unstorage", "location": "dependencies", "path": "apps/native/package.json" }And report the resolved package-source names as unlisted:
json{ "package_name": "@jsr/std__csv", "imported_from": [ { "path": "apps/cli/src/output.ts" } ] }json{ "package_name": "unstorage-nightly", "imported_from": [ { "path": "apps/native/src/storage.ts" } ] }This seems to conflate the manifest/import package name with pnpm’s resolved package-source name.
pnpm documents that packages can be installed from alternate sources:
- Assistant
Now I'll implement the fix in
specifier.rs: - Assistant
Now wire it into the
NpmPackagereturn sites. First, the style-condition path: - Assistant
Now the three sites in
resolve_specifier'sResolvedbranch: - Assistant
Builds. Now add unit tests exercising a real pnpm-style symlinked layout:
- Assistant
Now add unit tests for the helper in
specifier.rs's test module: - Assistant
Now add an end-to-end resolution test in
resolve/tests.rs: - Assistant
Unit tests pass, including the guard cases. Now add an end-to-end integration test at the core level mirroring the reported scenario. First check gitignore coverage for fixture node_modules:
- Assistant
The integration test passes. Let me verify it actually guards the regression — stash the resolver fix and confirm the test fails without it:
- Assistant
Test fails without the fix and passes with it. Now run the full verification suite:
- Assistant
All green. Now run the full workspace suite to catch any downstream regressions:
- Assistant
While that runs, let me check whether
CHANGELOG.mdand the detection docs need entries: - Assistant
Now update the detection docs — find the pnpm virtual store entry:
- Assistant
While waiting for the notification, let me review the final diff:
- Assistant
The workspace suite is still running in the background (its output is piped through
sort, so it lands all at once at completion). Let me wait for it: - Assistant
Still compiling/running. I'll wait for the completion notification.
- Assistant
The full workspace test suite (
cargo test --workspace --all-targets) is still running in the background — I'll report the final results as soon as it completes. - Assistant
Monitor re-armed for up to 30 minutes. I'll report the workspace suite results when the notification arrives.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.