Skip to content

fix cli empty-long arg panic and optional --db in memory mode#81

Merged
fabracht merged 1 commit into
mainfrom
fix-cli-arg-bugs
May 28, 2026
Merged

fix cli empty-long arg panic and optional --db in memory mode#81
fabracht merged 1 commit into
mainfrom
fix-cli-arg-bugs

Conversation

@fabracht

Copy link
Copy Markdown
Contributor

Summary

  • Debug builds panicked at startup before parsing on every command: passwd_data, acl_data and 15 other optional inline-content args used #[arg(long = "")], which clap registers as the empty long option --, tripping a debug_assert on the duplicate. Release builds skip the assert and silently mis-defined the flags. Each now has a distinct hidden long name (--passwd-data, --acl-data, …).
  • agent start --memory-backend no longer requires --db (now required_unless_present = "memory_backend"; defaults to a temp dir the in-memory backend never touches).
  • Added a Cli::command().debug_assert() regression test so a future empty/duplicate long name fails CI instead of only crashing debug binaries.

Test plan

  • cargo test -p mqdb-cli cli_tests passes (cli_definition_is_valid, memory_backend_makes_db_optional)
  • debug mqdb agent start --help runs without panic
  • cargo make dev green

@fabracht fabracht merged commit c842cd7 into main May 28, 2026
5 checks passed
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.

1 participant