Skip to content

feat: --days on stats, --zone filter for nxdomains, column docs (v1.0.7) - #6

Merged
zoltanf merged 1 commit into
mainfrom
post-v1.0-polish-days-flags
Apr 23, 2026
Merged

zoltanf merged 1 commit into
mainfrom
post-v1.0-polish-days-flags

Conversation

@zoltanf

@zoltanf zoltanf commented Apr 23, 2026

Copy link
Copy Markdown
Owner

Summary

Post-v1.0 polish pass driven by a 26-zone production deployment's feedback. Triage and validity verdicts per feedback point are in ~/.claude/plans/can-you-please-analyse-quirky-kahan.md.

  • --days N (1–180) on rc0 stats queries, rc0 stats topzones, and rc0 stats zone queries. First two forward days as a query parameter (per OpenAPI spec, API default 30). The zone-scoped endpoint has no server-side filter, so --days slices the last N entries client-side after fetching the full 180-day history.
  • --zone <apex> on rc0 report nxdomains. Upstream endpoint cannot filter by zone; the CLI applies it client-side after fetching the account-wide response. Trailing dots are normalised so both example.com and example.com. match.
  • Column-name docstrings on zone list, stats queries, stats zone queries, stats topzones, report nxdomains. Plain output (the non-TTY fallback, mission plan §9) emits no headers by design; the docstring now names the fields so users piping to grep/awk can interpret them. -o tsv / -o csv remain the way to get headers in redirected output.
  • CHANGELOG.md entry and version bump to 1.0.7.

Deliberately out of scope

Test plan

  • uv run ruff check . — clean
  • uv run ruff format --check . — clean
  • uv run mypy — 69 files, 0 issues
  • uv run pytest — 403 passed, 91.81% coverage (floor 88%)
  • Manual --help smoke: rc0 stats queries --help, rc0 report nxdomains --help, rc0 zone list --help all render the new Columns/Examples blocks cleanly
  • Live smoke against a real account (reviewer): rc0 stats topzones --days 7 should return different counts than --days 30; rc0 report nxdomains --zone <one-of-your-zones> should return only that zone's rows

…ocs (v1.0.7)

User feedback from a 26-zone production deployment: the stats/report
commands' biggest weakness was observability depth — unlabeled columns
when piped and no time-window flags.

- Added --days N (1-180) to `rc0 stats queries`, `rc0 stats topzones`,
  and `rc0 stats zone queries`. The first two forward `days` as a query
  parameter; the zone-scoped endpoint has no server-side filter so
  --days slices the last N days client-side after fetching the full
  180-day history.
- Added --zone <apex> to `rc0 report nxdomains`. The upstream endpoint
  cannot filter by zone, so the CLI applies it client-side after
  fetching the account-wide response. Trailing dots are normalised.
- Help text for `zone list`, `stats queries`, `stats zone queries`,
  `stats topzones`, and `report nxdomains` now documents the column
  names and their meaning, so users piping to plain output (no headers
  by design, mission plan §9) can still interpret the fields. Users
  wanting headers in redirected output can use -o tsv / -o csv.
@zoltanf
zoltanf merged commit f3ae182 into main Apr 23, 2026
5 checks passed
@zoltanf
zoltanf deleted the post-v1.0-polish-days-flags branch April 23, 2026 21:25
zoltanf added a commit that referenced this pull request Apr 30, 2026
…nally (#14)

* feat(app): hint at flag-style usage when users invoke commands positionally

When a user types `rc0 record set zone.com www A 1.2.3.4` (positional)
instead of the flag form, Click exits 2 with a generic "Missing option
'--name'." with no path forward. This was a reported UX wart in the
v1.0.7 user-feedback triage (item #6) and was explicitly deferred to a
later release in HANDOFF.md, but never landed.

Switch the entry point to standalone_mode=False so we can intercept
click.UsageError and append a one-line `hint:` listing the command's
required flags. The hint fires for "Missing option", "Missing argument",
and "Got unexpected extra argument" — the three shapes a confused
positional-style user produces — and stays silent for unrelated errors
like "No such option". Same exit code (2), same Click message, just an
extra hint line.

Existing Rc0Error and ConfirmationDeclined paths still own their exit
codes (4–12); generic ClickException falls through to its own renderer.
Coverage rises to 90.64%.

* refactor: trim docstrings/comments, hoist test import, drop redundant sanity test

Code-review pass on the usage-hint feature:

- Hoist `from rc0.app import _run` from inside each integration test
  to the file's top-level imports — matches the existing pattern (line 13).
- Drop `test_record_module_imported_for_resolution` — its assertions
  (record set/append are registered) are already exercised transitively
  by every other test in the file.
- Drop the test-narrating comment about Click's option-vs-positional
  ordering and the verbose docstrings — the assertions are
  self-documenting; per CLAUDE.md keep only non-obvious WHY.
- Replace the docstring on `test_hint_uses_canonical_flag_not_python_name`
  with the WHY (Typer's Python-name leakage) and add the same WHY to
  `test_run_returns_zero_on_version` (regression guard for the
  standalone_mode=False refactor).
zoltanf added a commit that referenced this pull request May 1, 2026
…t trim

- CLAUDE.md: drop the Phase status table — every phase shipped (v0.1.0 →
  v1.0.0), the project is post-v1.0 and ongoing work is patch/minor
  releases driven by feedback. Reword the meta-plan reference accordingly,
  drop the per-phase branch convention (no more phases), and correct the
  fail_under coverage gate (88, not 86; ~91% on main).
- uv.lock: sync to pyproject 2.1.0 (matches the existing sync-the-lock
  pattern from previous releases).
- tests: strip stale "(feedback #6)" cross-reference from one section
  divider — the triage plan it pointed at is gone.
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