Skip to content

fix(auth): honor config-defaulted --aspect-* flags, user-over-repo default, and migrate legacy credentials#1316

Open
gregmagolan wants to merge 1 commit into
mainfrom
fix/auth-config-defaults-and-migration
Open

fix(auth): honor config-defaulted --aspect-* flags, user-over-repo default, and migrate legacy credentials#1316
gregmagolan wants to merge 1 commit into
mainfrom
fix/auth-config-defaults-and-migration

Conversation

@gregmagolan

Copy link
Copy Markdown
Member

Three fixes to the aspect auth feature (#1312), each flagged in automated review on #1315 (out of scope there — the code lives in the merged auth work, not the BES change).

1. Config-defaulted --aspect-* flags were ignored. _want gated on ctx.args.is_explicit(name), which only tracks CLI-supplied args — so a repo config.axl default such as aspect_remote_cache = True fell through to the --aspect-remote umbrella instead of being honored (breaking the documented "config can default them on" path). Now a granular flag resolved to True is honored whatever its source, and — as before — a CLI --aspect-remote-*=false opts that capability out of the umbrella. (A config default of False still cannot opt out of the umbrella: it's indistinguishable from the built-in default without config-explicit tracking. Documented on _want.)

2. A user default couldn't override a repo default. Reconciling defaults across the seed → repo config.json → user config.json layers only cleared the built-in seed's default. When a repo marked deployment A default and the user's config marked B, both stayed default = true and select_deployment picked the earlier (repo) A — so aspect auth use <B> / configure --default couldn't take effect. reconcile_seed_default is replaced by overlay_deployments, which clears prior defaults whenever an overlaid layer introduces one, so the higher-precedence (user) layer wins.

3. Upgrading users appeared logged out. With a reachable keyring, the resolver read only the keyring and never the legacy ~/.aspect/credentials.json written by pre-keyring releases. It now migrates the legacy file in when the keyring is empty (best-effort write-through; the file's credentials are returned regardless of the write).


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

  • aspect build/test now honor config.axl defaults for the granular --aspect-remote-cache / --aspect-bes-backend / --aspect-remote-exec flags.
  • A user ~/.aspect/config.json default deployment now correctly overrides a repo-declared default.
  • Credentials from releases before the OS-keyring backend are migrated automatically, so upgrading users stay logged in.

Test plan

  • New/updated tests:
    • deployment_flags_test.axl — a config-defaulted granular flag (value True, not is_explicit) is honored (test-deployment-flags).
    • overlay_deployments_lets_a_layer_default_win (auth.rs) — a later layer's default wins, a no-default layer leaves the existing one, and the seed stays the fallback when nothing is default.
    • legacy_file_is_read_for_migration (credential_store.rs) — the keyring-empty fallback reads the legacy file.
  • Existing suites pass: test-deployment-flags, test-auth, test-aspect-endpoint-auth, and the credential_store unit tests.

🤖 Generated with Claude Code

… repo, and migrate legacy credentials

Three fixes to the auth feature surfaced in review:

- `_want` (deployment_flags.axl) gated capability injection on `is_explicit`,
  which is CLI-only, so a `config.axl` default like `aspect_remote_cache = True`
  was ignored in favor of the `--aspect-remote` umbrella. Honor a resolved-True
  granular flag regardless of source; a CLI `--aspect-remote-*=false` still opts
  out via `is_explicit`. (A config default of False still can't opt out of the
  umbrella — it's indistinguishable from the built-in default without config-
  explicit tracking; documented on `_want`.)

- Default reconciliation across config layers only cleared the built-in seed's
  default, so a user `config.json` marking a different deployment default left
  both the repo and user entries default and `select_deployment` picked the
  earlier repo one. Replace `reconcile_seed_default` with `overlay_deployments`,
  which clears prior defaults whenever an overlaid layer introduces one, so a
  higher-precedence (user) layer's default wins.

- The keyring backend never read the legacy `~/.aspect/credentials.json`, so
  users who logged in on a pre-keyring release appeared logged out after upgrade.
  When the keyring is empty, migrate the legacy file in (best-effort write-
  through to the keyring; the file's credentials are returned regardless).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 60453ca2cb

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +88 to +89
if map.is_empty() {
return migrate_legacy_file();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Prevent stale file credentials from being re-imported

When an upgrading user still has the legacy ~/.aspect/credentials.json, this empty-keyring branch migrates it but leaves the file in place. Later logout/logout --all writes only the active keyring backend via save_all_credentials, so once the keyring entry is deleted or empty, the next credential load takes this branch again and re-imports the stale file, making logged-out credentials reappear. Remove/rename the legacy file after a successful keyring write, or otherwise record that migration has completed.

Useful? React with 👍 / 👎.

@aspect-workflows

aspect-workflows Bot commented Jul 7, 2026

Copy link
Copy Markdown

✨ Aspect Workflows Tasks

📅 Tue Jul 7 00:52:13 UTC 2026

❌ 3 failed tasks

  • ❌ format-gha-debug [format] · ⏱ 1m 27s · 🐙 GitHub Actions · ☑️ Check
    💬 failed in diff · Format failed (1 file needs format)
  • ❌ format-format-repeat-task [format] · ⏱ 1m 25s · 🐙 GitHub Actions · ☑️ Check
    💬 failed in diff · Format failed (1 file needs format)
  • ❌ format-gha [format] · ⏱ 1m 21s · 🐙 GitHub Actions · ☑️ Check
    💬 failed in diff · Format failed (1 file needs format)

⚠️ 2 flagged tasks

  • ⚠️ delivery-gha-debug [delivery] · ⏱ 49.5s · 🐙 GitHub Actions · ☑️ Check
    💬 Delivery complete (1 delivered · 2 warn · 3 skipped)
  • ⚠️ delivery-gha [delivery] · ⏱ 43.6s · 🐙 GitHub Actions · ☑️ Check
    💬 Delivery complete (1 delivered · 2 warn · 3 skipped)

✅ 21 successful tasks

  • ✅ axl-smoke-gha-bootstrap [build] · ⏱ 1m · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel build complete (1 built)
  • ✅ run-axl-smoke [run] · ⏱ 21.1s · 🐙 GitHub Actions · ☑️ Check
    💬 Ran //examples/deliverable:py_deliverable
  • ✅ run-axl-smoke-2 [run] · ⏱ 14.1s · 🐙 GitHub Actions · ☑️ Check
    💬 Ran //examples/deliverable:sh_deliverable
  • ✅ axl-tests-gha-bootstrap [build] · ⏱ 25s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel build complete (1 built)
  • ✅ build-gha-debug [build] · ⏱ 6m 5s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel build complete (166 built)
  • ✅ build-gha [build] · ⏱ 5m 14s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel build complete (166 built)
  • ✅ build-gha-ephemeral [build] · ⏱ 1m 18s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel build complete (9 built)
  • ✅ buildifier-gha-debug [buildifier] · ⏱ 35.6s · 🐙 GitHub Actions · ☑️ Check
    💬 Format complete (clean)
  • ✅ buildifier-gha [buildifier] · ⏱ 25.3s · 🐙 GitHub Actions · ☑️ Check
    💬 Format complete (clean)
  • ✅ gazelle-gha-debug [gazelle] · ⏱ 45.8s · 🐙 GitHub Actions · ☑️ Check
    💬 Gazelle complete (clean)
  • ✅ gazelle-from-source-gha-debug [gazelle] · ⏱ 1m 49s · 🐙 GitHub Actions · ☑️ Check
    💬 Gazelle complete (clean)
  • ✅ gazelle-from-source-gha [gazelle] · ⏱ 2m 1s · 🐙 GitHub Actions · ☑️ Check
    💬 Gazelle complete (clean)
  • ✅ gazelle-gha [gazelle] · ⏱ 29.1s · 🐙 GitHub Actions · ☑️ Check
    💬 Gazelle complete (clean)
  • ✅ init-shell [build] · ⏱ 1m 11s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel build complete (10 built)
  • ✅ lint-gha-debug [lint] · ⏱ 50.8s · 🐙 GitHub Actions · ☑️ Check
    💬 Lint complete (clean)
  • ✅ lint-gha [lint] · ⏱ 44.7s · 🐙 GitHub Actions · ☑️ Check
    💬 Lint complete (clean)
  • ✅ test-gha-debug [test] · ⏱ 5m 38s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (26/26 passed · 23 cached)
  • ✅ test-gha-coverage [test] · ⏱ 34.3s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed · 1 cached)
  • ✅ test-gha-target-pattern-file [test] · ⏱ 18.7s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed · 1 cached)
  • ✅ test-gha [test] · ⏱ 5m 32s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (26/26 passed · 26 cached)
  • ✅ test-gha-ephemeral [test] · ⏱ 44.8s · 🐙 GitHub Actions · ☑️ Check
    💬 Bazel test complete (1/1 passed)

🛠️ Fix

❌ format (format-gha-debug · format-format-repeat-task · format-gha)

aspect format --severity=info -- crates/axl-runtime/src/engine/aspect/credential_store.rs

Install aspect: aspect.build/docs/cli/install

🔁 Reproduce

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

# --mode=always --track-state=false for off-runner with no state backend.
aspect delivery \
  --commit-sha=60453ca2cbcdac4243581a862d36f565f0a6767e \
  --mode=always \
  --track-state=false \
  --dry-run=true

❌ format (format-gha-debug · format-format-repeat-task · format-gha)

aspect format --severity=fail --base-ref=origin/main

Install aspect: aspect.build/docs/cli/install


⏱ Last updated Tue Jul 7 00:58:09 UTC 2026 · 📊 GitHub API quota 9,548/15,000 (64% used, resets in 18m)
🚀 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