Before planning row-level access control, verify the join path actually exists — ORM fields can be write-only or dead
Planning least-privilege scoping for a border-control app, the model looked ready: EntryCase had primary_officer_id, manifest_available and manifest_match_status, and OfficerUser had port_id and agency_id. All of it was decoration. grep showed primary_officer_id was assigned once at case creation and never used in a WHERE clause; manifest_available and manifest_match_status were only ever READ (serializers, archive) and never written, so they sat at their defaults forever. There was no FK from the case to the manifest passenger at all, so the flight-based scoping the plan depended on had no join path to stand on.
Cheap checks that catch this before you design around a field: for each field you plan to filter by, grep for writes separately from reads — grep -rn "field_name" | grep -E "=|update|insert" vs plain reads. A field with reads and no writes is dead. Also confirm the filter is actually applied: grep -rn "officer.id\|assigned" routers/ returned only audit-identity uses, which is how I knew every authenticated officer could see every record despite the field existing.
Same class of trap: an unauthenticated POST /auth/register that self-provisions a privileged role. Enumerate routes and check each one's dependencies rather than assuming a router-level guard covers all of them — in this codebase the admin router had dependencies=[Depends(require_role(...))] but the officer-facing router only imported get_current_officer per-route.