Repository navigation
Tech-debt batch 15: users — atomic refresh rotation, hashed tokens, user-deletion cleanup (#625 #626 #627) - #648
Merged
Merged
Conversation
…revokes its family (#625) UPDATE ... WHERE revoked_at IS NULL RETURNING picks exactly one winner under concurrency; presenting an already-revoked token revokes every live token in its family (new family_id column, migration a625f0b7c912, branch label users). Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
…he cookie token on logout (#626) SHA-256 digests replace raw bearer secrets (migration a626b1c8d023 clears existing rows: one re-login). Logins/refreshes prune the user's expired/revoked tokens in bounded batches, keeping reuse evidence for live families (#625). Logout now deletes the presented access token instead of leaving it valid until expiry. Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
…ish user events after commit (#627) UserDeleted, UserDisabled and RoleAssigned are published durably (or inline in the request transaction without background_tasks); ordinary subscribers run only after commit. tenants, sharing and permissions purge the deleted user's memberships, shares and direct grants; a tenant left without an owner is suspended. RoleAssigned fires only for newly added roles, and set_roles now reloads roles with populate_existing so a user already in the identity map no longer comes back with an empty roles list. Claude-Session: https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4
UserDeleted moves to simple_module_core.user_events so tenants/sharing subscribe without importing users; docs describe hashed tokens and the users migration label.
Deploying simple-module-python with
|
| Latest commit: |
d9fbcdb
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://7ba46e8c.simple-module-python.pages.dev |
| Branch Preview URL: | https://fix-debt-batch-15.simple-module-python.pages.dev |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Summary
UPDATE … RETURNING). Reusing a spent token revokes its whole family (RefreshToken.family_id) and returns 401, and the revocation commits. Migrationa625f0b7c912adds ausersbranch label.users.token_storage). Logins and refreshes prune spent rows (100 per call, keeping reuse evidence for live families). Cookie and API logout now delete the access-token row server-side. Behaviour change: migrationa626b1c8d023deletes existing token rows, so clients log in once more.UserDeleted,UserDisabledandRoleAssignedpublish durably, or inline in the request transaction without background_tasks; ordinary subscribers run only after commit. tenants, sharing and permissions purge the deleted user's memberships, shares and direct grants; a tenant left with no owner is suspended.RoleAssignedfires only for newly added roles.UserDeletedmoves tosimple_module_core.user_events(still re-exported fromusers.contracts.events). Fixesset_rolesreturning an emptyroleslist when the user was already loaded in the session.Closes #625
Closes #626
Closes #627
Verification
/users/loginon port 8215 (QA ship-round-1), server log clean.make lint,make test-py(6183 passed),make test-js(770 passed) andmake migrations-roundtrip-pgare all green.QA Report
Test plan