Conversation
Greptile SummaryThis PR implements API key rotation: a new
Confidence Score: 4/5Safe to merge after addressing the silent error-swallowing in the rotate dialog that leaves users with no feedback on failure. The core rotation logic is sound: privacy is enforced contextually through Ent interceptors, the cross-project access test confirms this, cache invalidation covers both old and new keys, and the schema change is correctly scoped. The outstanding concern is the empty catch block in the rotate dialog, which discards mutation errors entirely — a failed rotation leaves the dialog in its pre-rotate state with no visible error, making it impossible for the user to know the operation failed. frontend/src/features/apikeys/components/apikeys-rotate-dialog.tsx — the handleRotate catch block needs error surfacing before this ships to users. Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant RotateDialog
participant Mutation Hook
participant GraphQL Server
participant BizLayer
participant Database
User->>RotateDialog: Click Rotate
RotateDialog->>Mutation Hook: mutateAsync(id)
Mutation Hook->>GraphQL Server: rotateAPIKey(id)
GraphQL Server->>BizLayer: RotateAPIKey(ctx, id)
BizLayer->>Database: APIKey.Get(ctx, id) [privacy enforced via ctx]
Database-->>BizLayer: existing record
BizLayer->>BizLayer: GenerateAPIKey(prefix)
BizLayer->>Database: UpdateOneID(id).SetKey(newValue).Save(ctx)
Database-->>BizLayer: updated record
BizLayer->>BizLayer: invalidateAPIKeyCaches(old, new)
BizLayer-->>GraphQL Server: APIKey
GraphQL Server-->>Mutation Hook: rotateAPIKey result
Mutation Hook-->>RotateDialog: result with new value
RotateDialog->>User: Show masked value + Copy button
Reviews (4): Last reviewed commit: "feat: rotate api key, close #1692" | Re-trigger Greptile |
There was a problem hiding this comment.
Code Review
This pull request introduces an API key rotation feature, allowing users to generate new keys while preserving usage statistics. It includes the backend logic using raw SQL to update immutable fields, GraphQL mutations, and a new frontend dialog for the rotation process. Additionally, Atlas Cloud has been added as a provider with its own icon and sponsor sections in the documentation. Feedback focuses on potential SQL type mismatches for timestamps, the need to quote reserved keywords in database queries, and improving the visibility of newly generated keys in the UI.
35bc2d9 to
94de33c
Compare
Uh oh!
There was an error while loading. Please reload this page.