cli/geolocation: migrate into doublezero-geolocation-cli module crate#3792
Merged
Conversation
6f4e3f8 to
5e68bb7
Compare
3 tasks
This was referenced May 28, 2026
ben-dz
added a commit
that referenced
this pull request
May 29, 2026
## Summary Convert all 7 `doublezero geolocation probe ...` verbs to the RFC-20 `async fn execute(ctx, client, out)` form. Per [RFC-20 §3](../blob/main/rfcs/rfc20-cli-standardization.md), every verb in a module crate must be `async fn` and receive environment-derived configuration through `CliContext`. This is PR 2 of a stack. Stacked on #3792 (move-as-is). After #3792 lands, this rebases onto main. ## What changes - Each of the 7 probe verb files (`create`, `update`, `delete`, `get`, `list`, `add_parent`, `remove_parent`) now exposes `pub async fn execute<C: GeoCliCommand, W: Write>(self, ctx: &CliContext, client: &C, out: &mut W) -> eyre::Result<()>`. - A `tracing::debug!(env = %ctx.env, ..., "geolocation probe <verb>")` breadcrumb is the first statement of each verb body. - Verb tests use the existing `block_on` helper (mirroring `smartcontract/cli/src/location/get.rs`) and build a `CliContext` via `doublezero_cli_core::testing::cli_context_default_for_tests()`. - `GeolocationCommand::execute` in `cli.rs` is `async fn`; all 7 Probe arms now `.await`. - The binary's call site `args.command.execute(&ctx, &geo_cli, &mut handle).await`. ## What stays the same - All verb arguments, output, JSON schemas, exit codes unchanged. - `Init` and all 9 `User::*` dispatcher arms stay sync — PRs 3 and 4 convert those. - No new flags, no validator changes, no new public API. ## 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 (rustfmt nightly + clippy) - [x] `cargo test -p doublezero-geolocation-cli`: 41/41 - [x] `cargo test -p doublezero`: 133/133
ben-dz
added a commit
that referenced
this pull request
May 29, 2026
## Summary Convert all 9 `doublezero geolocation user ...` verbs to the RFC-20 `async fn execute(ctx, client, out)` form. Per [RFC-20 §3 and §5](../blob/main/rfcs/rfc20-cli-standardization.md), every verb in a module crate must be `async fn` and receive environment-derived configuration through `CliContext`. This is PR 3 of a stack. Stacked on #3797 (probe verb conversion). After #3792 and #3797 land, this rebases onto main. ## What changes - Each of the 9 user verb files (`create`, `update`, `delete`, `get`, `list`, `add_target`, `remove_target`, `set_result_destination`, `update_payment_status`) now exposes `pub async fn execute<C: GeoCliCommand, W: Write>(self, ctx: &CliContext, client: &C, out: &mut W) -> eyre::Result<()>`. - A `tracing::debug!(env = %ctx.env, ..., "geolocation user <verb>")` breadcrumb is the first statement of each verb body. - Verb tests use the existing `block_on` helper and build a `CliContext` via `doublezero_cli_core::testing::cli_context_default_for_tests()`. - All 9 `UserCommands::*` arms in `GeolocationCommand::execute` now `.await`. ## What stays the same - All verb arguments, output, JSON schemas, exit codes unchanged. - The `Init` arm stays sync — PR 4 converts it. - No new flags, no validator changes, no new public API. ## 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 (rustfmt nightly + clippy) - [x] `cargo test -p doublezero-geolocation-cli`: 41/41 - [x] `cargo test -p doublezero`: 133/133
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
doublezero geolocationsubcommands into a new RFC-20-conforming module crate atcrates/doublezero-geolocation-cli/.doublezero init-geolocation-configintodoublezero geolocation init(also hidden); both routes now share one code path.geolocation/config/{get,set}subtree — the unifieddoublezero configcovers the same fields.This is PR 1 of a stack. It is a pure structural move — verbs keep their current sync signatures and behavior. Subsequent PRs convert each verb to the RFC-20
async fn execute(ctx, client, out)form per RFC-20 §3 and §5.What changes
doublezero-geolocation-cli(library only) owns:GeolocationArgs,GeolocationCommand, theInit/Probe/Usersubtrees, andGeoCliCommand+GeoCliCommandImpl.client/doublezeromountsCommand::Geolocation(GeolocationArgs)and dispatches via the new crate'sGeolocationCommand::execute. The binary's old wrapper atclient/doublezero/src/cli/geolocation/is deleted.smartcontract/cli/src/{geoclicommand.rs, geolocation/}are gone; the geolocation dep is dropped fromsmartcontract/cli/Cargo.toml.doublezero_cli_core::validators::*(per RFC-20 §69) instead of the serviceability crate's local module.What stays the same
doublezero geolocation probe ...anddoublezero geolocation user ...are byte-identical in argument parsing and output.doublezero-geolocationprogram and the geolocation SDKs (Go / Python / TypeScript) are untouched.RFC reference
RFC-20: CLI Standardization
Testing Verification
cargo check --workspacecleancargo test -p doublezero-geolocation-cli: 41/41 passcargo test -p doublezero: 133/133 passcargo test -p doublezero-serviceability-clianddoublezero-cli-coreunaffecteddoublezero geolocation --helpshows the sameprobe/usertree as beforedoublezero geolocation init --helpworks (new route)doublezero init-geolocation-configno longer exists (removed; CHANGELOG updated)