| 408 | * without the policy ever having been consulted. |
| 409 | */ |
| 410 | const expectWriteRefused = <A, E extends { readonly _tag: string }>( |
| 411 | effect: Effect.Effect<A, E | StorageError>, |
| 412 | ) => |
| 413 | // The surfaces under test fail with different unions (StorageFailure, |
| 414 | // ConnectionNotFoundError, …). The refusal this pins is always a |
| 415 | // StorageError, so the effect is widened for the catch; `orDie` below still |
| 416 | // turns every OTHER tag into a test failure, and a write that SUCCEEDS dies |
| 417 | // rather than reaching an assertion — so the hole can never pass silently. |
| 418 | (effect as Effect.Effect<A, StorageError>).pipe( |
| 419 | Effect.flatMap(() => Effect.die("expected the platform view to refuse this write")), |
| 420 | Effect.catchTag("StorageError", (error: StorageError) => { |
| 421 | expect(error.message).toContain("read-only"); |
| 422 | return Effect.void; |
| 423 | }), |
| 424 | Effect.orDie, |
| 425 | ); |
| 426 | |
| 427 | describe("platform view — read-only across every surface", () => { |
| 428 | it.effect("refuses org-row writes through policies and oauth", () => |