Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
"""
Fix users in the "not_found" state: user.inbox_project_id is set but no project
with is_user_inbox=True exists for that user on any shard.
For each user:
1. Look up the project referenced by user.inbox_project_id on its shard.
2. If found: mark it as the user's inbox (set is_user_inbox=True on the model).
3. If not found: clear stale refs on the user, then create a new inbox project.