Skip to content

feat(embed): add per-install storage overrides - #1239

Merged
jdx merged 4 commits into
mainfrom
agent/embedder-install-overrides
Aug 7, 2026
Merged

jdx merged 4 commits into
mainfrom
agent/embedder-install-overrides

Conversation

@jdx

@jdx jdx commented Aug 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • add per-invocation embedder overrides for cacheDir, storeDir, and enableGlobalVirtualStore
  • add source-compatible install_with_overrides and add_with_overrides APIs
  • route install, add, frozen-lockfile verification, trust-policy metadata, and warm-path GVS detection through the invocation settings context
  • verify host-owned storage and project-local materialization with embed integration tests

Why

Embedding hosts need to own the complete lifecycle of installed packages and regenerable metadata. Process environment and project configuration were not sufficient because they could redirect embedded installs back into shared aube namespaces or enable the global virtual store.

These explicit overrides have command-line precedence without mutating process-global state, allowing mise to isolate embedded npm installs and remove their storage during mise prune.

Validation

  • cargo test --workspace
  • cargo clippy --all-targets -- -D warnings
  • cargo fmt --all -- --check
  • git diff --check

AI-assisted — Tool: Codex; model: unavailable/unavailable; version: unavailable.


Note

Medium Risk
Changes core install/fetch/store resolution and embedder isolation paths; incorrect override wiring could mis-link or reuse the wrong cache/store, though behavior is covered by new embed and settings-hash tests.

Overview
Adds EmbedderInstallOverrides and install_with_overrides / add_with_overrides so embedding hosts can pin cacheDir, storeDir, and enableGlobalVirtualStore for a single call without mutating process env or global defaults. cache_dir / store_dir are carried in a tokio task-local (native PathBufs, including non-UTF-8 on Unix); use_global_virtual_store is injected into the CLI settings bag at command precedence.

Install, embedded add, supply-chain gates, manifest packument lookups, trust-policy validation caches, resolver packument dirs, GVS reset/detection, and the install warm-path settings hash now resolve storage through with_settings_ctx_and_cli and open_store_with_ctx / resolved_*_with_ctx so overrides stay consistent for the whole invocation. fetch_packages_with_root takes an explicit packument cache path; an explicit store override disables the “already linked” fetch shortcut so a new store is not skipped.

StoredFile.store_path gains custom serde (UTF-8 string or platform-native bytes) so host-owned cache indices round-trip non-UTF-8 paths.

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

Summary by CodeRabbit

  • New Features

    • Added host-specific overrides for virtual-store, cache, and package-store locations during embedded installs and project additions.
    • Custom settings now take precedence over environment and project configuration.
    • Added support for preserving non-UTF-8 package-store paths.
  • Bug Fixes

    • Improved offline fallback behavior when the primary package cache lookup fails.
    • Ensured embedded operations consistently apply configured storage settings.
    • Storage-location changes now correctly trigger freshness checks.
    • Explicit store locations now bypass incompatible installation shortcuts.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: f44f7871-5540-40f7-abba-e0f7f4b6bebc

📥 Commits

Reviewing files that changed from the base of the PR and between fba7b14 and e302759.

📒 Files selected for processing (9)
  • crates/aube-store/src/index.rs
  • crates/aube/src/commands/add/mod.rs
  • crates/aube/src/commands/install/args.rs
  • crates/aube/src/commands/install/mod.rs
  • crates/aube/src/commands/mod.rs
  • crates/aube/src/commands/settings_context.rs
  • crates/aube/src/embed.rs
  • crates/aube/src/state.rs
  • crates/aube/tests/embed.rs
🚧 Files skipped from review as they are similar to previous changes (5)
  • crates/aube/src/commands/add/mod.rs
  • crates/aube/src/embed.rs
  • crates/aube/src/commands/mod.rs
  • crates/aube/src/state.rs
  • crates/aube/src/commands/install/mod.rs

📝 Walkthrough

Walkthrough

The embedding API now accepts host-specific cache, store, and virtual-store overrides. These overrides flow through settings resolution, embedded add operations, installation, trust-policy validation, packument fetching, storage access, and stored-path serialization.

Changes

Embedded installation overrides

Layer / File(s) Summary
Override-aware settings context
crates/aube/src/commands/settings_context.rs, crates/aube/src/commands/mod.rs, crates/aube/src/commands/install/args.rs, crates/aube/src/commands/install/mod.rs
Added EmbedderInstallOverrides and context-aware helpers for resolving cache, store, and global virtual-store paths.
Context-aware install resolution
crates/aube/src/commands/install/{mod.rs,fetch.rs,settings.rs,gvs.rs,lifecycle.rs,startup.rs}
Installation, trust-policy validation, fetch tasks, resolver setup, and lifecycle checks now use context-resolved paths.
Embedded add and install propagation
crates/aube/src/embed.rs, crates/aube/src/commands/add/*, crates/aube/src/state.rs, crates/aube/tests/embed.rs
Embedded APIs pass host overrides through supply-chain checks, manifest updates, installation, and settings hashing. CLI paths pass empty overrides. Tests cover custom storage and offline installation.
Portable stored-path serialization
crates/aube-store/src/index.rs, crates/aube/tests/embed.rs
Stored file paths use UTF-8 strings or platform-native byte and wide-character representations. Unix tests cover non-UTF-8 paths.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Host
  participant EmbedAPI
  participant SettingsContext
  participant Install
  participant Store
  Host->>EmbedAPI: install_with_overrides(options, overrides)
  EmbedAPI->>SettingsContext: scope overrides and append CLI settings
  SettingsContext->>Install: resolve cache, store, and virtual-store paths
  Install->>Store: open context-aware store
  Install->>Install: fetch using resolved packument cache
  Install-->>EmbedAPI: installation result
Loading

Possibly related PRs

  • jdx/aube#1079: Both changes propagate host-provided overrides through embedded add and install flows.
  • jdx/aube#1106: Both changes update global virtual-store and fetch-path handling.
  • jdx/aube#1146: Both changes extend cache and global virtual-store resolution with settings context.

Poem

A rabbit sets cache and store in place,
Context carries each path through the race.
Packuments follow the resolved trail,
Non-UTF-8 paths survive without fail.
Hop, hop—embedded installs prevail!

🚥 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 title clearly summarizes the main change: adding per-install storage overrides for the embed API.
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.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Comment thread crates/aube/src/commands/install/startup.rs
@greptile-apps

greptile-apps Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds invocation-scoped native storage overrides for embedded install and add operations while preserving source-compatible APIs.

  • Routes cache, store, GVS, resolver, trust-policy, fetch, and add-stage behavior through invocation settings.
  • Includes resolved storage locations in install freshness state.
  • Preserves non-UTF-8 filesystem paths through native task-local values and store-index serialization.
  • Adds integration and unit coverage for host-owned storage, warm-path invalidation, offline behavior, and native paths.

Confidence Score: 5/5

The PR appears safe to merge.

The previously reported warm-path and native-path failures are addressed, and no blocking failure remains.

Important Files Changed

Filename Overview
crates/aube/src/commands/settings_context.rs Adds task-local native storage overrides and context-aware cache, store, and GVS resolution.
crates/aube/src/commands/install/args.rs Defines the public embedder override values while keeping filesystem paths as PathBufs.
crates/aube/src/embed.rs Adds source-compatible install and add entrypoints that scope overrides to the complete operation.
crates/aube/src/state.rs Incorporates resolved cache and store paths into freshness hashing, addressing the previously reported warm-path bypass.
crates/aube/src/commands/install/startup.rs Resolves GVS compatibility metadata using the active invocation settings before accepting the warm path.
crates/aube-store/src/index.rs Adds backward-compatible native path serialization for non-UTF-8 and non-Unicode stored paths.
crates/aube/src/commands/add/mod.rs Threads invocation overrides through add validation, manifest mutation, and the chained install.
crates/aube/tests/embed.rs Exercises host-owned storage, project-local materialization, warm-path invalidation, offline behavior, and native path handling.

Reviews (4): Last reviewed commit: "fix(embed): preserve native storage path..." | Re-trigger Greptile

Comment thread crates/aube/src/embed.rs
Comment thread crates/aube/src/commands/install/args.rs Outdated

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
crates/aube/tests/embed.rs (1)

103-121: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Exercise package storage and materialization.

Both tests can pass without a registry package entering the content-addressable store. The empty install has no package. The workspace:* add resolves locally. Add a seeded cached registry dependency, then assert its project-local materialization and the absence of a global virtual-store entry.

  • crates/aube/tests/embed.rs#L103-L121: add a cached registry dependency to package.json before install_with_overrides.
  • crates/aube/tests/embed.rs#L157-L176: add or replace the workspace dependency with a seeded cached registry dependency for add_with_overrides.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/aube/tests/embed.rs` around lines 103 - 121, Add a seeded cached
registry dependency to package.json before install_with_overrides at
crates/aube/tests/embed.rs:103-121, then assert its project-local
materialization alongside the existing store checks and retain the absence of
the global virtual-store entry. At crates/aube/tests/embed.rs:157-176, add or
replace the workspace:* dependency with the same seeded cached registry
dependency before add_with_overrides, ensuring that test exercises registry
package storage and project-local materialization.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/aube/src/commands/install/args.rs`:
- Around line 340-344: Update append_to to be fallible and propagate its error
to callers. When converting cache_dir and store_dir paths, use Path::to_str()
and return an error if either returns None; do not use to_string_lossy(),
ensuring invalid UTF-8 host paths are rejected rather than rewritten.

---

Nitpick comments:
In `@crates/aube/tests/embed.rs`:
- Around line 103-121: Add a seeded cached registry dependency to package.json
before install_with_overrides at crates/aube/tests/embed.rs:103-121, then assert
its project-local materialization alongside the existing store checks and retain
the absence of the global virtual-store entry. At
crates/aube/tests/embed.rs:157-176, add or replace the workspace:* dependency
with the same seeded cached registry dependency before add_with_overrides,
ensuring that test exercises registry package storage and project-local
materialization.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 08582b29-ef76-4912-92b8-5028d2378e1e

📥 Commits

Reviewing files that changed from the base of the PR and between 50a8572 and d2ebf6a.

📒 Files selected for processing (15)
  • crates/aube/src/commands/add/filtered.rs
  • crates/aube/src/commands/add/manifest.rs
  • crates/aube/src/commands/add/mod.rs
  • crates/aube/src/commands/add/supply_chain.rs
  • crates/aube/src/commands/install/args.rs
  • crates/aube/src/commands/install/fetch.rs
  • crates/aube/src/commands/install/gvs.rs
  • crates/aube/src/commands/install/lifecycle.rs
  • crates/aube/src/commands/install/mod.rs
  • crates/aube/src/commands/install/settings.rs
  • crates/aube/src/commands/install/startup.rs
  • crates/aube/src/commands/mod.rs
  • crates/aube/src/commands/settings_context.rs
  • crates/aube/src/embed.rs
  • crates/aube/tests/embed.rs

Comment thread crates/aube/src/commands/install/args.rs Outdated

@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.

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 326ef62. Configure here.

Comment thread crates/aube/src/commands/install/mod.rs Outdated
Comment thread crates/aube/src/commands/install/args.rs Outdated
@github-actions

github-actions Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

Instruction counts

benchmark trend instructions Δ wall (min) Δ
graph ▃▁▇▁▂▁▃██▁▂▂▃▂▃▂▂▂▃ 17,541,535 → 17,561,553 +0.11% 4.47 → 4.54ms +1.67%
install ▄▄▅▄▇▁▂▃▁▃▆▂▆▆█▄▅▃▄ 128,139,239 → 133,375,361 +4.09% ⚠️ 31.63 → 31.77ms +0.45%
startup ▁██▄▄▆▄▆▆▃▅▅▅▆▆▆▄▄▅ 7,460,044 → 7,461,693 +0.02% 3.54 → 3.37ms -4.76%
tree ▁▄▄▃▅▅███▆▆▆▆▇▆▆▆▇▆ 17,730,840 → 17,729,861 -0.01% 4.79 → 4.54ms -5.18%

1 benchmark(s) above the 1% gate: install +4.09%

Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run.

Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes.

e302759805a4 vs b46ba151b359 · measured on this runner, not pushed to the history.

@jdx
jdx merged commit f40cff3 into main Aug 7, 2026
38 of 39 checks passed
@jdx
jdx deleted the agent/embedder-install-overrides branch August 7, 2026 14:38
jdx added a commit to jdx/mise that referenced this pull request Aug 7, 2026
## Summary
- update the embedded `aube` and `aube-registry` crates to v1.38.0
- refresh the aube workspace dependency graph in `Cargo.lock`

## Why

aube v1.38.0 publishes the embedder storage overrides from aubepkg/aube#1239
and structured deprecation output from aubepkg/aube#1236. Keeping the
dependency bump separate makes the follow-up mise integration changes
easier to review.

Upstream release: aubepkg/aube#1202

## Validation
- `cargo check`

*AI-assisted — Tool: Codex; model: unavailable/unavailable; version:
unavailable.*

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes where embedded aube keeps packuments and file store (existing
global aube data may be re-fetched); install behavior otherwise stays on
the same per-tool layout and lockfile names.
> 
> **Overview**
> Bumps embedded **`aube`** / **`aube-registry`** to **1.38.0**
(lockfile refresh, including **`usage-lib` 5.0** and transitive
updates).
> 
> Embedded **`npm:`** installs now call
**`aube::embed::add_with_overrides`** with mise-owned
**`$MISE_CACHE_DIR/npm/aube/cache`** and **`.../store`**,
**`use_global_virtual_store: false`**, so regenerable aube state is
prunable via **`mise cache prune npm`** instead of relying on aube’s
global virtual store. Per-tool installs still land in the tool prefix
(`node_modules`, lockfile).
> 
> **`aube_host`** docs/tests now stress **config name compatibility**
(lockfile, `aube.allowBuilds`) rather than claiming the host profile
pins all on-disk layout. E2e and a unit test lock in the new cache/store
paths.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
4b9b830. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Improvements**
* Improved embedded npm installation reliability by using consistent,
invocation-scoped cache and storage locations.
* Ensured installation state can be regenerated and remains isolated
between invocations.
* **Chores**
  * Updated embedded Aube dependencies to version 1.38.
  * Added regression coverage for npm installation storage behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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