Skip to content

feat(api-keys): show 'Last used' per API key (closes #492) - #874

Merged
cristim merged 1 commit into
feat/multicloud-web-frontendfrom
fix/492-wave19
Jun 8, 2026
Merged

cristim merged 1 commit into
feat/multicloud-web-frontendfrom
fix/492-wave19

Conversation

@cristim

@cristim cristim commented May 30, 2026

Copy link
Copy Markdown
Member

Summary

  • Switch the "Last used" cell in the API Keys table from formatDateTime (absolute) to formatRelativeTime (e.g. "2h ago") with the full ISO timestamp on a title attribute for hover
  • Null last_used_at continues to render "Never" (not a zero time)
  • No new migration needed: last_used_at TIMESTAMPTZ NULL already exists in 000001_initial_schema.up.sql, UpdateLastUsed already fires async in ValidateUserAPIKey, and ListUserAPIKeysAPI already propagates the field

Test plan

  • Go: TestService_ListUserAPIKeysAPI extended with two new subtests asserting LastUsedAt round-trips correctly (non-nil for used keys, nil for never-used keys)
  • TS: two new tests in apikeys.test.ts covering null ("Never") and populated (relative label + ISO title) rendering
  • go test ./internal/auth/... ./internal/api/...: 1854 passed
  • npx tsc --noEmit: clean
  • Frontend jest (apikeys.test.ts): 58 passed

Column was already being rendered with formatDateTime (absolute). Switch
the "Last used" cell to formatRelativeTime with the ISO timestamp on a
title attribute for hover. Null last_used_at renders "Never" unchanged.

Backend last_used_at was already present: column in migration 000001,
UpdateLastUsed fires async in ValidateUserAPIKey, and ListUserAPIKeysAPI
already propagates the field. Migration 000065 not needed.

Add round-trip tests to service_apikeys_api_test.go asserting the field
is non-nil for used keys and nil (not zero-time) for never-used keys.
Add frontend tests for Never and for the relative+title rendering.
@cristim cristim added triaged Item has been triaged priority/p3 Polish / idea / may never ship severity/low Minor harm urgency/eventually No deadline impact/internal Team-internal only effort/s Hours type/feat New capability labels May 30, 2026
@cristim

cristim commented May 30, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 30, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@cristim, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 40 minutes and 9 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6c1f63a3-ce79-4bad-b112-378857677429

📥 Commits

Reviewing files that changed from the base of the PR and between 4956d66 and 473680f.

📒 Files selected for processing (3)
  • frontend/src/__tests__/apikeys.test.ts
  • frontend/src/apikeys.ts
  • internal/auth/service_apikeys_api_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/492-wave19

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

@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim

cristim commented Jun 4, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 4, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim

cristim commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 8, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@cristim
cristim merged commit 49e47ad into feat/multicloud-web-frontend Jun 8, 2026
5 checks passed
@cristim
cristim deleted the fix/492-wave19 branch July 27, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/s Hours impact/internal Team-internal only priority/p3 Polish / idea / may never ship severity/low Minor harm triaged Item has been triaged type/feat New capability urgency/eventually No deadline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant