chore(release): staging to production - 2026.06.03 - #1094
Merged
Conversation
## Summary Fixes two bugs on the API Keys page (`/sidekick-studio/apikey`) and adds real per-key usage tracking. - **"Updated" always showed today** — the UI read `apiKey.createdAt`, which the server never sent, so `moment(undefined)` rendered as the current date. - **"Usage" always 0** — that column was really `chatFlows.length` (connected chatflows); there was no API-call counter at all. ### Changes **Server** - `ApiKey` entity + `IApiKey`: add `createdAt` (`@CreateDateColumn`) and `usageCount` (int, default 0). - New Postgres migration `1770000000004-AddApiKeyUsageTracking` — adds both columns and backfills `createdAt` from `updatedDate` for existing rows. - New `apikeyService.recordApiKeyUsage(id)` — atomic `usageCount + 1` and `lastUsedAt = now()`. - Wired fire-and-forget into the API-key auth chokepoint (`handleApiKeyAuth` in `index.ts`) so every authenticated request with a key is counted without adding latency. - `importKeys` now persists the imported `createdAt` (previously validated then discarded). **UI** (`packages/ui/src/views/apikey/index.jsx`) - Replaced the conflated columns with: **Connected | API Calls | Last Used | Created** (dropped the buggy "Updated"). Updated skeleton rows and the collapsible `colSpan`. ### Notes - Migration is **Postgres-only** (the deployment DB). Can add mysql/mariadb/sqlite parity if desired. - Dropped "Updated" in favor of "Created"; easy to restore both if preferred. ## Test plan Verified live against the dev stack + real Postgres: - [x] Migration applies; `apikey` gains `createdAt` (not null) and `usageCount` (default 0); existing key backfilled to its real created date. - [x] **API Calls**: 3 authenticated requests → `usageCount` 0→3 (further list calls increment as expected). - [x] **Last Used**: `lastUsedAt` null → updates on each use. - [x] **Created**: shows real creation date (May 4), not today. - [x] **Connected**: linking a chatflow via `apikeyid` shows count 1 with flow details (test row cleaned up). - [x] `GET /api/v1/apikey` payload includes `createdAt`, `usageCount`, `lastUsedAt`. - [x] UI renders all columns correctly (Connected, API Calls, Last Used = June 3rd 2026, Created = May 4th 2026).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
🚀 Release: Staging to Production
Release Date: 2026-06-03
Changes in this release
This PR is automatically created/updated when commits are pushed to staging.
Merging this PR will trigger the release workflow to create a new GitHub release.