Task: Tenancy, login and tests
This page documents a task in the Tenancy foundation story. It captures the goal, current status, acceptance, and any notes or results.
Goal
Wire tenancy into login + session creation, and prepare the C++ test infrastructure to set tenant context transparently.
Status
| Field | Value |
|---|---|
| State | DONE |
| Parent story | Tenancy foundation |
| Now | Completed 2026-02-01. |
| Waiting on | None. |
| Next | None. |
| Last touched | 2026-02-01 |
Acceptance
- BEFORE INSERT triggers on
iam_login_info_tbl+iam_sessions_tblpopulatetenant_idfromapp.current_tenant_idwhen not supplied explicitly. ores_iam_validate_tenant_fnusescoalesce(p_tenant_id, ores_iam_current_tenant_id_fn()).ores_test_ddl_userandores_test_dml_userdefaultapp.current_tenant_idto the system tenant insetup_template.sql.- C++
database_helper::set_system_tenant_context()callable from test constructors.
Plan
Captured during execution; cleared into the parent story on close.
Notes
The triggers are what make pre-existing C++ code 'just work' under tenancy — it doesn't have to know about tenant_id everywhere.
Result
Tenancy plumbed through login + tests transparently.