Repository navigation
feat: --days on stats, --zone filter for nxdomains, column docs (v1.0.7) - #6
Merged
Merged
Conversation
…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.
9 tasks done
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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) onrc0 stats queries,rc0 stats topzones, andrc0 stats zone queries. First two forwarddaysas a query parameter (per OpenAPI spec, API default 30). The zone-scoped endpoint has no server-side filter, so--daysslices the last N entries client-side after fetching the full 180-day history.--zone <apex>onrc0 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 bothexample.comandexample.com.match.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 csvremain the way to get headers in redirected output.CHANGELOG.mdentry and version bump to 1.0.7.Deliberately out of scope
report nxdomainshistorical dates): upstream-bound — the v2 API endpoint only acceptstoday/yesterday. Needs a RcodeZero feature request.record adderror hint on positional-style invocation): requires a Click exception hook insrc/rc0/app.py; left for a separate PR.record list): already exists at src/rc0/commands/record.py:33.Test plan
uv run ruff check .— cleanuv run ruff format --check .— cleanuv run mypy— 69 files, 0 issuesuv run pytest— 403 passed, 91.81% coverage (floor 88%)--helpsmoke:rc0 stats queries --help,rc0 report nxdomains --help,rc0 zone list --helpall render the new Columns/Examples blocks cleanlyrc0 stats topzones --days 7should return different counts than--days 30;rc0 report nxdomains --zone <one-of-your-zones>should return only that zone's rows