Skip to content

refactor(core): async ConfigLoader (config.rs cluster from #62)#63

Merged
pofallon merged 2 commits into
mainfrom
follow-up-config-async-conversion
May 27, 2026
Merged

refactor(core): async ConfigLoader (config.rs cluster from #62)#63
pofallon merged 2 commits into
mainfrom
follow-up-config-async-conversion

Conversation

@pofallon
Copy link
Copy Markdown
Contributor

Summary

What changed (24 files, +502/-458)

Core (1 file): crates/core/src/config.rs — 7 public methods + 3 private helpers converted to async. All inline #[test] cases converted to #[tokio::test] (19 cases).

Deacon commands (10 files): up/mod.rs, down.rs, exec.rs, build/mod.rs, run_user_commands.rs, read_configuration.rs, upgrade.rs, outdated.rs, config.rs, set_up.rs, plus shared/config_loader.rs (with its 5 unit tests converted to #[tokio::test]).

Integration tests (12 files): ~13 cases across integration_compose.rs, integration_config.rs, integration_extends.rs, integration_layered_merge.rs, integration_logging.rs, integration_mount.rs, integration_override_secrets.rs, integration_security.rs, integration_user_mapping.rs, integration_variable_substitution.rs, integration_worktree.rs, and integration_compose_enhancements.rs converted to #[tokio::test].

Approach notes

  • Converted in place (no parallel async_* variants) — only consumer is this workspace, so no external API constraint.
  • No new dependencies; tokio was already in crates/core/Cargo.toml with the fs feature.
  • One #[allow(clippy::type_complexity)] added to resolve_extends_chain_with_paths because the boxed-future return type with lifetime is irreducible for async recursion. No external API constraints.

Test plan

  • cargo fmt --all -- --check — clean.
  • cargo clippy --all-targets -- -D warnings — clean (full rebuild after cargo clean).
  • cargo test --doc -p deacon-core — 130 passed, 0 failed.
  • make test-nextest-fast — 2089 passed, 30 skipped (per agent report).
  • Spot-check: one converted test (test_extends_chain_deep_under_limit_succeeds) verified under #[tokio::test(flavor = "current_thread")] — deadlocks on residual blocking IO, so a pass confirms the converted path is genuinely non-blocking. Flavor reverted afterward.

🤖 Generated with Claude Code

pofallon and others added 2 commits May 27, 2026 15:48
…fig, ...)

Convert the ConfigLoader public API and its `enumerate_named_configs` helper
to async tokio I/O so config resolution stops blocking the runtime. Bills:

- `enumerate_named_configs` uses `tokio::fs::read_dir` + `next_entry()` loop
- `load_from_path` reads via `tokio::fs::read_to_string`
- `discover_config`, `load_with_extends`, `load_with_extends_and_metadata`,
  `load_with_full_resolution`, `load_with_overrides_and_substitution`,
  `load_with_substitution` become `async`
- Private `resolve_extends_chain[_with_paths]` boxed for async recursion
- All in-module `#[test]` callers switched to `#[tokio::test]` with `.await`
- Doctests updated to `async fn example()` with `.await`

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Propagate the async ConfigLoader API through every consumer:

CLI commands (all async): up, down, exec, build, run-user-commands,
read-configuration, upgrade, outdated, config, set-up (load_optional_config).
Shared `commands::shared::config_loader::load_config` is now async; its
unit tests use `#[tokio::test]`. `outdated::resolve_config_path` and its
sibling `load_config` become async.

Integration test suites updated to `#[tokio::test]` where they invoke
the converted ConfigLoader methods:
- crates/core/tests: integration_config, integration_compose,
  integration_extends, integration_layered_merge, integration_logging,
  integration_mount, integration_override_secrets, integration_security,
  integration_user_mapping, integration_variable_substitution,
  integration_worktree
- crates/deacon/tests: integration_compose_enhancements

clippy::type_complexity is silenced on `resolve_extends_chain_with_paths`
where the boxed-future return signature is unavoidable for async recursion.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@pofallon pofallon marked this pull request as ready for review May 27, 2026 16:26
@pofallon pofallon merged commit fe9d123 into main May 27, 2026
10 checks passed
@pofallon pofallon deleted the follow-up-config-async-conversion branch May 27, 2026 16:26
pofallon added a commit that referenced this pull request May 27, 2026
…ing (#64)

The recently landed audit follow-ups in closed #52 (PRs #58/#59/#60/#61/#62/#63)
shipped one user-facing surface that needs README coverage — the workspace-trust
gate for host-side lifecycle hooks (`--trust-workspace`, `--trust-workspace-persist`,
`DEACON_NO_PROMPT=1`). Add a concise "Workspace Trust" section linking to
SECURITY.md for the full threat model, and update the post-1.0 hardening
sentence from "is tracked in #52" to past tense since the issue is now closed.

Co-authored-by: Claude Opus 4.7 <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