chore: surface key add/remove/keep counts in audit log#25484
Merged
Conversation
This was referenced May 19, 2026
Contributor
Author
eb8169a to
ed242f5
Compare
610edd5 to
a1a65c8
Compare
ed242f5 to
0e7201d
Compare
a1a65c8 to
dd32234
Compare
0e7201d to
06945f3
Compare
06945f3 to
db7051b
Compare
… log A PATCH that only rotates API keys produced an audit entry with an empty diff: keys live in a separate table, so the provider-level diff missed every change. Per-key audit events were removed when the AIProviderKey resource was dropped, so key rotation was invisible in the log. applyAIProviderKeyOps now returns counts, and the update handler attaches them to the audit entry's additional_fields as keys_added / keys_removed / keys_kept. An operator can now answer "was anything rotated on this PATCH?" from the audit log even when the top-level diff is empty. Also fix sqlc casing so database.ResourceTypeAIProvider matches the acronym convention used elsewhere in the codebase. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…per-key detail
Collapse aiProviderKeyOpsCounts into aiProviderKeyOpsAudit. Added and
removed now carry per-key {id, masked}; kept stays as a count since a
steady-state rotation can retain many keys and per-entry detail there
is noise.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
db7051b to
286f036
Compare
ibetitsmike
reviewed
May 20, 2026
| return database.ResourceTypeAiSeat | ||
| case database.AIProvider: | ||
| return database.ResourceTypeAiProvider | ||
| return database.ResourceTypeAIProvider |
Collaborator
There was a problem hiding this comment.
are you sure you are actually consistent with this casing throughout the codebase?
Contributor
Author
There was a problem hiding this comment.
It's super unfortunate that the other ones were Ai and not corrected to AI.
I've added a follow-up item to correct the others: https://linear.app/codercom/issue/AIGOV-369/change-ai-references-in-coderddatabasemodelsgo-to-ai
ibetitsmike
approved these changes
May 20, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.

No description provided.