Skip to content

fix(cli): consistent flags, positional job ids, and fail fast on unreachable databases - #63

Merged
CodingAnarchy merged 2 commits into
masterfrom
fix/cli-consistency
Oct 9, 2026
Merged

CodingAnarchy merged 2 commits into
masterfrom
fix/cli-consistency

Conversation

@CodingAnarchy

Copy link
Copy Markdown
Owner

Closes #61

What changed

Old spellings keep working as aliases.

  • Database URL: queue commands use -u/--database-url; -d stays as a hidden short alias.
  • Queue flag: -n/--queue everywhere. -Q stays as a short alias (job purge, spawn *, archive *), archive --queue-name stays as a long alias, and spawn list gains -n.
  • Job ID: job retry <JOB_ID> and job cancel <JOB_ID> work positionally. --job-id still works; passing both is a usage error.
  • Help text:
    • job retry says it retries failed, dead and timed-out jobs (checked against RETRYABLE_STATUSES).
    • batch enqueue --queue is described as required, and as the queue for lines without their own.
    • --batch-size only controls progress output, so its help says so, and --progress-every is an alias.
    • batch retry --max-attempts-reached is described as a flag.
  • archive run: --no-compress works and --compress false is still accepted. Combining --compress with --no-compress is an error.
  • Connect timeout: DatabasePool::connect now gives up after 10s with a clear error.
    • Configurable via connect_timeout_secs in config.toml, config set connect_timeout_secs N (1-600), or HAMMERWORK_CONNECT_TIMEOUT. Commands use the new DatabasePool::connect_with_config.
    • sqlx's pool retries refused connections until its acquire timeout, so the pool alone would turn a refused port into a 10s wait. A single probe connection runs first: a refused port or bad credentials fail immediately, and an unroutable host hits the timeout.
  • README, docs/archiving.md and docs/batch-operations.md use the canonical spellings, and the changelog is updated.

Tests

  • clap parsing tests in main.rs cover every new alias, the positional and --job-id forms, the conflict cases, the old spellings, the help text, and --no-compress.
  • utils::database tests check that postgres://u:p@127.0.0.1:1/x (and the MySQL equivalent) errors within 5s, and that an unroutable address (10.255.255.1) honours a 1s timeout, both directly and through the config.
  • Config tests cover the default, the env override and the floor of 1s.
  • cargo test -p cargo-hammerwork --all-features -- --include-ignored passes against local Postgres and MySQL. Clippy with -D warnings and cargo fmt are clean.
  • check_cli_docs.py over cargo-hammerwork/README.md, README.md and docs/*.md: 175 checked, 0 rejected. It now finishes in about 1.5s because a dead port fails immediately.

🤖 Generated with Claude Code

CodingAnarchy and others added 2 commits October 9, 2026 18:00
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CodingAnarchy
CodingAnarchy merged commit faf28d1 into master Oct 9, 2026
17 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.

CLI consistency: flag spellings, positional IDs, misleading help, and hanging on unreachable databases

1 participant