feat(developer): last used display on API keys - #25
Conversation
Read last_used_at from GET /api/v1/keys and show it per key as relative time next to created; null renders as never used. Mock now serves the field and seeds a never-used key so the row is verifiable in walkthrough mode.
|
Warning Review limit reached
Next review available in: 14 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (4)
Note 🎁 Summarized by CodeRabbit FreeYour 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 |
Zingzy
left a comment
There was a problem hiding this comment.
Mergeable, nothing blocking. Small and correctly built.
- The wire field staying optional (
last_used_at?: number | null) is the load-bearing detail: until spoo#266 deploys, the backend omits the field entirely, absence and null both normalize to null, and the row renders never used. No deploy-order coupling in either direction. - Verified
formatWhen(null)returns "never", so the old row read "last used never"; this is a copy fix, not a broken-render fix. "never used" is the better sentence. - The mock discipline is the part worth praising: keyToWire serves the field with the same unix-seconds shape, the comment was updated in lockstep instead of drifting, and the new seed key exercises the null branch in walkthrough mode. That habit is what keeps the mock trustworthy.
- The seed's prefix is unique among its siblings, and the never-used state renders as muted metadata text rather than a badge, consistent with the rest of the row.
One thing to know, not to change: for the transition window after #266 deploys, every pre-existing key reads null and renders "never used" until its next authentication restamps it (within the hour for active keys). Since the whole point of the field is "is this key safe to revoke", a user checking the page on deploy day could read an active key as dead. It self-corrects fast and the alternative (transition copy) isn't worth the complexity at this scale; just don't mass-revoke based on the column that day.
Shows when each API key last authenticated a request, so you can tell whether a key is safe to revoke.
The keys page now reads the last_used_at field from GET /api/v1/keys (Unix seconds, normalized to ISO in the client) and renders it in the key metadata row as relative time, next to created. Keys that have never been used render as never used. The mock backend serves the field too and seeds a never-used key, so the row is verifiable in walkthrough mode.
Pairs with the merged backend change in spoo-me/spoo#266. Until that deploys, every key reads null on the wire and renders as never used, which is correct.