Repository navigation
Conversation
Add last_rotated and expiry_date columns to operations.worker_oauth to track when keys are rotated and when they expire, along with Alembic migration 47 and model tests. Fixes chaoss#573 Signed-off-by: Dev10-sys <kalpanagola9897@gmail.com>
MoralCode
requested changes
Nov 22, 2026
| @@ -0,0 +1,50 @@ | |||
| """Add last_rotated and expiry_date columns to worker_oauth table | |||
|
|
|||
| Revision ID: 47 | |||
Contributor
Author
Contributor
There was a problem hiding this comment.
IMO we dont need a unit test for migration files. theyre excluded from testing/coverage anyway and should not generally be changing once they are created/tested
Author
There was a problem hiding this comment.
Agreed, removed the migration tests from test_worker_oauth.py and kept only the model/expiry logic tests.
Update last_rotated column in worker_oauth to be nullable without a database-level server default, avoiding unintended backfill of current timestamps on existing keys. Remove migration unit tests as alembic migrations are excluded from test coverage. Signed-off-by: Dev10-sys <kalpanagola9897@gmail.com>
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.
Description
This PR adds two new columns to the
worker_oauthtable in theoperationsschema to help track API key lifecycle as requested in #573:last_rotated: Nullable timestamp of when the key was last rotated or added (defaults to NULL on existing records so unrotated keys are accurately represented).expiry_date: Nullable timestamp for platforms/tokens that have an expiration date.I also added:
is_expiredproperty onWorkerOauthto easily check if a key has expired against current UTC time.47_add_key_rotation_and_expiry_to_worker_oauth.pywith upgrade and downgrade steps.This PR fixes #573
Notes for Reviewers
Updated
last_rotatedtonullable=Truewithout a DB-level server default based on review feedback.Signed commits
Generative AI disclosure
Please select one option: