Skip to content

cli: support --geo-program-id in config set/get#3711

Merged
ben-dz merged 1 commit into
mainfrom
bdz/config-geo-program-id
May 18, 2026
Merged

cli: support --geo-program-id in config set/get#3711
ben-dz merged 1 commit into
mainfrom
bdz/config-geo-program-id

Conversation

@ben-dz
Copy link
Copy Markdown
Contributor

@ben-dz ben-dz commented May 18, 2026

First PR in stack of merging Geolocation CLI

Summary of Changes

  • Add --geo-program-id flag to doublezero config set, allowing users to persist a custom geolocation program ID to the config file
  • config get and config set now print a Geolocation Program ID: line in their output (showing the stored value, or the environment default with a (computed) suffix if unset)
  • --geo-program-id is correctly excluded when --env is used (environment shortcuts set all program IDs atomically); mixing them produces an Invalid flag combination error

Diff Breakdown

Category Files Lines (+/-) Net
Core logic 2 +31 / -6 +25
Tests 2 +62 / -0 +62
Docs 1 +2 / -0 +2
Total 3 +101 / -6 +95

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 — adds geo_program_id field to SetConfigCliCommand, wires it through the env-exclusion guard and "no args" guard, persists it via convert_geo_program_moniker, and prints it in output; adds two new tests
  • smartcontract/cli/src/config/get.rs — adds Geolocation Program ID: line to output, with computed-default fallback

Testing Verification

  • test_cli_config_set_geo_program_id: sets --geo-program-id, asserts output contains Geolocation Program ID: MyGeoProgram123, and verifies the value is persisted to disk
  • test_cli_config_set_env_with_geo_program_id_errors: asserts that combining --env with --geo-program-id produces an Invalid flag combination error
  • validate_config_output (shared helper) extended to assert the Geolocation Program ID: label is present in all env/url/program-id set tests
  • test_cli_config_get extended to assert Geolocation Program ID: appears in config get output
  • Full config:: test suite (32 tests) passes; make rust-fmt && make rust-lint clean

@ben-dz ben-dz merged commit a4823ee into main May 18, 2026
42 of 44 checks passed
@ben-dz ben-dz deleted the bdz/config-geo-program-id branch May 18, 2026 17:15
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>\`
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.

2 participants