Skip to content

feat(root): prefer Aspect markers over Bazel markers when discovering project root#1122

Open
gregmagolan wants to merge 1 commit into
mainfrom
feat/aspect-aware-root-discovery
Open

feat(root): prefer Aspect markers over Bazel markers when discovering project root#1122
gregmagolan wants to merge 1 commit into
mainfrom
feat/aspect-aware-root-discovery

Conversation

@gregmagolan
Copy link
Copy Markdown
Member

Two-pass walk over the ancestors of the current working directory when discovering the project root:

  1. Pick the deepest ancestor containing MODULE.aspect or .aspect/version.axl.
  2. If none found, fall back to the Bazel markers (MODULE.bazel, MODULE.bazel.lock, REPO.bazel, WORKSPACE, WORKSPACE.bazel).
  3. If still none found, use the current working directory.

Lets a nested Aspect workspace inside a Bazel monorepo opt out of the surrounding Bazel root:

/mono/MODULE.bazel          ← outer Bazel monorepo
/mono/proj/.aspect/version.axl
/mono/proj/src/             ← `aspect` here now picks /mono/proj as root

Applies symmetrically to the launcher (aspect-launcher/src/config.rs::autoconf) — which reads <root>/.aspect/version.axl to pick the CLI binary version — and the spawned CLI (aspect-cli/src/helpers.rs::find_repo_root) — which loads <root>/.aspect/*.axl after spawn.


Changes are visible to end-users: yes

  • Searched for relevant documentation and updated as needed: yes
  • Breaking change (forces users to change their own code or config): no
  • Suggested release notes appear below: yes

Suggested release notes:

  • A nested Aspect workspace inside a Bazel monorepo (signaled by MODULE.aspect or .aspect/version.axl) now resolves to itself as the project root instead of the outer Bazel root.

Test plan

  • New unit tests in aspect-launcher/src/config.rs for the four resolution paths: Aspect-over-Bazel preference, MODULE.aspect recognition, Bazel-marker fallback, no-markers fallback to cwd.
  • Manual sub-workspace check: created /$TMP/MODULE.bazel + /$TMP/proj/.aspect/version.axl + /$TMP/proj/.aspect/smoke.axl (defining a aspect-root-smoke task), then ran aspect --help from /$TMP/proj/src/. The task appears, confirming root resolved to proj/. Removing proj/.aspect/ from the same tree drops the task from --help, confirming the Bazel-only fallback path still works.

… project root

Two-pass walk over ancestors of the current working directory:

1. Pick the deepest ancestor containing `MODULE.aspect` or `.aspect/version.axl`.
2. If none found, fall back to scanning for Bazel markers (`MODULE.bazel`,
   `MODULE.bazel.lock`, `REPO.bazel`, `WORKSPACE`, `WORKSPACE.bazel`).
3. If still none found, use the current working directory.

This lets a nested Aspect workspace inside a Bazel monorepo (e.g.
`/mono/proj/.aspect/version.axl` under `/mono/MODULE.bazel`) opt out of the
surrounding Bazel root. Applies to both the launcher (which reads
`<root>/.aspect/version.axl` to pick the CLI version) and the CLI (which
loads `<root>/.aspect/*.axl` after spawn).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@aspect-workflows
Copy link
Copy Markdown

aspect-workflows Bot commented May 24, 2026

✨ Aspect Workflows Tasks

📅 Sun May 24 07:52:36 UTC 2026

⚠️ 2 flagged tasks

  • ⚠️ delivery (delivery-gha) · ⏱ 21.5s · ✨ Aspect · 🐙 GitHub Actions · ☑️ Check
    💬 Delivery complete (2 warn · 1 skipped)
  • ⚠️ delivery (delivery-gha-debug) · ⏱ 29.8s · ✨ Aspect · 🐙 GitHub Actions · ☑️ Check
    💬 Delivery complete (2 warn · 1 skipped)

✅ 17 successful tasks

  • ✅ build (build-gha) · ⏱ 22.1s · ✨ Aspect · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel build complete (158 built)
  • ✅ build (build-gha-debug) · ⏱ 1m 54s · ✨ Aspect · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel build complete (158 built)
  • ✅ buildifier (buildifier-gha) · ⏱ 14.1s · ✨ Aspect · 🐙 GitHub Actions · ☑️ Check
    💬 Format complete (clean)
  • ✅ buildifier (buildifier-gha-debug) · ⏱ 17.3s · ✨ Aspect · 🐙 GitHub Actions · ☑️ Check
    💬 Format complete (clean)
  • ✅ buildifier (buildifier-gha-ephemeral) · ⏱ 51.8s · 🐙 GitHub Actions · ☑️ Check
    💬 Format complete (clean)
  • ✅ format (format-gha) · ⏱ 15.4s · ✨ Aspect · 🐙 GitHub Actions · ☑️ Check
    💬 Format complete (clean)
  • ✅ format (format-gha-debug) · ⏱ 22s · ✨ Aspect · 🐙 GitHub Actions · ☑️ Check
    💬 Format complete (clean)
  • ✅ format (format-gha-ephemeral) · ⏱ 2m 8s · 🐙 GitHub Actions · ☑️ Check
    💬 Format complete (clean)
  • ✅ gazelle (gazelle-from-source-gha) · ⏱ 16.7s · ✨ Aspect · 🐙 GitHub Actions · ☑️ Check
    💬 Gazelle complete (clean)
  • ✅ gazelle (gazelle-from-source-gha-debug) · ⏱ 44.3s · ✨ Aspect · 🐙 GitHub Actions · ☑️ Check
    💬 Gazelle complete (clean)
  • ✅ gazelle (gazelle-gha) · ⏱ 12.9s · ✨ Aspect · 🐙 GitHub Actions · ☑️ Check
    💬 Gazelle complete (clean)
  • ✅ gazelle (gazelle-gha-debug) · ⏱ 13.8s · ✨ Aspect · 🐙 GitHub Actions · ☑️ Check
    💬 Gazelle complete (clean)
  • ✅ gazelle (gazelle-gha-ephemeral) · ⏱ 1m 12s · 🐙 GitHub Actions · ☑️ Check
    💬 Gazelle complete (clean)
  • ✅ lint (lint-gha) · ⏱ 16.7s · ✨ Aspect · 🐙 GitHub Actions · ☑️ Check
    💬 Lint complete (clean)
  • ✅ lint (lint-gha-debug) · ⏱ 17.5s · ✨ Aspect · 🐙 GitHub Actions · ☑️ Check
    💬 Lint complete (clean)
  • ✅ test (test-gha) · ⏱ 29.5s · ✨ Aspect · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (25/25 passed · 25 cached)
  • ✅ test (test-gha-debug) · ⏱ 3m 1s · ✨ Aspect · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (25/25 passed · 25 cached)

🔁 Reproduce

⚠️ delivery (delivery-gha · delivery-gha-debug)

aspect delivery --mode=always --track-state=false --dry-run=true

CI ran --mode=selective; --mode=always is the off-runner equivalent (selective change detection needs the Aspect Workflows delivery state backend).


⏱ Last updated Sun May 24 07:56:44 UTC 2026 · 📊 GitHub API quota 1,996/15,000 (13% used, resets in 55m, throttle 3×)
🚀 Powered by Aspect CLI (v0.0.0-dev)  |  Aspect Build · X · LinkedIn · YouTube

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