fix: staging loginのcanonical account_idを保持 - #576
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a helper function _account_source_with_canonical_id in staging_auth_bridge.py to preserve the top-level canonical account_id during staging login, along with corresponding unit tests and documentation updates. Feedback on the changes highlights a critical issue in the helper function: if the nested account object already contains a non-canonical account_id, the top-level canonical ID will not overwrite it, leading to a fallback behavior. It is recommended to always overwrite the nested ID with the top-level canonical account_id when it is available.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if body.get("account_id") is not None and not merged.get("account_id"): | ||
| merged["account_id"] = body.get("account_id") |
There was a problem hiding this comment.
ネストされた account や identity オブジェクトに、プロバイダーのユーザーID(例: google-oauth2|...)などの非 canonical な account_id が既に含まれている場合、not merged.get("account_id") が False と判定されてしまいます。その結果、トップレベルの canonical な account_id(acct_...)が上書きされず、sanitize_staging_account 内で非 canonical なIDが優先されてしまい、最終的にハッシュ化された staging-account-... にフォールバックしてしまいます。トップレベルの account_id は常に canonical なアカウントIDであるため、ネストされたオブジェクトに account_id が存在する場合でも、トップレベルの値を優先して常に上書きするように変更することを推奨します。
| if body.get("account_id") is not None and not merged.get("account_id"): | |
| merged["account_id"] = body.get("account_id") | |
| if body.get("account_id") is not None: | |
| merged["account_id"] = body.get("account_id") |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c540c79a33
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if body.get("account_id") is not None and not merged.get("account_id"): | ||
| merged["account_id"] = body.get("account_id") |
There was a problem hiding this comment.
Override nested IDs with the canonical account_id
When /v1/account/me returns a top-level canonical account_id alongside a nested display account that also carries a legacy/non-canonical account_id, this guard keeps the nested value. sanitize_staging_account() then rejects or hashes that nested value, so yonerai login still saves a staging-account-* reference and realtime sync continues to hit canonical_account_id_required until a separate whoami repair runs.
Useful? React with 👍 / 👎.
c540c79 to
4fae1b5
Compare
4fae1b5 to
d44c052
Compare
|
PR #576 review-intake classification after final push
|
概要
login時に/v1/account/meが top-levelaccount_idと nestedaccount表示情報を返す場合でも、top-level canonical account_id を staging session claim に保持します。whoamiで後から補正しなくても、sync listener / firebase-token が canonical account_id を参照できます。検証
python -m pytest tests\test_auth_privacy_policy.py tests\test_realtime_sync_client_service.py tests\test_realtime_sync_event_service.py tests\test_official_sync_cli.py tests\test_conversation_sync_policy.py tests\test_native_run_client.py tests\test_control_spine_client.py -q-> 226 passedpython -m ruff check clients\cli\yonerai_cli\staging_auth_bridge.py clients\cli\yonerai_cli\services\realtime_sync_client_service.py clients\cli\yonerai_cli\commands\sync.py tests\test_auth_privacy_policy.py tests\test_realtime_sync_client_service.py tests\test_official_sync_cli.py-> passedpython -m compileall -q clients\cli\yonerai_cli tests-> passedgit diff --check-> passedpython scripts\ci_quality_scans.py --changed-> passed境界
[PUBLIC-SYNC-SMOKE-PREPARED]ではありません。