Skip to content

fix(update): include root package in workspace version map#757

Merged
jdx merged 2 commits into
jdx:mainfrom
fu050409:fix/root-workspace-pkg
May 20, 2026
Merged

fix(update): include root package in workspace version map#757
jdx merged 2 commits into
jdx:mainfrom
fu050409:fix/root-workspace-pkg

Conversation

@fu050409

Copy link
Copy Markdown
Contributor

Problem

When the workspace root's package.json defines a name and version, and a child package depends on the root package via the workspace:* protocol, aube update / aube install fails with ERR_AUBE_NO_MATCHING_VERSION.

Root Cause

Root Cause: ws_package_versions is built solely from the glob matches of packages: in pnpm-workspace.yaml. The root package itself is not included in the glob, so its name+version is never added to the map. try_workspace_link checks workspace_packages.get, which returns None, causing a fallback to registry fetch. Then pick_version cannot resolve workspace:* as a semver range.

Fixes (2 locations)

File Lines
install/workspace.rs 42-46 (discover_workspace_plan)
update.rs 780-787 (workspace_package_versions)

Both locations now use root.version.as_deref().unwrap_or("0.0.0") as a fallback when the version field is missing, consistent with the handling for child packages.

@greptile-apps

greptile-apps Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Fixes aube update/aube install failing with ERR_AUBE_NO_MATCHING_VERSION when a child package depends on the workspace root via workspace:*. The root package was excluded from the workspace version map because glob discovery only walks packages: entries; both affected sites now seed the map from the root package.json before iterating workspace members.

  • install/workspace.rs: root name+version is inserted into ws_package_versions and ws_dirs before the workspace-member loop, so the linker can create node_modules/<root-name> symlinks in child packages.
  • update.rs: root package.json is read and registered at the top of workspace_package_versions, with IO errors silently skipped (yaml-only workspaces) and parse errors surfaced as tracing::warn!, consistent with child-package handling. Four targeted unit tests cover the new behaviour.

Confidence Score: 5/5

Safe to merge — both changes are additive insertions before existing loops with no mutation of existing logic paths.

The two code sites are symmetric and self-contained: each seeds the version map from the root manifest and falls back to "0.0.0" when version is absent, matching the identical pattern already used for child packages. The only edge case worth noting — a workspace whose packages: glob includes "." — results in a harmless double-insert of the same key/value. Error handling in update.rs correctly distinguishes missing-file (silent) from malformed-JSON (warn), and the four new tests cover the fix's core scenarios.

No files require special attention.

Important Files Changed

Filename Overview
crates/aube/src/commands/install/workspace.rs Registers root package into ws_package_versions and ws_dirs before iterating workspace members; the linker's symlink path for workspace:* deps on the root is now populated correctly.
crates/aube/src/commands/update.rs Adds root package.json to the version map with proper error discrimination (silent IO skip, warn on parse errors) and four new unit tests covering all key edge cases.

Reviews (2): Last reviewed commit: "fix(update): apply cr and add tests" | Re-trigger Greptile

Comment thread crates/aube/src/commands/install/workspace.rs
Comment thread crates/aube/src/commands/update.rs Outdated
@jdx

jdx commented May 20, 2026

Copy link
Copy Markdown
Owner

will need a test

@fu050409

Copy link
Copy Markdown
Contributor Author

will need a test

Thanks for your attention. I'm currently optimizing based on greptile's CR report.

@fu050409

fu050409 commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

@jdx All changes in this PR have been covered by unit tests and have passed local testing via mise run test. PTAL.

@jdx jdx merged commit a8a0e9c into jdx:main May 20, 2026
16 checks passed
@greptile-apps greptile-apps Bot mentioned this pull request May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants