fix(workspace): discover packages nested under a bare glob-matched intermediate dir - #854
Closed
BartWaardenburg wants to merge 1 commit into
Closed
fix(workspace): discover packages nested under a bare glob-matched intermediate dir#854BartWaardenburg wants to merge 1 commit into
BartWaardenburg wants to merge 1 commit into
Conversation
BartWaardenburg
force-pushed
the
fix/issue-842-phantom-intermediate-workspace
branch
2 times, most recently
from
June 2, 2026 07:39
c7ad12f to
0b19da2
Compare
BartWaardenburg
marked this pull request as ready for review
June 2, 2026 07:42
BartWaardenburg
force-pushed
the
fix/issue-842-phantom-intermediate-workspace
branch
2 times, most recently
from
June 2, 2026 10:18
3213cea to
f33f9c2
Compare
…termediate dir A single-level workspace glob (packages/*) matches a bare grouping directory (packages/themes) that has no package.json, while the real package lives one level deeper (packages/themes/my-theme). The deep package was never discovered, so its files fell back to the root manifest and its declared deps (e.g. react) were reported as unlisted. Workspace discovery now descends one level into a no-package.json glob match and recovers any immediate child that is a real, named package, gated against node_modules / skip-list dirs / nameless manifests. Re-scopes the fix from analysis-time dependency attribution to workspace discovery so unused-files / unused-exports / boundary checks share one owning package. Replaces the prior nearest-ancestor attribution approach. Fixes #842
BartWaardenburg
force-pushed
the
fix/issue-842-phantom-intermediate-workspace
branch
from
June 2, 2026 10:19
f33f9c2 to
d56eb86
Compare
Contributor
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Fallow Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50.
| Benchmark suite | Current: d56eb86 | Previous: 2df7aae | Ratio |
|---|---|---|---|
dupe_detect_2x500_identical |
236921 ns/iter (± 4784) |
156496 ns/iter (± 2359) |
1.51 |
dupe_detect_2x2000_identical |
1079788 ns/iter (± 11967) |
714903 ns/iter (± 6355) |
1.51 |
dupe_detect_100x200_mixed |
4382385 ns/iter (± 29091) |
2919083 ns/iter (± 30803) |
1.50 |
dupe_detect_2x5000_identical |
3005720 ns/iter (± 6078) |
1966738 ns/iter (± 21340) |
1.53 |
This comment was automatically generated by workflow using github-action-benchmark.
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the false
unlisted-dependencies(e.g.react) reported for packages nested under a bare workspace-glob intermediate directory.When a root
package.jsondeclares a single-level glob such as"workspaces": ["packages/*"]but a real package lives two levels deep (packages/themes/my-theme/package.json, wherepackages/themesitself has nopackage.json), the glob only matched the barepackages/themesdirectory. The deep package was never discovered, so its files fell back to the root manifest and every dependency it correctly declared surfaced as unlisted.Approach (re-scoped to workspace discovery)
The fix lives in workspace discovery (
crates/config/src/workspace/parsers.rs), not analysis-time dependency attribution. When a workspace glob matches a directory that has nopackage.jsonof its own,expand_workspace_glob_with_diagnosticsnow descends exactly one level viarecover_nested_packagesand registers any immediate child that is a real, named package, in the same shape the discovery loop already consumes. So the deep package becomes a normal discovered workspace and feedsws_dep_map, and unused-files / unused-exports / boundary checks all see one consistent owning package.Recovery is conservative:
node_modulesand conventional skip-list directories (build output, caches, hidden dirs) are excluded, and a manifest without aname(fixtures, build artifacts,__mocks__) is rejected. When at least one child is recovered theglob-matched-no-package-jsondiagnostic is suppressed; when none is, it still fires.Tests
expand_workspace_glob_recovers_nested_package_under_bare_intermediate(config): proves the named deep package is recovered while a nameless manifest and a non-package dir under the same grouping dir are not.discover_workspaces_recovers_package_under_bare_glob_intermediate(config): end-to-end discovery reconstructing the reporter's exactworkspaces: ["./packages/*", "./themes/*"]array, assertingmetrists-theme-nextbecomes a discovered workspace (it is not onmain).Full
fallow-configworkspace suite + fullfallow-coresuite pass; clippy-D warnings, fmt, and the agent-file manifest gate are clean.Note
This replaces the earlier analysis-time attribution approach, which a panel review found did not change the reporter's output (its helper only ran when the intermediate dir was itself a tracked workspace, which it is not in the reporter's layout). The fix now reproduces and resolves the reporter's actual case.
Closes #842