test(rls): make tenant-isolation count robust to own-company seed #310

Merged
David merged 3 commits from fix/PMS-414-rls-isolation-test-own-company-seed into main 2026-06-19 11:15:58 +02:00
Owner

The rls_isolation regression hard-coded count == 1 after seeding its probe company under tenant A. PMS-413 migration 062 backfills a per-tenant internal "own company", so the default tenant A now legitimately owns two companies (own-company + probe) and the matching-GUC read returns 2 rows, failing the assertion. Both rows belong to tenant A, so RLS is not leaking - the hard-coded count was simply stale.

Capture tenant A's owner-visible company count before dropping to the unprivileged role and assert the matching-GUC read equals it. The test still proves the policy is fail-closed (zero rows with no GUC) and exposes exactly tenant A's rows under the matching GUC, but no longer breaks when seed migrations add more tenant-A-owned rows.

#PMS-414

The rls_isolation regression hard-coded count == 1 after seeding its probe company under tenant A. PMS-413 migration 062 backfills a per-tenant internal "own company", so the default tenant A now legitimately owns two companies (own-company + probe) and the matching-GUC read returns 2 rows, failing the assertion. Both rows belong to tenant A, so RLS is not leaking - the hard-coded count was simply stale. Capture tenant A's owner-visible company count before dropping to the unprivileged role and assert the matching-GUC read equals it. The test still proves the policy is fail-closed (zero rows with no GUC) and exposes exactly tenant A's rows under the matching GUC, but no longer breaks when seed migrations add more tenant-A-owned rows. #PMS-414
test(rls): make tenant-isolation count robust to own-company seed
All checks were successful
E2E / Playwright against staging (pull_request) Successful in 34s
Check / fmt + clippy + compile + unit/doc tests (pull_request) Successful in 1m7s
Integration / integration tests (pull_request) Successful in 3m55s
1cce469959
The rls_isolation regression hard-coded count == 1 after seeding its probe company under tenant A. PMS-413 migration 062 backfills a per-tenant internal "own company", so the default tenant A now legitimately owns two companies (own-company + probe) and the matching-GUC read returns 2 rows, failing the assertion. Both rows belong to tenant A, so RLS is not leaking - the hard-coded count was simply stale.

Capture tenant A's owner-visible company count before dropping to the unprivileged role and assert the matching-GUC read equals it. The test still proves the policy is fail-closed (zero rows with no GUC) and exposes exactly tenant A's rows under the matching GUC, but no longer breaks when seed migrations add more tenant-A-owned rows.

#PMS-414
Merge branch 'main' into fix/PMS-414-rls-isolation-test-own-company-seed
Some checks failed
E2E / Playwright against staging (pull_request) Successful in 33s
Check / fmt + clippy + compile + unit/doc tests (pull_request) Successful in 1m9s
Integration / integration tests (pull_request) Failing after 3m8s
f84b10c807
Merge branch 'main' into fix/PMS-414-rls-isolation-test-own-company-seed
Some checks failed
Create release / Create release from merged PR (pull_request) Has been skipped
E2E / Playwright against staging (pull_request) Failing after 48s
Check / fmt + clippy + compile + unit/doc tests (pull_request) Successful in 1m24s
Integration / integration tests (pull_request) Failing after 6m18s
9625d65c31
David merged commit 74602d6c5e into main 2026-06-19 11:15:58 +02:00
David deleted branch fix/PMS-414-rls-isolation-test-own-company-seed 2026-06-19 11:15:59 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-server!310
No description provided.