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:packages: - apps/* catalog: '@std/csv': jsr:1.0.6 unstorage: npm:unstorage-nightly@2.0.0-alpha.5The package manifests depend on the declared names:
{ "dependencies": { "@std/csv": "catalog:" } }{ "dependencies": { "unstorage": "catalog:" } }Source imports also use the declared names:
import { stringify } from '@std/csv/stringify';import { createStorage } from 'unstorage';But Fallow can report the declared package names as unused:
{ "package_name": "@std/csv", "location": "dependencies", "path": "apps/cli/package.json" }{ "package_name": "unstorage", "location": "dependencies", "path": "apps/native/package.json" }And report the resolved package-source names as unlisted:
{ "package_name": "@jsr/std__csv", "imported_from": [ { "path": "apps/cli/src/output.ts" } ] }{ "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:
jsr:installs from the JSR registrynpm:<name>@<version>can resolve a declared dependency through a different npm package name- package sources are part of pnpm’s supported dependency model, not separate source imports
So if
@std/csvis declared and imported, Fallow should credit@std/csv, even if pnpm resolves it to@jsr/std__csvinternally. Same forunstorageresolving tounstorage-nightly.Reproduction
Create
pnpm-workspace.yaml:packages: - apps/* catalog: '@std/csv': jsr:1.0.6 unstorage: npm:unstorage-nightly@2.0.0-alpha.5 - Assistant
Now let me look at how the resolver determines the package name for a resolved import:
- Assistant
Let me look at the integration test setup to understand how to reproduce:
- Assistant
Now let me examine how
find_unused_dependenciesattributes usage per workspace: - Assistant
Now I'll implement the fix. First, add the helper to
specifier.rs: - Assistant
Now apply it at the
NpmPackageconstruction sites inresolve_specifier: - Assistant
Now the style-condition package resolution sites:
- Assistant
Unit tests pass. Now add an end-to-end integration test reproducing the reported scenario:
- Assistant
Both pass with the fix. Now verify the main test actually fails without the fix — temporarily neutralize the helper:
- Assistant
The test reproduces the exact reported false positives without the fix. Now run the full test suites, clippy, and fmt:
- Assistant
All graph and core tests pass. Let me run the full workspace suite to catch any downstream impacts:
- Assistant
Clippy collided with the concurrent background test build. I'll wait for the tests to finish and rerun:
- Assistant
The diff is clean. Waiting on the workspace suite to finish:
- Assistant
The shell is failing system-wide — likely process/memory exhaustion from the concurrent workspace build. I'll wait for the background monitor to report rather than hammering it.
- Assistant
I'll wait for the background workspace-test task to complete and notify.
- Assistant
- Assistant
The environment still can't fork new processes (
Cannot forkfrom the shell hook), so the workspace verification is stalled. I've armed a 30-minute monitor that will report as soon as the system recovers and the backgroundcargo test --workspace --all-targetsrun finishes — I'll relay its result then.To recap the verification already completed before the resource exhaustion:
- The targeted suites covering the changed code passed in full:
fallow-graph(475 tests) andfallow-core(2477 unit + 547 integration, including the two new end-to-end tests reproducing this issue). - The main integration test was confirmed to fail with the exact reported false positives (
@std/csv/unstorageunused) when the fix is removed, and passes with it. cargo fmtand crate-scoped clippy are clean.
- The targeted suites covering the changed code passed in full:
- Assistant
Still no fork capacity — even the monitor script itself can't spawn (exit 254). At this point the only reliable signal is the completion notification from the original background task (
bvws1cdcy, thecargo test --workspace --all-targetsrun): the harness watches that process directly and will re-invoke me when it exits, without needing a new process. I'll report its outcome as soon as that fires.Status remains: the fix and its targeted verification are complete (fallow-graph + fallow-core suites green, new tests proven to catch the regression, fmt/clippy clean on the touched crates); only the belt-and-suspenders full-workspace run is outstanding, blocked on the environment's process exhaustion rather than on the change itself.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.