Skip to content

fix(lockfile): preserve imported workspace links#535

Merged
jdx merged 1 commit intomainfrom
fix/imported-workspace-link-drift
May 7, 2026
Merged

fix(lockfile): preserve imported workspace links#535
jdx merged 1 commit intomainfrom
fix/imported-workspace-link-drift

Conversation

@jdx
Copy link
Copy Markdown
Contributor

@jdx jdx commented May 7, 2026

Summary

  • Allow workspace-aware frozen drift checks to keep root link: entries that point at current workspace packages.
  • Add a regression test for npm-imported workspace links that are not declared in the root manifest.

Why

aube import preserves npm workspace root links in aube-lock.yaml, including links for workspace packages that npm exposes at the root even when the root package.json does not list them as dependencies. A later aube ci treated those imported links as removed manifest dependencies and rejected the lockfile as stale, which prevented the linker from recreating node_modules/@scope/* workspace symlinks after switching from package-lock.json to aube-lock.yaml.

Validation

  • cargo test -p aube-lockfile
  • cargo fmt --check
  • Pre-commit hook: cargo clippy --manifest-path crates/aube-lockfile/Cargo.toml --fix --allow-dirty --allow-staged --quiet
  • Manual minimal repro for aube import && rm package-lock.json && aube ci --ignore-scripts, confirming root workspace symlinks are created.

Note

Medium Risk
Adjusts workspace frozen-lockfile drift detection to treat certain root link: entries as non-drift, which could potentially mask a real removed dependency if the heuristic misfires. Scope is limited to workspace-aware drift logic and is covered by a new regression test.

Overview
Workspace-aware drift checking now preserves root-level link: entries that point at current workspace packages, even when the root package.json doesn’t declare them.

This threads a workspace package-name set into the importer drift check and skips the “manifest removed” stale result when the locked entry is a root importer dep whose resolved LockedPackage is a LocalSource::Link. A regression test was added to ensure check_drift_workspace stays Fresh for npm-imported workspace root links.

Reviewed by Cursor Bugbot for commit bf791e9. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 7, 2026

Greptile Summary

Fixes a false-stale lockfile error where aube ci rejected imported npm-workspace root link: entries whose workspace packages are not listed in the root package.json. The fix collects workspace package names upfront, then skips the "manifest removed" drift check for root entries that are confirmed link: sources pointing at a known workspace package.

  • check_drift_for_importer is refactored into a two-layer design: the existing public method now delegates to check_drift_for_importer_with_workspace_links, and check_drift_workspace calls the inner form directly with the computed workspace_link_names set.
  • The workspace-link exemption is deliberately narrow: it only fires for the root importer (\".\"), only when the locked name appears in the workspace manifests, and only when the resolved package has LocalSource::Link(_).
  • A regression test (workspace_drift_allows_root_links_for_workspace_packages) exercises the exact scenario from the bug report.

Confidence Score: 5/5

Safe to merge — the change is well-scoped, the exemption condition is tight, and removal of a workspace package from the manifests slice still triggers stale correctly.

The workspace-link exemption requires three independent conditions to all be true (root importer, name in workspace-manifest set, resolved package is a link), making accidental over-exemption very unlikely. The non-workspace check_drift path is unaffected (passes an empty HashSet). The refactoring is minimal and the regression test directly covers the reported failure scenario.

No files require special attention.

Important Files Changed

Filename Overview
crates/aube-lockfile/src/lib.rs Adds a workspace-link exemption in the "manifest removed" drift check and refactors check_drift_for_importer into a two-layer design; includes a regression test covering the import→ci symlink scenario.

Reviews (1): Last reviewed commit: "fix(lockfile): preserve imported workspa..." | Re-trigger Greptile

@jdx jdx enabled auto-merge (squash) May 7, 2026 11:58
@jdx jdx merged commit c95bb45 into main May 7, 2026
20 checks passed
@jdx jdx deleted the fix/imported-workspace-link-drift branch May 7, 2026 11:59
@greptile-apps greptile-apps Bot mentioned this pull request May 7, 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.

1 participant