The most dangerous failure in multi-user RAG isn't answering incorrectly: it's retrieving the right document for the wrong person. Permissions must be enforced before sending context to the model.
Design payloads to isolate clients, users, and documents.
Apply filters before retrieving chunks.
Avoid one collection per client when it's not necessary.
Case:
- User A belongs to client_acme
- User B belongs to client_beta
- Both ask a similar question
Test:
1. Index documents with different tenant_id values.
2. Ask as User A.
3. Verify that no chunk from client_beta appears in the trace.