Understanding how state survives failures - and how to test it.
When an entity "dies" (runner crashes, shard reassigned), there are two separate things to worry about:
| Concern | Question | Effect Cluster Solution |
|---|
| #!/usr/bin/env python3 | |
| import iterm2 | |
| import os | |
| import re | |
| async def main(connection): | |
| @iterm2.TitleProviderRPC | |
| async def custom_amp_title( | |
| auto_name=iterm2.Reference("autoName?"), |
| import { makeInMemoryAdapter } from "@livestore/adapter-web"; | |
| import { type Store, createStorePromise } from "@livestore/livestore"; | |
| import { LogLevel } from "effect"; | |
| import { JotaiBatchCoordinator } from "./jotai-batch-coordinator.ts"; | |
| import { schema } from "./schema.ts"; | |
| export async function createLiveStoreForTesting({ | |
| batchUpdates, | |
| batchCoordinator, | |
| }: { |
| #!/usr/bin/env bun | |
| /// <reference types="bun" /> | |
| import { existsSync } from "node:fs"; | |
| import { writeFile } from "node:fs/promises"; | |
| import { basename, extname } from "node:path"; | |
| interface Options { | |
| /** e.g. `false` */ | |
| interactive: boolean; | |
| /** e.g. `100` */ |
| const secrets = new WeakMap<EnvSecret<unknown>, unknown>(); | |
| /** | |
| * A secure wrapper for environment variables that contain sensitive data. | |
| * | |
| * Values are stored privately using WeakMap to prevent accidental exposure | |
| * in logs, serialization, or debugging output. | |
| * | |
| * @template T The type of the secret value |
| [tools."http:jaeger"] | |
| # single authoritative version for every OS/arch | |
| version = "2.8.0" | |
| [tools."http:jaeger".platforms] | |
| macos-x64 = { url = "https://download.jaegertracing.io/v1.71.0/jaeger-2.8.0-darwin-amd64.tar.gz" } | |
| macos-arm64 = { url = "https://download.jaegertracing.io/v1.71.0/jaeger-2.8.0-darwin-arm64.tar.gz" } | |
| linux-x64 = { url = "https://download.jaegertracing.io/v1.71.0/jaeger-2.8.0-linux-amd64.tar.gz" } | |
| [tasks.start-jaeger] |
| // ============================================================================ | |
| // PACKAGE VERSIONS (2025-07-30) | |
| // ============================================================================ | |
| // | |
| // Dependencies: | |
| // - effect: 3.17.3 | |
| // - @effect/platform: 0.90.0 | |
| // - @effect/rpc: 0.68.0 | |
| // | |
| // ============================================================================ |
| import { FetchHttpClient, HttpClient, HttpClientRequest } from "@effect/platform"; | |
| import { RpcResolver, type RpcRouter } from "@effect/rpc"; | |
| import { HttpRpcResolver } from "@effect/rpc-http"; | |
| import type { AppRouter, JWTAccessToken, OrgID } from "@phosphor/server"; | |
| import { type UseMutationOptions, type UseQueryOptions, useMutation, useQuery } from "@tanstack/react-query"; | |
| import { Effect, flow, identity, pipe } from "effect"; | |
| import { Option } from "effect"; | |
| import type * as EffectRequest from "effect/Request"; | |
| import type { FiberFailure } from "effect/Runtime"; | |
| import React from "react"; |
| /** | |
| * FNV-1a 32-bit hash – fast, non-cryptographic, browser-safe. | |
| * Sufficient for generating repeatable fragment keys. | |
| */ | |
| export const fnv1aHash32 = (str: string): string => { | |
| let h = 0x811c9dc5; // FNV offset basis | |
| for (let i = 0; i < str.length; i++) { | |
| h ^= str.charCodeAt(i); | |
| h += (h << 1) + (h << 4) + (h << 7) + (h << 8) + (h << 24); | |
| } |
| export const OrgResource = RBAC.defineResource({ | |
| name: dev`Organization`, | |
| idSchema: OrgID, | |
| permissions: { | |
| CreateWorkspace: (its) => its.Member, | |
| }, | |
| roles: { | |
| Admin: true, | |
| Member: true, | |
| Guest: true, |