cli: RFC-20 serviceability cleanups#3824
Merged
Merged
Conversation
e412aa2 to
3dce15c
Compare
Remove env/argv reads and eprintln! from module code per RFC-20 §67: - Replace standalone has_keypair_source() in requirements.rs with a CliCommand trait method; the binary computes the flag at startup - Convert eprintln! to tracing::error! in check_id, check_balance, check_allowlist, and print_error - Add --json flag to globalconfig featureflags get and accesspass user-balances commands per RFC-20 §Output
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 of Changes
std::env::args()andstd::env::var()reads fromrequirements.rsper RFC-20 §67 (modules MUST NOT read env/argv); the keypair-source flag is now computed once at startup in the binary and plumbed through a newCliCommand::has_keypair_source()trait methodeprintln!calls totracing::error!inrequirements.rs(check_id,check_balance,check_allowlist) andhelpers.rs(print_error) for structured logging--jsonflag toglobalconfig featureflags getusingrender_recordand a newFeatureFlagsDisplaystruct--jsonflag toaccesspass user-balanceswith pretty-printed JSON serialization of the existingUserBalanceDisplaycollectionrfcs/rfc20-cli-standardization.mdTesting Verification
doublezero-serviceability-cliunit tests pass, including the newtest_cli_globalconfig_featureflags_get_jsontest that validates JSON output structure and contentcargo clippy -p doublezero-serviceability-cli -p doublezero -- -Dclippy::all -Dwarningspasses with zero warningscargo fmt --checkpassescargo check --tests -p doublezero-serviceability-cli -p doublezeroverifies test compilation across both cratesdoublezero-adminbinary (which also usesCliCommandImpl::new) continues to compile without changes due to the backward-compatible builder pattern (with_keypair_sourceis opt-in, defaulting tofalse)