cli/serviceability: add ServiceabilityCommand enum with async dispatcher#3760
Open
juan-malbeclabs wants to merge 2 commits into
Open
Conversation
aeaa287 to
f274db8
Compare
8e445fe to
5207968
Compare
This was referenced May 22, 2026
vihu
reviewed
May 22, 2026
f274db8 to
17d3095
Compare
5207968 to
e562729
Compare
…mmand Pin the representative dispatch chains (location get, device interface get, link create wan, access-pass fund, resource verify) plus the hidden init/migrate variants to specific nested enum variants. Catches wrong Subcommand attributes or misrouted nested enums before #3761 flattens this enum into the doublezero binary.
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.
RFC-20 implementation stack
This PR is part of a 9-PR chain delivering RFC-20: CLI standardization. Each PR's diff is only its own contribution; reviewers should consume them in order.
doublezero-cli-corefoundation crate +solana_l1_rpc_url--solana-url+--log-verboseglobal flags + tracing initCliContextbuilt inmain+ centralized error renderingdoublezero_cli→doublezero-serviceability-clilocation getas the async +CliContextreference verbdocs/cli-standard.md+CLAUDE.mdpointerServiceabilityCommandenum + async dispatcher#[command(flatten)]+ collapse binary dispatchThis PR: #3760 — position 8 of 9. Previous: #3759 · Next: #3761
Summary of Changes
doublezero_serviceability_cli::cli::ServiceabilityCommand, the module crate's top-level subcommand enum per RFC-20 §Module contract item 2.Init,Migrate,Address,Balance,Config,GlobalConfig,Location,Exchange,Contributor,Permission,Tenant,Device,Link,AccessPass,User,Export,Keygen,Resource.async fn execute(ctx: &CliContext, client: &impl CliCommand, out: &mut impl Write)that owns the full per-resource dispatch tree currently inlined inclient/doublezero/src/main.rs. TheLocation::Getarm forwards&ctxand is.awaited (matches the RFC-20 reference verb from cli/serviceability: rewrite location get to rfc-20 conforming pattern #3757); all other resource arms are sync.#[command(flatten)] Serviceability(ServiceabilityCommand)to the binary'sCommandenum and collapsesmain.rs's ~270-line match block to a single dispatch arm.Diff Breakdown
Single new file in the library plus a one-line
pub modincli/mod.rs. The enum ispuband reachable but currently has no in-tree consumer; it surfaces as the module crate's public mounting point ready for the binary to flatten.Key files (click to expand)
smartcontract/cli/src/cli/command.rs(new) - theServiceabilityCommandenum +async fn executedispatcher. Forwards&CliContextonly to verbs that consume it (today onlyLocationCommands::Getper cli/serviceability: rewrite location get to rfc-20 conforming pattern #3757); other arms ignorectx. TheAccessPassCommands::Fundarm preserves the existing stdin-reading behavior (std::io::stdin().lock()) since that interaction is part of the verb's contract today.smartcontract/cli/src/cli/mod.rs- addspub mod command;.Testing Verification
cargo check --workspaceclean.make rust-testgreen workspace-wide (no behavior change — the new enum is unused by the binary in this PR).make rust-lintclean.cargo doc --no-deps -p doublezero-serviceability-clisucceeds and the new module appears.jo/7-cli-serviceability-move-cli-files; the diff shown is only this PR's contribution. Final PR actions: add missing go.{mod,sum} path #9 will flatten this enum into the binary and collapsemain.rsdispatch.