--- # nuzlocke-tracker-k1l1 title: Run ownership assignment and visibility toggle status: completed type: feature priority: normal created_at: 2026-03-20T15:28:27Z updated_at: 2026-03-20T20:21:01Z parent: nuzlocke-tracker-d98o blocked_by: - nuzlocke-tracker-b311 - nuzlocke-tracker-bnhh - nuzlocke-tracker-l9xh --- Wire up run ownership in the UI. New runs created by logged-in users are automatically assigned to them. Add a visibility toggle (public/private) to run settings. Update run list to show owned runs and public runs separately. ## Checklist - [x] Auto-assign owner_id when creating a new run (if authenticated) - [x] Add visibility toggle to run settings/edit page - [x] Update run list view: show 'My Runs' section for authenticated users - [x] Show public/private badge on run cards - [x] Enforce visibility on frontend (don't show edit controls for non-owned runs) - [x] Admin script/endpoint to assign existing unowned runs to a user by ID ## Summary of Changes ### Frontend - Updated `NuzlockeRun` type to include `visibility` (public/private) and `owner` fields - Updated `CreateRunInput` and `UpdateRunInput` to support visibility setting - **RunList.tsx**: Added "My Runs" and "Public Runs" sections for authenticated users, with private badge on owned runs - **RunDashboard.tsx**: Added visibility toggle dropdown in settings, restricted edit controls to run owners - **NewRun.tsx**: Added visibility selector during run creation ### Backend - Created `scripts/assign_unowned_runs.py` admin script to migrate existing unowned runs to a user ### Notes - The backend already supported auto-assigning `owner_id` on run creation (from blocking bean) - Unowned runs (legacy) remain editable by anyone for backwards compatibility