Skip to content

cli: RFC-20 serviceability cleanups#3824

Merged
ben-dz merged 1 commit into
mainfrom
bdz/infra-1460
Jun 3, 2026
Merged

cli: RFC-20 serviceability cleanups#3824
ben-dz merged 1 commit into
mainfrom
bdz/infra-1460

Conversation

@ben-dz
Copy link
Copy Markdown
Contributor

@ben-dz ben-dz commented Jun 2, 2026

Summary of Changes

  • Remove direct std::env::args() and std::env::var() reads from requirements.rs per 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 new CliCommand::has_keypair_source() trait method
  • Convert four eprintln! calls to tracing::error! in requirements.rs (check_id, check_balance, check_allowlist) and helpers.rs (print_error) for structured logging
  • Add --json flag to globalconfig featureflags get using render_record and a new FeatureFlagsDisplay struct
  • Add --json flag to accesspass user-balances with pretty-printed JSON serialization of the existing UserBalanceDisplay collection
  • Related RFC: rfcs/rfc20-cli-standardization.md
  • Fixes malbeclabs/infra#1460

Testing Verification

  • All 301 doublezero-serviceability-cli unit tests pass, including the new test_cli_globalconfig_featureflags_get_json test that validates JSON output structure and content
  • cargo clippy -p doublezero-serviceability-cli -p doublezero -- -Dclippy::all -Dwarnings passes with zero warnings
  • cargo fmt --check passes
  • cargo check --tests -p doublezero-serviceability-cli -p doublezero verifies test compilation across both crates
  • The doublezero-admin binary (which also uses CliCommandImpl::new) continues to compile without changes due to the backward-compatible builder pattern (with_keypair_source is opt-in, defaulting to false)

@ben-dz ben-dz force-pushed the bdz/infra-1460 branch 2 times, most recently from e412aa2 to 3dce15c Compare June 2, 2026 21:20
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
@ben-dz ben-dz requested a review from juan-malbeclabs June 2, 2026 21:27
@ben-dz ben-dz marked this pull request as ready for review June 2, 2026 21:27
Copy link
Copy Markdown
Contributor

@juan-malbeclabs juan-malbeclabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ben-dz ben-dz merged commit 2e6940c into main Jun 3, 2026
38 of 39 checks passed
@ben-dz ben-dz deleted the bdz/infra-1460 branch June 3, 2026 14:25
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