feat: harden Cargo workspace detection with TOML parsing#50
Merged
thefourcraft merged 2 commits intoproductionfrom May 4, 2026
Merged
Conversation
Replace line-scanner in parse_cargo_workspace_members with proper TOML parsing via the existing toml crate. - Parse workspace.members patterns via toml::Value instead of regex scanning - Include root package as member '.' when both [package] and [workspace] present - Respect workspace.exclude patterns (including basic glob matching) - Deduplicate members with BTreeSet for deterministic ordering - Fall back to prior line-scanner if TOML parse fails (malformed files)
…anged The '.' member (workspace root with [package]) has member.root == workspace root, so the old prefix check would select it for every change anywhere in the repo. Now '.' is selected only when at least one changed file falls outside every other member's subtree — a sub-member-only change no longer spuriously triggers the root package.
6 tasks
thefourcraft
added a commit
that referenced
this pull request
May 4, 2026
* feat: harden JS workspace glob handling with exclusions and dedup pnpm-workspace.yaml, lerna.json, and package.json workspaces arrays now: - Respect !-prefixed exclusion patterns (e.g. '!packages/experimental') - Deduplicate overlapping patterns (e.g. ["packages/*", "packages/api"]) via BTreeSet on relative path — first occurrence wins New helpers: parse_yaml_list_items, js_glob_excludes, expand_js_workspace_patterns. Cargo detection from PR #50 is unchanged. * fix: parse_yaml_list_items scopes to packages: section only Previously the parser collected list items from every section of pnpm-workspace.yaml. Now it tracks whether we are inside the top-level packages: block and stops collecting when a new top-level key appears, so values in ignoredBuiltDependencies, catalogs, and other sections cannot be mistaken for workspace members.
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
parse_cargo_workspace_memberswith proper TOML parsing via the existingtomlcrate (no new dependencies)"."whenCargo.tomlhas both[package]and[workspace](virtual manifests stay unaffected)workspace.excludepatterns, including basic glob matching (*wildcard)BTreeSetfor deterministic lexicographic orderingTest plan
cargo_workspace_with_package_and_workspace_includes_root_as_dot— root package added as"."cargo_workspace_exclude_removes_matching_members— excluded paths filtered outcargo_workspace_deduplicates_overlapping_patterns— overlapping globs yield no duplicatescargo_workspace_root_member_has_workspace_root_stamped— root member has correctrootpathcargo clippy --bin barzel -- -D warningsclean