Repository navigation
fix(accounts): self-heal unusable user_id via /me before Graph calls - #264
Merged
Merged
Conversation
…265) ## What - New user_id_resolution module: is_user_id_usable() predicate (non-empty numeric string) + 4 unit tests. - ThreadsClient::ensure_resolved_user_id(): when the stored user_id is unusable (NULL/empty/token-in-id-slot — observed on the ajianaz account), resolve the real id via GET /me, persist it to the DB, and return the healed account. No-op for healthy accounts. - Wired into all six call sites that build /v1.0/{user_id}/... URLs: create_container, create_container_full, publish_container, fetch_user_insights, fetch_publishing_limit, fetch_mentions. - Store::pool() getter (private pool was unreachable cross-module). ## Why The ajianaz account carried user_id NULL for weeks because an OAuth exchange path failed to persist it. Every user-id-scoped call (mentions fetch, publishing limit, publishing itself) built URLs with the raw token as the path segment and Meta rejected them with 'Unsupported get request'. The token is valid — /me proves it — so the account heals itself on the first affected call, with zero cost for healthy accounts. Live root cause evidence: see the 2026-09-10 multi-account audit (publishing-limit + mentions fail only for ajianaz; profile via /me works). ## Testing - 4 unit tests for the usability predicate (numeric ok, empty/token/ alphanumeric rejected). - Full workspace: 251 passed / 0 failed; clippy -D warnings clean; fmt clean. - Live verification plan post-deploy: ajianaz mentions fetch + publishing-limit flip from LIMITS_FETCH_FAILED/MENTIONS_FETCH_FAILED to 200 on the first call.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
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.
What
user_id_resolutionmodule:is_user_id_usable()predicate (non-empty numeric string) + 4 unit tests.ThreadsClient::ensure_resolved_user_id(): when the stored user_id is unusable (NULL / empty / token-in-id-slot — observed live on the ajianaz account), resolve the real id viaGET /me, persist the correction to the DB, and return the healed account. No-op for healthy accounts./v1.0/{user_id}/...URLs:create_container,create_container_full,publish_container,fetch_user_insights,fetch_publishing_limit,fetch_mentions.Store::pool()getter (the private pool was unreachable cross-module).Why
The ajianaz account carried
user_idNULL for weeks because an OAuth exchange path failed to persist it. Every user-id-scoped call built URLs with the raw access token as the path segment and Meta rejected them:Unsupported get request. Object with ID 'THAASBUF...'(verified live on v0.9.4 — publishing-limit + mentions fail ONLY for ajianaz while profile-via-/me works, proving the token itself is healthy). With self-healing, the first affected call repairs the account permanently — no manual SQL, no re-OAuth.Testing
-D warningsclean; fmt clean.mentions fetch+publishing-limitflip from FAILED to 200 on the first call.Security review notes (cora findings addressed)