cli/geolocation: convert user verbs to RFC-20 (async + ctx)#3798
Merged
Conversation
3 tasks
45925b0 to
4abda9a
Compare
juan-malbeclabs
approved these changes
May 29, 2026
e0d3ecd to
4cc99d9
Compare
4cc99d9 to
123adfe
Compare
ben-dz
added a commit
that referenced
this pull request
May 29, 2026
## Summary Convert the `doublezero geolocation init` verb (`InitProgramConfigCliCommand`) to the RFC-20 `async fn execute(ctx, client, out)` form. With this, **every verb in `doublezero-geolocation-cli` is fully RFC-20 conforming**. This is PR 4 (the final PR) of a stack. Stacked on #3798. After #3792, #3797, and #3798 land, this rebases onto main. ## What changes - `init.rs::execute` becomes `pub async fn execute<C: GeoCliCommand, W: Write>(self, ctx: &CliContext, client: &C, out: &mut W) -> eyre::Result<()>` with a `tracing::debug!(env = %ctx.env, "geolocation init")` breadcrumb. - Test wrapped in `block_on`, `ctx` built via `cli_context_default_for_tests()`. - Dispatcher's `Self::Init` arm flipped to `.await`. ## Final state of the new module crate After this PR merges, the `doublezero-geolocation-cli` crate satisfies all of RFC-20's module-crate requirements: - All 17 verbs (7 probe, 9 user, 1 init) are `async fn execute(ctx, client, out)`. - Shared validators come from `doublezero_cli_core::validators`. - All output flows through the writer; no `println!`/`eprintln!` in execute paths. - Module exposes its backend client (`GeoCliCommand` trait) for mockable testing. ## RFC reference [RFC-20: CLI Standardization §3, §5](../blob/main/rfcs/rfc20-cli-standardization.md) ## Testing Verification - [x] `make rust-lint` clean in dev container - [x] `cargo test -p doublezero-geolocation-cli`: 41/41 - [x] Final audit grep: zero `pub fn execute` matches in the crate (all `pub async fn execute`); zero `crate::validators` imports; every dispatcher arm uses `.await`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Convert all 9
doublezero geolocation user ...verbs to the RFC-20async fn execute(ctx, client, out)form. Per RFC-20 §3 and §5, every verb in a module crate must beasync fnand receive environment-derived configuration throughCliContext.This is PR 3 of a stack. Stacked on #3797 (probe verb conversion). After #3792 and #3797 land, this rebases onto main.
What changes
create,update,delete,get,list,add_target,remove_target,set_result_destination,update_payment_status) now exposespub async fn execute<C: GeoCliCommand, W: Write>(self, ctx: &CliContext, client: &C, out: &mut W) -> eyre::Result<()>.tracing::debug!(env = %ctx.env, ..., "geolocation user <verb>")breadcrumb is the first statement of each verb body.block_onhelper and build aCliContextviadoublezero_cli_core::testing::cli_context_default_for_tests().UserCommands::*arms inGeolocationCommand::executenow.await.What stays the same
Initarm stays sync — PR 4 converts it.RFC reference
RFC-20: CLI Standardization §3, §5
Testing Verification
make rust-lintclean in dev container (rustfmt nightly + clippy)cargo test -p doublezero-geolocation-cli: 41/41cargo test -p doublezero: 133/133