Repository navigation
Fix Optix rehydration during login bootstrap - #117
Merged
Merged
Conversation
AutumnQiu99
requested changes
Apr 25, 2026
AutumnQiu99
left a comment
Contributor
There was a problem hiding this comment.
In the try block of upsert_user_from_external_identity in users_repository.py, shouldn't we use user_service.update_user and not just update_user_with_mailbox_sync since what if phone updates?
gekiclaws
force-pushed
the
fix-optix-rehydration
branch
from
April 25, 2026 17:05
2cc784f to
b89f14b
Compare
AutumnQiu99
approved these changes
Apr 25, 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 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.
Problem
Optix login/bootstrap was treating all re-hydrated identity fields as app-owned local data. In practice that caused two regressions: existing users could have Avenu-managed
notifPrefsoverwritten during Optix login, and renamed Optix teams could stay stale locally along with their mailbox display names.Impact is limited to users coming through the Optix token login flow, but it directly affects persisted preference state and the correctness of team/mailbox names shown in the app.
Solution
Split the Optix sync path by ownership boundary. Existing users now keep Avenu-managed
notifPrefs, while successful/api/optix-tokenlogins continue to refresh only Optix-owned user fields. For new local users, the existing default notification preference still applies on first creation.Added change detection in the repository sync paths so unchanged Optix payloads do not trigger redundant local writes. For teams, existing records now refresh
namethrough the mailbox-sync path only when the Optix name actually changed, which keeps team mailbox display names aligned without rewriting unchanged rows.The alternative of blindly rewriting user/team records on every login was rejected because it adds unnecessary write load and makes ownership boundaries less explicit.
Testing
notifPrefs, updated phone/team membership still propagates, existing team rename updates team mailbox display name, unchanged team name skips writesRisks
Risk is low because the change stays inside the Optix login/bootstrap path and adds explicit diff-based guards before writes. The main thing to watch is whether any downstream code depended on user or team
updatedAtchanging on every Optix login, because unchanged payloads now intentionally return without rewriting records.Screenshots/Videos
No UI changes
Related
Fixes #68
Reviewer Notes
Focus review on the ownership boundary in
upsert_user_from_external_identity(...)and the diff-based update behavior in the user/team repository sync paths. Local unit coverage passed for the repository and identity sync tests;backend.tests.unit.test_identity_controllercould not run in this environment becauseprometheus_clientis not installed locally.