Commit 5ea48bb
committed
test(driver-sqlite-wasm): open the tenant audit with the real posture knob, not the deleted memo (#5262)
Regression from this branch's own driver-sql change, caught by CI
(Test Core 2/3): `SqliteWasmDriver extends SqlDriver`, and this suite's
tenant-audit test switched multi-tenant mode on by poking the private
`_multiTenantMode` memo:
(driver as any)._multiTenantMode = true;
That memo is gone — `isMultiTenantMode()` now resolves the tenancy posture
live — so the poke silently stopped doing anything, the gate read
single-org, no warning was emitted, and the assertion failed with
"expected [] to have a length of 1 but got +0". Reproduced locally against
the pre-fix test before changing it.
Fixed the way the sibling driver-sql suite already was: set the real
`OS_TENANCY_POSTURE=isolated` and restore it in a `finally`. This is
strictly better than what it replaces — the old poke reached into an
implementation detail, so it began lying the moment that detail changed,
which is exactly how it failed. Driving the documented knob cannot go
quietly stale that way.
Also strengthened the neighbouring `bypassTenantAudit` case in the same
block, which was VACUOUS: it never set a posture, so the audit returned at
the multi-tenant gate and `warnSpy` was empty regardless of the flag under
test — it would have passed with the flag deleted. (Vacuous before this
branch too; it simply never poked the memo the way its sibling did.) It now
sets the posture, so the flag is the only thing that can keep the log
quiet; verified by deleting the flag and watching it go red.
Repo-wide grep confirms no third package pokes `_multiTenantMode`; the only
remaining mentions are this branch's own comments and the tombstone
assertion in sql-driver-tenant-audit-posture.test.ts.
Full suites (not just the touched file): driver-sqlite-wasm 16 files /
232 tests passed; driver-sql 63 files (59 passed, 4 skipped) / 740 passed
+ 44 skipped. typecheck Done for both; eslint clean.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015W6nhsDrz6zWQc8je12a1t1 parent dda8af0 commit 5ea48bb
1 file changed
Lines changed: 45 additions & 14 deletions
Lines changed: 45 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
297 | 313 | | |
298 | 314 | | |
299 | 315 | | |
300 | 316 | | |
301 | 317 | | |
302 | 318 | | |
303 | 319 | | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
311 | 342 | | |
312 | 343 | | |
313 | 344 | | |
0 commit comments