Skip to content

cli: anchor auto-install freshness check at workspace root#215

Merged
jdx merged 1 commit intomainfrom
claude/upbeat-hodgkin-d652f4
Apr 22, 2026
Merged

cli: anchor auto-install freshness check at workspace root#215
jdx merged 1 commit intomainfrom
claude/upbeat-hodgkin-d652f4

Conversation

@jdx
Copy link
Copy Markdown
Contributor

@jdx jdx commented Apr 22, 2026

Summary

  • ensure_installed walked up to the nearest package.json, which in a monorepo subpackage stops at the subpackage. 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 spuriously re-ran install even when the root tree was fresh.
  • Prefer find_workspace_root as the freshness anchor, fall back to find_project_root for non-workspace projects, and finally to the cwd.
  • Added a regression test: aube install at the workspace root, then aube start from packages/app must not print Auto-installing.

Why

User report (bug #3): aube start in a workspace package re-ran install on every invocation after a root aube install. The freshness check was reading the wrong node_modules/.aube-state path.

Test plan

  • cargo clippy --all-targets -- -D warnings
  • cargo test --release -p aube — 278 unit + 4 e2e pass
  • mise run test:bats test/run.bats — 17 tests pass, including the new regression

Note

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_installed at the workspace root (falling back to the nearest package.json, then the current directory) so subpackages reuse the root .aube-state instead of repeatedly reporting missing state and re-installing.

Adds a Bats regression test that runs aube install at the workspace root and then aube start from packages/app, asserting it does not print Auto-installing.

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

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-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 22, 2026

Greptile Summary

This PR fixes a spurious auto-reinstall in monorepos by anchoring ensure_installed's freshness check at the workspace root (via find_workspace_root) rather than the nearest package.json. The fix mirrors the same find_workspace_rootfind_project_rootinitial_cwd fallback chain already used by other commands in main.rs, and the new regression test exercises the exact failure path using the existing fixtures/workspace/ structure.

Confidence Score: 5/5

Safe 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 (main.rs:1358-1360), has no correctness issues, and is covered by a purpose-built bats test with a pre-existing fixture.

No files require special attention.

Important Files Changed

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

@jdx jdx merged commit 11e4dfd into main Apr 22, 2026
13 of 15 checks passed
@jdx jdx deleted the claude/upbeat-hodgkin-d652f4 branch April 22, 2026 21:12
jdx added a commit that referenced this pull request Apr 22, 2026
## 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>
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