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