Skip to content

feat(linker): add hoisting limits#809

Merged
jdx merged 7 commits into
mainfrom
feat/hoisting-limits
May 31, 2026
Merged

feat(linker): add hoisting limits#809
jdx merged 7 commits into
mainfrom
feat/hoisting-limits

Conversation

@jdx

@jdx jdx commented May 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • add pnpm-compatible hoistingLimits setting metadata and docs
  • wire hoistingLimits into nodeLinker=hoisted planning and install-state hashing
  • keep transitive packages under their introducing direct dependency for dependencies mode

Tests

  • cargo fmt --check
  • cargo test -p aube-settings
  • cargo test -p aube-linker hoisted::tests::dependencies_limit_keeps_transitives_under_their_direct_dep
  • cargo test -p aube-manifest workspace::tests::test_settings
  • cargo check -p aube

This PR was generated by Codex.


Note

Medium Risk
Changes hoisted node_modules layout and install-state hashing; misconfiguration could alter resolution paths for tools expecting maximum hoisting, though isolated installs are unaffected.

Overview
Adds pnpm-compatible hoistingLimits for nodeLinker=hoisted: new setting surface (.npmrc, env, workspace YAML, settings.toml, docs) and a HoistingLimits knob on the linker.

When set to dependencies, the hoisted placement planner caps how far transitives can be promoted—they stay under the direct dependency that introduced them, while still reusing an already-visible matching install and respecting same-name version blockers. none / workspaces keep prior “hoist as far as possible” behavior (workspaces is documented as equivalent to none for aube’s per-importer planning).

Install and rebuild pass the resolved limit into hoisted linking and HoistedPlacements::from_graph; install-state hashing includes the value so tree layout invalidates when it changes. Isolated linking ignores the setting.

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

Summary by CodeRabbit

  • New Features

    • Added hoistingLimits configuration setting to control dependency hoisting behavior. Supports three modes: "none", "workspaces", and "dependencies" (default: "none").
    • New setting can be configured via CLI, environment variables, .npmrc, and workspace configuration files.
  • Documentation

    • Documentation added for the hoistingLimits setting.

Comment thread crates/aube-linker/src/hoisted.rs Outdated
@greptile-apps

greptile-apps Bot commented May 31, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds pnpm-compatible hoistingLimits support for node-linker=hoisted: new setting metadata (settings.toml, env, .npmrc, workspace YAML), docs, and a WorkspaceConfig field are wired through install linking and install-state hashing so tree-shape changes invalidate correctly.

  • The placement planner (hoisted.rs) gains a floor parameter that caps how far transitives may be promoted; with dependencies mode, transitive packages stay under the direct dep that introduced them, while still reusing matching packages already visible above the floor and correctly blocking on version conflicts.
  • HoistedPlacements::from_graph now accepts hoisting_limits so aube rebuild reconstructs paths that match the linked tree, fixing the mismatch identified in a prior review.
  • Four targeted unit tests cover the unlimited baseline, limited nesting, above-floor reuse, and blocked reuse across conflicting versions.

Confidence Score: 5/5

Safe to merge; the new placement logic is well-tested and the prior from_graph correctness gap has been addressed.

The placement algorithm changes are covered by four unit tests that exercise each code path. The from_graph rebuild fix correctly threads the resolved setting through. The only observation is a minor hash-formatting inconsistency in state.rs that does not affect correctness or stability.

No files require special attention.

Important Files Changed

Filename Overview
crates/aube-linker/src/hoisted.rs Core placement planner updated: floor parameter threads through the BFS, from_graph now accepts hoisting_limits, unit tests added covering all three cases. Logic is correct.
crates/aube/src/state.rs Adds hoisting_limits to the install-state hash. Uses {:?} Debug formatting instead of the stable as_str() method, and splits the update across three calls unlike adjacent settings.
crates/aube/src/commands/rebuild.rs Now passes resolved hoisting_limits to HoistedPlacements::from_graph, fixing the path-reconstruction mismatch for dependencies mode.
crates/aube-settings/settings.toml New hoistingLimits entry with correct type, default, env vars, and keys. Will generate a typed HoistingLimits enum via build.rs.
docs/settings/index.md Documentation entry for hoistingLimits added. Accurate and consistent with settings.toml.

Fix All in Claude Code

Reviews (6): Last reviewed commit: "docs(settings): regenerate hoisting limi..." | Re-trigger Greptile

Comment thread crates/aube-linker/src/hoisted.rs Outdated
Comment thread crates/aube-linker/src/hoisted.rs Outdated
Comment thread crates/aube-linker/src/hoisted.rs
@jdx jdx force-pushed the feat/hoisting-limits branch from c0ae092 to a7c0839 Compare May 31, 2026 14:33
Comment thread crates/aube-linker/src/hoisted.rs

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 3 total unresolved issues (including 2 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 790d2d8. Configure here.

Comment thread crates/aube-linker/src/hoisted.rs
@coderabbitai

coderabbitai Bot commented May 31, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8fc9e8e7-de9b-467a-9445-3a09e76f449c

📥 Commits

Reviewing files that changed from the base of the PR and between 71326d5 and a279120.

📒 Files selected for processing (10)
  • crates/aube-linker/src/builder.rs
  • crates/aube-linker/src/hoisted.rs
  • crates/aube-linker/src/lib.rs
  • crates/aube-manifest/src/workspace/config.rs
  • crates/aube-settings/settings.toml
  • crates/aube/src/commands/install/link.rs
  • crates/aube/src/commands/mod.rs
  • crates/aube/src/commands/rebuild.rs
  • crates/aube/src/state.rs
  • docs/settings/index.md

📝 Walkthrough

Walkthrough

This PR introduces hoisting limits configuration for NodeLinker::Hoisted mode. A new HoistingLimits enum controls how far dependencies are hoisted: None allows unrestricted hoisting, Workspaces hoists only within workspaces, and Dependencies hoists only directly into direct dependents. The placement algorithm enforces limits via a per-dependency floor parameter, threading the setting through commands and including it in the state hash for cache freshness.

Changes

Hoisting Limits Configuration

Layer / File(s) Summary
Type definition and builder interface
crates/aube-linker/src/lib.rs, crates/aube-linker/src/builder.rs
HoistingLimits enum is defined with variants for None, Workspaces, and Dependencies; the Linker struct gains a hoisting_limits field initialized to None; a with_hoisting_limits builder method is provided to configure it.
Hoisted placement algorithm with floor constraints
crates/aube-linker/src/hoisted.rs
The placement planning algorithm is extended to accept HoistingLimits and enforce them via a floor parameter on each dependency. Transitive dependencies are enqueued with computed child_floor values based on the limit mode; reuse and conflict-breaking logic respects the per-item placement floor. Tests validate dependency-limit behavior including keeping transitive deps under direct deps and version-blocker semantics.
Configuration deserialization and conversion
crates/aube-manifest/src/workspace/config.rs, crates/aube-settings/settings.toml, crates/aube/src/commands/mod.rs
WorkspaceConfig gains an optional hoisting_limits string field to deserialize from YAML; a [hoistingLimits] setting is defined with enum type `"none"
Install and rebuild command integration
crates/aube/src/commands/install/link.rs, crates/aube/src/commands/rebuild.rs, crates/aube/src/state.rs
The install link phase and rebuild command derive hoisting_limits from settings and apply it to placement planning. The settings hash is extended to include hoisting_limits for install-state cache invalidation.
User-facing documentation
docs/settings/index.md
A new hoistingLimits entry is added to the settings summary table; a detailed documentation section describes supported modes, defaults, configuration sources, and usage examples.

🎯 3 (Moderate) | ⏱️ ~20 minutes

🐰 A rabbit hops through the linker today,
With limits on hoisting now showing the way—
Transitive deps stay below their direct friend,
Configuration controls where the climbing will end!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat(linker): add hoisting limits' directly summarizes the primary change: introducing a new hoisting limits feature to the linker, which is the core objective across all modified files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/hoisting-limits

Comment @coderabbitai help to get the list of available commands and usage tips.

@jdx jdx merged commit 2f021d4 into main May 31, 2026
19 checks passed
@jdx jdx deleted the feat/hoisting-limits branch May 31, 2026 15:18
@greptile-apps greptile-apps Bot mentioned this pull request May 31, 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