SWE-Rebench v2 hard task
harbor run -t ibragim-badertdinov/fallow-rs__fallow-824harbor download ibragim-badertdinov/fallow-rs__fallow-824False positives for pnpm package source aliases
fallow dead-code reports 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.5
The 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 nameSo if @std/csv is declared and imported, Fallow should credit @std/csv, even if pnpm resolves it to @jsr/std__csv internally. Same for unstorage resolving to unstorage-nightly.
Create pnpm-workspace.yaml:
packages:
- apps/*
catalog:
'@std/csv': jsr:1.0.6
unstorage: npm:unstorage-nightly@2.0.0-alpha.5
Create apps/cli/package.json:
{
"name": "@example/cli",
"type": "module",
"dependencies": {
"@std/csv": "catalog:"
}
}
Create apps/cli/src/output.ts:
import { stringify } from '@std/csv/stringify';
console.log(stringify);
Create apps/native/package.json:
{
"name": "@example/native",
"type": "module",
"dependencies": {
"unstorage": "catalog:"
}
}
Create apps/native/src/storage.ts:
import { createStorage } from 'unstorage';
console.log(createStorage);
Run:
fallow dead-code --format json
Fallow should treat the package name used in package.json/imports as canonical for dependency analysis.
Expected:
@std/csv should not be reported as unused@jsr/std__csv should not be reported as unlistedunstorage should not be reported as unusedunstorage-nightly should not be reported as unlistedThe resolver may need to preserve both names for pnpm package-source entries:
@std/csv, unstorage@jsr/std__csv, unstorage-nightlyDependency usage should match against the declared/import name, not only the resolved source package name.
2.85.0
macOS
No new interfaces are introduced.