Uh oh!
There was an error while loading. Please reload this page.
db/identity-reconcile: route users.name readers through user_profiles + flashcard column (epic follow-up) - #275
Conversation
…0024 identity split
Migration 0024 moved the public profile (incl. the 🔒-encrypted display `name`)
out of `users` into a 1:1 `user_profiles` table, and renamed
`users.room_id` -> `users.current_room_id`. The identity slice updated identity
files but left cross-domain readers/writers of `users.name` untouched; these
break against the real DB (mocked tests didn't catch them).
- services/graph_service.ensure_user_exists: stop INSERTing `name` into `users`
(column no longer exists). Insert only `{id, streak_count}`; do not create a
user_profiles row (onboarding/oauth own it).
- services/profiles.py (new): get_display_name / get_display_names read
user_profiles by user_id and decrypt the name. Tolerate missing rows.
- Repoint name reads onto the helper, preserving each response shape:
main.list_users (also source room_id from current_room_id),
routes/social.py (room detail, room activity, match_partners, school_match,
get_students), routes/quiz.py (quiz-context student name),
routes/learn.py get_user_name, services/users_search.paginate_users.
- services/users_search: CODE-ONLY fix — it reads table("users") directly, not a
DB view, so no 0028 migration is needed; names now come from user_profiles.
- services/flashcard_import_service.dedup_against_existing: filter the flashcards
link column `offering_id` (0025 renamed it from `course_id`); behavior identical.
Tests: new test_profiles_service; assert ensure_user_exists omits `name`; update
roster/social/users_search/flashcard tests for the new sources. Gate green:
2 known env-only test_storage_service failures only; ruff clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying with |
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs | frontend-staging | 16af571 | Commit Preview URL Branch Preview URL | Jun 24 2026, 08:12 PM |
Real-DB reconciliation the per-domain slices left behind (mocked tests didn't catch these — they only surface against the migrated schema).
Fixes:
graph_service.ensure_user_existsno longer INSERTs the droppedusers.name(inserts{id, streak_count}only).services/profiles.py:get_display_name/get_display_namesreaduser_profiles(decrypted); repointedmain.py,social.py(6 name reads),quiz.py,learn.py,users_search.py. Bonus: fixedmain.pyroom_id → current_room_id(another 0024 rename).flashcard_import_service.dedup_against_existing:course_id → offering_id(0025 rename).users_search: code-only (no decrypted DB view exists) — enriches rows fromuser_profiles; no migration needed.Tests: new
test_profiles_service.py(8) +TestEnsureUserExists(asserts nonamein the users insert); updated roster/social/search/flashcard/learn suites. 779 passed, zero new failures (only the 2 env-onlytest_storage_service.py); ruff clean.Plan:
docs/superpowers/plans/2026-06-24-db-identity-reconcile.md. After this, the epic is real-DB-safe → ready fordb/seed-staging(#258) and theepic → maincutover.