Skip to content

Close table-vs-JSON gaps in table renderers (DX-5689)#30

Merged
johnpmitsch merged 8 commits into
mainfrom
dx-5689-table-json-parity
Jun 12, 2026
Merged

Close table-vs-JSON gaps in table renderers (DX-5689)#30
johnpmitsch merged 8 commits into
mainfrom
dx-5689-table-json-parity

Conversation

@johnpmitsch

@johnpmitsch johnpmitsch commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

The table views are hand-curated and several had fallen behind the SDK response structs — data present in --format json was invisible in the default human view. This audits every Render impl against the SDK and closes the gaps. JSON output is unchanged throughout; only render_table bodies changed.

  • endpoint show: adds is_multichain, an always-present tags row, security.<feature> rows (enabled mark + configured count), security.ip_custom_header, and all rate_limits.* rows, kubectl-describe style. Rows are omitted when the API returns no security/rate-limit object.
  • endpoint security show: rebuilt as an OPTION/ENABLED toggle table plus one section per non-empty item list (TOKENS, JWTS, REFERRERS, DOMAIN_MASKS, IPS, REQUEST_FILTERS). Previously only counts were shown — no toggles, no item detail, and the security token/jwt/… subcommands have no list verbs, so configured items had no table view at all.
  • endpoint logs: adds an ERROR column. A request can return HTTP 200 with a JSON-RPC error (e.g. -32601); the table previously showed such failures as plain 200s.
  • team show: adds members_count plus MEMBERS and PENDING_INVITES sections (email/name/role/status).
  • billing payments: adds STATUS (failed payments were indistinguishable from successful ones) and MARKETPLACE columns.
  • usage summary: adds overages and RFC-3339 start_time/end_time rows (new ParsedTime::from_unix); usage by-method: adds CHAIN/NETWORK columns and renders ARCHIVE with the standard boolean cell; usage by-tag: adds REQUESTS.

Tests

New tests/table_snapshots.rs: insta snapshots of the real binary's stdout against wiremock fixtures — unlike output_snapshots.rs (re-declared renderers), these cover the actual decode-and-render path. 11 snapshots including minimal-payload cases that pin the omission behavior.

cargo test (210 tests), cargo clippy --all-targets -- -D warnings, cargo fmt --check, and cargo build --release all clean.

…nt show' table

The table view of 'qn endpoint show' only rendered six summary fields,
while --format json carried the full response. Add dotted-subfield rows
for is_multichain, each security feature (enabled mark + configured
count), the custom IP header, and every rate-limit bucket; the tags row
now always renders (— when empty). Rows for security.*/rate_limits.*
are omitted when the API returns no such object.

Adds tests/table_snapshots.rs: insta snapshots of real-binary stdout
against a wiremock server, covering the full and minimal payloads.
…table

The 'qn endpoint security show' table only listed per-feature item
counts, hiding both the enabled/disabled toggles and the configured
items themselves — and the security token/jwt/referrer subcommands have
no list verbs, so the items had no table view at all.

Render an OPTION/ENABLED table from the options toggles, then one
section per non-empty item list (TOKENS, JWTS, REFERRERS, DOMAIN_MASKS,
IPS, REQUEST_FILTERS) with the full item rows. Empty lists render no
section, so the common single-feature config stays compact.

Snapshot tests cover an all-features payload and a single-token one.
A request can return HTTP 200 while failing at the JSON-RPC layer
(e.g. error_code -32601 for an unknown method). The table previously
showed only the HTTP status, so such failures looked successful; the
error_code field was visible only in --format json. Render it as an
ERROR column after STATUS, — when absent.
The table view rendered only id, name, and default_role; the member
list and pending invites were visible only in --format json. Add a
members_count row plus MEMBERS and PENDING_INVITES sections
(EMAIL/NAME/ROLE/STATUS), omitted when empty.
Without the status column, failed or pending payments were
indistinguishable from successful ones outside --format json. Also
surface the marketplace portion of each payment.
…t counts

- 'usage summary' gains overages plus start_time/end_time rows so the
  numbers carry their window; unix seconds render as RFC-3339 via a new
  ParsedTime::from_unix, matching what --from/--to accept.
- 'usage by-method' gains CHAIN and NETWORK columns (a method name alone
  is ambiguous on multi-chain accounts) and renders ARCHIVE with the
  standard boolean cell.
- 'usage by-tag' gains the REQUESTS count.
The member-management commands take a user id, so surface it as the
first column of the MEMBERS and PENDING_INVITES sections instead of
leaving it JSON-only.
The dotted security.* rows only carry an enabled mark and a count;
the items themselves (token values, filter methods, referrer URLs,
item ids needed by the remove commands) required either --format json
or a separate 'security show' call. Extract that command's item-section
renderer into a shared security_item_sections helper and append the
same TOKENS/JWTS/REFERRERS/DOMAIN_MASKS/IPS/REQUEST_FILTERS sections to
'endpoint show'. Empty lists still render no section.
@johnpmitsch johnpmitsch merged commit 91d4fb9 into main Jun 12, 2026
29 of 31 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.

2 participants