# Tenant isolation model

## Data model

Every tenant-owned row has an organisation_id column. Composite indexes begin
with organisation_id so scoped queries stay fast.

## Request path

1. The session cookie is verified and decoded.
2. The organisation id is taken from the signed session.
3. Handlers build queries with that organisation id.
4. Responses containing a record owned by another tenant return 404, not 403, to
   avoid confirming that the record exists.

## Background jobs

Jobs carry the organisation id in their payload and re-check ownership before
writing. A job that cannot resolve its tenant fails closed.

## Testing

The test suite includes cross-tenant access cases for every read and write
endpoint. New endpoints without a cross-tenant test fail review.
