Skip to content

iter-28: CLI UX polish from 2026-05-10 dogfooding#33

Merged
ractive merged 2 commits into
mainfrom
iter-28/dogfooding-ux-polish
May 10, 2026
Merged

iter-28: CLI UX polish from 2026-05-10 dogfooding#33
ractive merged 2 commits into
mainfrom
iter-28/dogfooding-ux-polish

Conversation

@ractive

@ractive ractive commented May 10, 2026

Copy link
Copy Markdown
Owner

Summary

Seven small UX papercuts from the 2026-05-10 dogfooding round, grouped into one consistency pass:

  • Flag naming: storage commands use --remote-path everywhere; both upload and download use --file for the local path (renamed download --output--file). stream library statistics standardised on --id.
  • Named ValueEnums replace raw numeric flags: script create --script-type {dns,cdn,middleware} and storage-zone create --zone-tier {standard,edge}.
  • Date flag friction: new src/date.rs accepts YYYY-MM-DD shorthand on every datetime flag and emits clear errors naming accepted formats. shield event-logs --date accepts ISO and translates client-side.
  • Output fixes: db delete / db group delete print real confirmation lines; dns zone dnssec status text view shows the full DS record when enabled; stream library statistics renders N/A for the -1 sentinel in text mode.
  • Docs: dogfooding playbook updated to reflect the actual auth flow (BUNNY_API_KEY + hoppy auth check). Decision log entry for the storage flag choice.

Test plan

  • cargo fmt
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace --quiet (mock e2e tests updated for renamed flags)
  • Manual dogfooding pass against a real bunny.net account

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Accept date-only inputs (YYYY-MM-DD) for time-window flags; Shield date format conversion supported.
    • DNSSEC status now shows DS record details and registrar copy text when enabled.
  • Chores

    • Standardized flags: --output--file, --path--remote-path, --library-id--id.
    • Script-type and storage-zone-tier flags now use named values instead of numeric codes.
    • Engagement metrics display N/A for missing values.
  • Documentation

    • Updated dogfooding/auth guidance to require BUNNY_API_KEY and added decision log entry.

Review Change Stack

- Standardise storage flags: `--remote-path` everywhere, `--file` for both
  upload (input) and download (output, stdout if omitted). Renamed
  `download --output` → `--file`.
- Standardise `stream library statistics` on `--id` (matches siblings).
- Replace numeric enum flags with named ValueEnums:
  `script create --script-type {dns,cdn,middleware}` (was 0/1/2),
  `storage-zone create --zone-tier {standard,edge}` (was 0/1).
- New `date` module: accepts `YYYY-MM-DD` shorthand for any datetime
  flag, with clear error message naming accepted formats. Applied to
  db statistics/usage, db group stats/usage, statistics, script
  statistics, storage-zone statistics, video-library drm/transcribing
  statistics, pull-zone statistics, stream library statistics.
- `shield event-logs --date` accepts ISO `YYYY-MM-DD` and translates to
  the legacy `MM-dd-yyyy` API format client-side.
- `db delete` / `db group delete` print `Deleted database <id>` (text)
  and `{"deleted": "<id>"}` (json) instead of empty headers.
- `dns zone dnssec status` text/table view now shows DS record, digest,
  key tag, algorithm, and DsConfigured when DNSSEC is enabled.
- `stream library statistics` renders `N/A` for the API's `-1` "no data"
  sentinel in text mode; JSON keeps the raw `-1`.
- Dogfooding playbook updated to reflect actual auth flow
  (`BUNNY_API_KEY` env var + `hoppy auth check`); removed references to
  the non-existent `hoppy auth login` and config-path docs.
- Decision log entry recording the storage flag rationale.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 10, 2026

Copy link
Copy Markdown
ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Free

Run ID: 8401ba1b-8838-445e-b92d-6592608dae26

📥 Commits

Reviewing files that changed from the base of the PR and between a973ac8 and 918179f.

📒 Files selected for processing (5)
  • hoppy-knowledgebase/dogfooding/dogfooding-playbook.md
  • hoppy-knowledgebase/iterations/iteration-28-dogfooding-ux-polish.md
  • src/date.rs
  • tests/e2e/cli_script.rs
  • tests/e2e/cli_storage.rs
✅ Files skipped from review due to trivial changes (3)
  • hoppy-knowledgebase/dogfooding/dogfooding-playbook.md
  • tests/e2e/cli_script.rs
  • hoppy-knowledgebase/iterations/iteration-28-dogfooding-ux-polish.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/date.rs
  • tests/e2e/cli_storage.rs

📝 Walkthrough

Walkthrough

This PR completes iteration-28 dogfooding UX polish by introducing date normalization utilities, replacing numeric CLI flags with typed enums (ScriptTypeArg, StorageZoneTierArg), standardizing flag names (--file, --remote-path, --id), updating command handlers to normalize date inputs and handle renamed fields, and verifying changes with E2E tests.

Changes

CLI UX Polish & Date Normalization

Layer / File(s) Summary
Documentation & Iteration Tracking
hoppy-knowledgebase/decision-log.md, hoppy-knowledgebase/dogfooding/dogfooding-playbook.md, hoppy-knowledgebase/iterations/iteration-28-dogfooding-ux-polish.md
Decision log records --file standardization; dogfooding playbook replaces hoppy auth login with BUNNY_API_KEY env-var and hoppy auth check validation; iteration-28 checklist marks all UX polish tasks complete with cargo fmt and cargo clippy verification.
Date Normalization Module
src/date.rs, src/lib.rs, src/main.rs
New module provides normalise_datetime (expands ISO YYYY-MM-DD to UTC midnight YYYY-MM-DDT00:00:00Z, passes through datetime strings), normalise_datetime_opt (handles Option), and normalise_shield_date (converts ISO dates to Shield's MM-dd-yyyy format) with format detection helpers and comprehensive unit tests.
CLI Argument Types & Field Renames
src/cli.rs
Two new ValueEnum types (ScriptTypeArg, StorageZoneTierArg) replace numeric arguments; field renames include StorageAction::Download outputfile, StorageAction::Ls pathremote_path, StreamLibraryAction::Statistics library_idid, StorageZoneAction::Create zone_tier changes to typed enum. Help text updated for date formats (YYYY-MM-DD or RFC3339-like timestamps).
Date Normalization in Command Handlers
src/commands/database.rs, src/commands/pull_zone.rs, src/commands/script.rs, src/commands/shield.rs, src/commands/statistics.rs, src/commands/storage_zone.rs, src/commands/stream.rs, src/commands/video_library.rs
All statistics/usage handlers import crate::date and normalize optional date_from/date_to via normalise_datetime_opt before API calls; database group stats and usage operations likewise normalize date inputs; shield event-logs uses normalise_shield_date for format conversion.
Type Conversion & Output Formatting
src/commands/script.rs, src/commands/database.rs, src/commands/dns.rs, src/commands/stream.rs
Script handler adds arg_to_script_type converter from ScriptTypeArg to ScriptType; database delete outputs { "deleted": id } JSON or stderr message (replaces table output); stream engagement score displays N/A for -1 sentinel in text/table (preserves -1 in JSON); dns dnssec status enriches JSON with DS record fields when enabled.
Storage Command Implementation
src/commands/storage.rs, src/commands/storage_zone.rs
Storage handlers destructure renamed remote_path and file fields; Ls trims remote_path before listing; Download writes to file if specified or stdout if omitted; storage_zone converts zone_tier via i64::from before setting on request body; both normalize date inputs for statistics queries.
E2E Test Updates
tests/e2e/cli_script.rs, tests/e2e/cli_storage.rs, tests/e2e/cli_stream.rs
CLI invocations updated to use typed enum values (--script-type cdn instead of 1) and renamed flags (--file, --remote-path, --id instead of --output, --path, --library-id) across script create, storage ls/download, and stream library statistics tests.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

A rabbit hops through CLI fields so bright,
Where dates normalize to format's light,
From library_id to simple id we go,
And --file guides the data's flow.
With shields and scripts now typed just right,
The CLI shines in polish so tight! 🐰✨


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

UX consistency pass across the Hoppy CLI based on the 2026-05-10 dogfooding round, focusing on flag naming consistency, friendlier date inputs, and clearer human-readable output for a few commands.

Changes:

  • Standardized several CLI flags (e.g., storage --remote-path, storage download --file, stream library statistics --id) and updated e2e tests accordingly.
  • Introduced src/date.rs to normalize date-only inputs (YYYY-MM-DD → midnight UTC) and translate Shield event-log dates client-side.
  • Improved non-JSON outputs for a few commands (DB delete confirmations, DNSSEC status DS record visibility, Stream library stats sentinel -1N/A in text/table).

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/e2e/cli_stream.rs Updates Stream library statistics flag to --id in tests.
tests/e2e/cli_storage.rs Updates Storage flags (--remote-path, download --file) in tests.
tests/e2e/cli_script.rs Updates script type tests from numeric to named ValueEnum (e.g., cdn).
src/main.rs Registers the new date module in the binary.
src/lib.rs Exposes date as a public module for crate consumers/tests.
src/date.rs Adds shared date normalization helpers + unit tests.
src/commands/video_library.rs Normalizes date_from/date_to before calling API.
src/commands/stream.rs Renames statistics flag to --id, normalizes dates, renders engagement -1 as N/A in text/table.
src/commands/storage.rs Renames ls arg to remote_path and download --output to --file.
src/commands/storage_zone.rs Uses ValueEnum tier conversion and normalizes stats date range args.
src/commands/statistics.rs Normalizes account statistics date range args before API call.
src/commands/shield.rs Translates shield event-logs --date to legacy US format client-side.
src/commands/script.rs Switches script type from numeric to ValueEnum and normalizes statistics date range args.
src/commands/pull_zone.rs Normalizes pull-zone statistics date range args.
src/commands/dns.rs Enhances DNSSEC status output to include DS record details when enabled.
src/commands/database.rs Normalizes DB stats/usage windows; fixes delete confirmations (text + JSON).
src/cli.rs Adds new ValueEnums and updates flag names/help text for affected commands.
hoppy-knowledgebase/iterations/iteration-28-dogfooding-ux-polish.md Marks iteration tasks/acceptance as completed and updates checklist.
hoppy-knowledgebase/dogfooding/dogfooding-playbook.md Updates auth instructions to match env-var-only auth flow.
hoppy-knowledgebase/decision-log.md Records decision to standardize storage local-path flag on --file.

Comment thread src/date.rs
Comment on lines +88 to +92
/// Returns `true` if the string starts with `YYYY-MM-DDT` (contains a `T`
/// after the date part), indicating it's already a datetime string.
fn looks_like_datetime(s: &str) -> bool {
s.len() > 10 && looks_like_iso_date(&s[..10]) && s.as_bytes()[10] == b'T'
}
Comment thread src/date.rs Outdated
bail!("invalid date {input:?} — accepted formats: {ISO_DATE_FORMAT} or {ISO_DATETIME_FORMAT}");
}

/// Same as [`normalise_datetime`] but operates on an `Option<String>`,
Comment thread src/date.rs
Comment on lines +15 to +18
/// Accepted date formats listed in user-facing error messages.
const ISO_DATE_FORMAT: &str = "YYYY-MM-DD";
const ISO_DATETIME_FORMAT: &str = "YYYY-MM-DDThh:mm:ssZ";

- [ ] All `delete` commands print a confirmation line in text mode.
- [ ] `dns zone dnssec status` text view shows DS record, digest, key tag,
- [x] No remaining `--<noun>-id` flags on `delete` subcommands.
- [x] No remaining "(0 = …, 1 = …)" help text.
- src/date.rs: avoid &str slicing across UTF-8 codepoint boundaries in
  looks_like_datetime; the byte-based check now matches looks_like_iso_date
  and never panics on non-ASCII input. Add a regression test.
- src/date.rs: widen the user-facing datetime format label from a fixed
  pattern to "RFC 3339 datetime", matching what the pass-through accepts.
- src/date.rs: doc comment on normalise_datetime_opt referenced
  Option<String> but the signature takes Option<&str> — fix the doc.
- dogfooding-playbook: live-api section claimed credentials are read from
  "the standard config", contradicting the auth section above. Both now
  agree: BUNNY_API_KEY env var is the only auth surface.
- iteration-28 acceptance: scope the "no remaining (0 = …)" claim to
  script-create + storage-zone-create. Shield's numeric flags are still
  there and tracked separately as a follow-up.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ractive
ractive merged commit 867e776 into main May 10, 2026
5 of 8 checks passed
@ractive
ractive deleted the iter-28/dogfooding-ux-polish branch May 10, 2026 17:54
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