cli: support --geo-program-id in config set/get#3711
Merged
Conversation
juan-malbeclabs
approved these changes
May 18, 2026
ben-dz
added a commit
that referenced
this pull request
May 18, 2026
## Summary of Changes - Adds `doublezero geolocation probe <create|update|delete|get|list|add-parent|remove-parent>` to the main `doublezero` CLI, mirroring `doublezero-geolocation probe ...` - Adds a new `--geo-program-id` global flag (resolution: flag → config `geo_program_id` → built-in default) - Carries the `GeoClient` + `GeoCliCommandImpl` construction needed for any future `geolocation` subtree work; the `user` subtree lands in a follow-up > **Stack:** This PR is stacked on top of #3711 (`bdz/config-geo-program-id`). ## Diff Breakdown | Category | Files | Lines (+/-) | Net | |-------------|-------|-------------|------| | Scaffolding | 5 | +82 / -6 | +76 | | Docs | 1 | +1 / -0 | +1 | Pure clap wiring and dispatch — no new business logic. All probe command implementations are inherited unchanged from \`doublezero_cli::geolocation::probe::*\`. <details> <summary>Key files (click to expand)</summary> - \`client/doublezero/src/main.rs\` — adds \`--geo-program-id\` field on \`App\`, imports \`GeoClient\` / \`GeoCliCommandImpl\` / \`get_globalstate_pda\`, adds \`Command::Geolocation\` match arm that builds the geo client inline and dispatches the 7 probe subcommands - \`client/doublezero/src/cli/geolocation/probe.rs\` — new module: \`ProbeCliCommand\` + \`ProbeCommands\` enum with 7 variants imported from \`doublezero_cli::geolocation::probe::*\` - \`client/doublezero/src/cli/geolocation/mod.rs\` — new module: \`GeolocationCliCommand\` + \`GeolocationCommands\` enum (currently \`Probe\` only) - \`client/doublezero/src/cli/command.rs\` — adds \`Geolocation(GeolocationCliCommand)\` variant on the top-level \`Command\` enum, alongside \`Multicast\` - \`client/doublezero/src/cli/mod.rs\` — registers \`pub mod geolocation;\` </details> ## Testing Verification - \`doublezero geolocation probe --help\` lists all 7 subcommands (\`create\`, \`update\`, \`delete\`, \`get\`, \`list\`, \`add-parent\`, \`remove-parent\`) - \`doublezero --help\` shows the new \`geolocation\` command and the \`--geo-program-id\` flag with metavar \`<GEO_PROGRAM_ID>\`
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.
First PR in stack of merging Geolocation CLI
Summary of Changes
--geo-program-idflag todoublezero config set, allowing users to persist a custom geolocation program ID to the config fileconfig getandconfig setnow print aGeolocation Program ID:line in their output (showing the stored value, or the environment default with a(computed)suffix if unset)--geo-program-idis correctly excluded when--envis used (environment shortcuts set all program IDs atomically); mixing them produces anInvalid flag combinationerrorDiff Breakdown
Small core change; most of the diff is new test coverage for the two new behaviors.
Key files (click to expand)
smartcontract/cli/src/config/set.rs— addsgeo_program_idfield toSetConfigCliCommand, wires it through the env-exclusion guard and "no args" guard, persists it viaconvert_geo_program_moniker, and prints it in output; adds two new testssmartcontract/cli/src/config/get.rs— addsGeolocation Program ID:line to output, with computed-default fallbackTesting Verification
test_cli_config_set_geo_program_id: sets--geo-program-id, asserts output containsGeolocation Program ID: MyGeoProgram123, and verifies the value is persisted to disktest_cli_config_set_env_with_geo_program_id_errors: asserts that combining--envwith--geo-program-idproduces anInvalid flag combinationerrorvalidate_config_output(shared helper) extended to assert theGeolocation Program ID:label is present in all env/url/program-id set teststest_cli_config_getextended to assertGeolocation Program ID:appears inconfig getoutputconfig::test suite (32 tests) passes;make rust-fmt && make rust-lintclean