review tenant-isolation and authorization-boundary safety in multi-tenant systems. use when code touches org or tenant scoping, admin access, role checks, rls-sensitive paths, exports, reports, dashboards, search/list endpoints, joins, or any potentially cross-tenant read/write flow, including missing org filters, over-broad admin access, unsafe fallback queries, rls-only reliance, tenantid/org_id alias confusion, and cross-tenant exposure risk. review-only: inspect, classify, and report without implementing fixes.
Trace one scoped path in this order:
Classify each finding with one primary class:
For detailed definitions and confidence wording, read risk-classification.md.
AGENTS.md before review work.org_id as the canonical tenant boundary.tenantId as possible legacy/local aliasing unless evidence shows unsafe behavior.For repo-specific rules and thresholds, read texqtic-tenancy-rules.md.
high, medium, low).Return a structured review report containing:
Recommend:
implementation prompt next when root cause and boundary behavior are clear with high confidence.another narrow verification prompt next when one unresolved link blocks confidence.governance decision next when doctrine interpretation determines acceptable behavior.policy clarification next when required auth/RLS policy intent is not visible in reviewed artifacts.Target: GET /api/customers/export in a multi-tenant CRM.
Trace: export UI -> client -> route -> service -> SQL join.
Finding: export query scopes by role but misses tenant/org predicate.
Classification: explicit tenant-scope missing.
Confidence: high.
Next safe action: implementation prompt next.
Target: tenant list endpoint using tenantId fields with RLS context.
Trace: tenant UI -> service -> tenant route -> with DB context -> Prisma query.
Finding: aliasing between tenantId and canonical org_id appears consistent, but no explicit app-layer filter where doctrine may prefer defense in depth.
Classification: rls-only reliance / defense-in-depth gap.
Confidence: medium.
Next safe action: governance decision next if doctrine requires explicit app-layer filters for this path.