cli: anchor auto-install freshness check at workspace root#215
Conversation
ensure_installed walked up to the nearest package.json, which in a monorepo subpackage stops at the subpackage itself. The install state file only exists at the workspace root, so every aube run / exec / start from a subpackage reported "install state not found" and re-ran install even when the root tree was fresh. Prefer find_workspace_root for the anchor, fall back to find_project_root for non-workspace projects. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Greptile SummaryThis PR fixes a spurious auto-reinstall in monorepos by anchoring Confidence Score: 5/5Safe to merge — targeted one-liner fix with a clean regression test covering the exact bug. The change is minimal, follows an established pattern in the codebase ( No files require special attention.
|
| Filename | Overview |
|---|---|
| crates/aube/src/commands/mod.rs | Fixes the freshness-check anchor in ensure_installed to prefer the workspace root over the nearest package.json, preventing spurious re-installs from monorepo subpackages. |
| test/run.bats | Adds a regression test that installs at the workspace root, runs aube start from a subpackage, and asserts no spurious auto-install occurs; relies on the fixtures/workspace/ fixture that exists in the repo. |
Reviews (1): Last reviewed commit: "cli: anchor auto-install freshness check..." | Re-trigger Greptile
## Summary - `aube install` from inside a workspace member walked up to the *nearest* `package.json` (the member's own) and ran the full standalone pipeline: own `aube-lock.yaml`, own `node_modules/.aube/` virtual store, own `.aube-state`, plus re-downloading anything not already in the global cache. - Same shape as the auto-install fix in #215, but on the explicit `aube install` codepath at `crates/aube/src/commands/install/mod.rs:1715` (#215 only covered `ensure_installed` for `aube run`/`exec`/`start`). - Fix mirrors #215 exactly: prefer `find_workspace_root`, fall back to `find_project_root`, then to the cwd. - Adds a bats regression that primes the workspace at the root, runs `aube install` from `packages/a`, and asserts no standalone artifacts appear inside the member. ## Why User-reported bug: workspace member install was re-downloading dependencies after a clean root install. The original report blamed `#hash exotic dependencies`, but that was a red herring — the truncated long-name dirs (`<prefix>_<32hex>` from `dep_path_to_filename`) just happened to be what they noticed in the per-member `.aube/` that should never have been created. ## Test plan - [x] `mise run test:bats test/workspace_member_install_walks_up.bats` — passes - [x] `mise run test:bats test/workspace.bats test/install.bats test/project_root_walk_up.bats` — all green (no regressions in the surrounding install paths) - [x] `cargo clippy --all-targets -- -D warnings` — clean 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes how `aube install` chooses its working directory in workspace scenarios, which can affect lockfile location and install outputs across monorepos. Regression coverage is added, but incorrect root detection could still change where installs write state. > > **Overview** > `aube install` now prefers `find_workspace_root` (when that root also has a `package.json`) before falling back to the nearest `package.json`, so running from a workspace member installs against the workspace root instead of creating member-local `aube-lock.yaml`, `.aube/`, and `.aube-state` artifacts. > > Adds a Bats regression test that primes a workspace install at the root, runs `aube install` from `packages/a`, and asserts no member-local artifacts are created and the root install state remains unchanged. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ba0451c. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
ensure_installedwalked up to the nearestpackage.json, which in a monorepo subpackage stops at the subpackage. The install state file only exists at the workspace root, so everyaube run/exec/startfrom a subpackage reportedinstall state not foundand spuriously re-ran install even when the root tree was fresh.find_workspace_rootas the freshness anchor, fall back tofind_project_rootfor non-workspace projects, and finally to the cwd.aube installat the workspace root, thenaube startfrompackages/appmust not printAuto-installing.Why
User report (bug #3):
aube startin a workspace package re-ran install on every invocation after a rootaube install. The freshness check was reading the wrongnode_modules/.aube-statepath.Test plan
cargo clippy --all-targets -- -D warningscargo test --release -p aube— 278 unit + 4 e2e passmise run test:bats test/run.bats— 17 tests pass, including the new regressionNote
Medium Risk
Changes the directory used to determine dependency freshness for auto-install, which can affect when installs run in monorepos vs single-package projects. Risk is limited by simple fallback logic and added end-to-end regression coverage.
Overview
Fixes auto-install staleness checks in workspaces by anchoring
ensure_installedat the workspace root (falling back to the nearestpackage.json, then the current directory) so subpackages reuse the root.aube-stateinstead of repeatedly reporting missing state and re-installing.Adds a Bats regression test that runs
aube installat the workspace root and thenaube startfrompackages/app, asserting it does not printAuto-installing.Reviewed by Cursor Bugbot for commit edf9b04. Bugbot is set up for automated code reviews on this repo. Configure here.