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 let me look at the pnpm workspace fallback and existing tests to understand the test setup patterns:
- Assistant
Add unit tests for the helper:
- Assistant
Now apply the helper in
specifier.rs. First the import: - Assistant
Now spot B (canonicalized path — the main pnpm virtual-store bug path):
- Assistant
Now spot C (canonicalize failed branch):
- Assistant
Now the style-condition resolution path (same conflation for bare style subpath imports of an aliased CSS package):
- Assistant
Now add resolver-level regression tests. Let me check
ResolveResult's derives and an existing assertion style: - Assistant
Now add resolver-level regression tests at the end of
tests.rs: - Assistant
Now build and run the graph crate tests:
- Assistant
Now let me add the end-to-end integration test. First create the fixture:
- Assistant
Now register the module in the test hub:
- Assistant
The tests fail without the fix, confirming they're load-bearing. Restore the fix:
- Assistant
Clippy passes. Now the full workspace test suite:
- Assistant
While tests run, document the behavior in the detection rules file, following the project convention:
- Assistant
typosisn't installed locally; CI covers it (all terms used are standard). Now wait for the workspace test suite: - Assistant
Both background tasks are still running; I'll wait for their completion notifications.
- Assistant
The system is under heavy load from the test suite — I'll hold off on further commands until the monitor reports results.
- Assistant
I'll wait for the monitor to report the test results before doing anything else.
- Assistant
Waiting for the workspace test run to complete — the notifications will arrive shortly.
- Assistant
I'm now waiting for the workspace test suite to finish. Once it reports, I'll confirm all tests pass and summarize the change.
- Assistant
Test suite still running; the active monitor on its output will notify when
test resultlines appear.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.