Skip to content

test(cli): add --help regression test for lafiya-cli - #296

Open
Sundriveauto wants to merge 1 commit into
Lafiya-xyz:mainfrom
Sundriveauto:test/cli-help-regression
Open

test(cli): add --help regression test for lafiya-cli#296
Sundriveauto wants to merge 1 commit into
Lafiya-xyz:mainfrom
Sundriveauto:test/cli-help-regression

Conversation

@Sundriveauto

@Sundriveauto Sundriveauto commented Aug 27, 2026

Copy link
Copy Markdown

Closes #189
Closes #190
Closes #191
Closes #192

Description

Adds an automated regression test that runs the compiled lafiya-cli binary with --help for the top-level command and every subcommand, asserting that each prints usage text to stdout and exits successfully (exit code 0).

Previously, a clap derive regression (e.g. a malformed attribute, an argument conflict, or a name that fails to render) would only be caught by a human running the CLI manually. This test suite now catches it in CI as part of the existing cargo test --workspace job (make test) — no workflow changes needed.

Coverage (12 tests, one per command node):

  • Top-level lafiya-cli --help
  • config and its leaves: config show, config list, config env
  • attester and its leaves: attester is, attester add, attester remove
  • attestation and its leaves: attestation get
  • deploy

The tests spawn the real compiled binary via Cargo's CARGO_BIN_EXE_lafiya-cli variable (note: Cargo keeps the hyphen in the variable name), so no config file or network access is required — clap handles --help before any config loading. If a new subcommand is added, the file's doc comment points to where to add a matching test.

Verification: cargo test -p lafiya-cli (12 passed), cargo fmt --all -- --check, and cargo clippy -p lafiya-cli --all-targets -- -D warnings were run in a rust:1 container (no local Rust toolchain in this environment). The full make check was not run because it includes the wasm target build, which per the Makefile comment does not apply to the std-only lafiya-cli crate; this change touches only that crate.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Quality Checklist

  • Code follows the style guidelines of this project
  • I have run make check locally and it passes with no warnings or errors
  • I have added unit tests covering success, failure, and authorization cases
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation / README if applicable

Cross-Repo & Shared-Contract Impact

  • Does this PR change a shared contract interface? (e.g., attestation schema, public contract function signatures, events emitted)

    • If yes, please describe the impact and link the corresponding issue/PR in lafiya-web:
    • Impact detail: No — this PR only adds CLI test coverage; no contract code, storage schema, or function signatures change.
  • Does this PR require a database/Supabase migration?

    • If yes, verify that:
      • The migration SQL is written in lafiya-web.
      • Hand-authored types in lafiya-web/lib/supabase/types.ts have been updated manually.
    • No.

Runs the compiled binary with --help for the top-level command and every
subcommand, asserting each prints usage text and exits successfully. A
clap derive regression (bad attribute, arg conflict, rendering failure)
would previously only be caught by a human running the CLI.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@Sundriveauto Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant