diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index f662ca97..622c626d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -68,69 +68,28 @@ jobs:
fail-fast: false
matrix:
node: [22, 24]
- services:
- postgres:
- image: postgres:17-alpine
- env:
- POSTGRES_PASSWORD: postgres
- POSTGRES_DB: effect_agent
- ports:
- - 55432:5432
- options: >-
- --health-cmd pg_isready
- --health-interval 5s
- --health-timeout 5s
- --health-retries 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
+ # The integration suites boot Postgres and IntegreSQL in microVMs, which need the runner's KVM device.
+ - name: Grant KVM
+ run: |
+ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
+ sudo udevadm control --reload-rules
+ sudo udevadm trigger --name-match=kvm
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: ${{ matrix.node }}
- uses: ./.github/actions/pnpm-store
- - run: pnpm install --frozen-lockfile
- - run: pnpm test
- env:
- EFFECT_AGENT_TEST_POSTGRES_URL: postgres://postgres:postgres@localhost:55432/effect_agent
-
- # Transaction rollback and connection cleanup cannot be proven against an in-process double, so the Postgres
- # storage suite runs against real servers on each supported major.
- storage-postgres:
- name: test (postgres ${{ matrix.postgres }})
- runs-on: ubuntu-latest
- timeout-minutes: 20
- strategy:
- fail-fast: false
- matrix:
- postgres: ["16", "17", "18"]
- services:
- postgres:
- image: postgres:${{ matrix.postgres }}-alpine
- env:
- POSTGRES_PASSWORD: postgres
- POSTGRES_DB: effect_agent
- ports:
- - 55432:5432
- options: >-
- --health-cmd pg_isready
- --health-interval 5s
- --health-timeout 5s
- --health-retries 10
- steps:
- - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- with:
- persist-credentials: false
- - uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
- - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
+ # The fixtures pull the digest-pinned IntegreSQL layer from ghcr.io once and keep it here.
+ - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
- node-version: 24
- - uses: ./.github/actions/pnpm-store
+ path: ~/.cache/agent/integresql-layers
+ key: integresql-${{ runner.arch }}-${{ hashFiles('packages/storage-postgres/test/integresql-binary.ts') }}
- run: pnpm install --frozen-lockfile
- - run: pnpm --filter @systemfsoftware/agent-storage-postgres test
- env:
- EFFECT_AGENT_TEST_POSTGRES_URL: postgres://postgres:postgres@localhost:55432/effect_agent
+ - run: pnpm test
# The one check the ruleset requires and the merge queue gates on; the name matches the shared CI of the other
# systemfsoftware repositories. List every other job in `needs`: a job left out is not gated. The job always runs,
@@ -140,20 +99,19 @@ jobs:
name: checks / check
runs-on: ubuntu-latest
timeout-minutes: 5
- needs: [static-checks, changeset, test, storage-postgres]
+ needs: [static-checks, changeset, test]
if: ${{ always() }}
steps:
- name: Require every job to succeed
env:
STATIC_CHECKS: ${{ needs.static-checks.result }}
TEST: ${{ needs.test.result }}
- STORAGE_POSTGRES: ${{ needs.storage-postgres.result }}
CHANGESET: ${{ needs.changeset.result }}
EVENT: ${{ github.event_name }}
HEAD_REF: ${{ github.head_ref }}
run: |
status=0
- for pair in "static-checks:$STATIC_CHECKS" "test:$TEST" "storage-postgres:$STORAGE_POSTGRES"; do
+ for pair in "static-checks:$STATIC_CHECKS" "test:$TEST"; do
case "$pair" in
*:success) ;;
*) echo "A required job finished as: $pair"; status=1 ;;
diff --git a/oxlint.baseline.json b/oxlint.baseline.json
index 6841ceb6..18861f78 100644
--- a/oxlint.baseline.json
+++ b/oxlint.baseline.json
@@ -27,8 +27,10 @@
"packages/platform-cloudflare/test/scheduling.test.ts",
"packages/platform-cloudflare/test/subagent-harness.ts",
"packages/pr-review-action/src/github.ts",
+ "packages/storage-postgres/test/integresql-binary.ts",
"packages/storage-sql/src/SqlStorage.ts",
- "packages/testing/src/DurableCoordinatorConformance.ts"
+ "packages/testing/src/DurableCoordinatorConformance.ts",
+ "packages/testing/test/integresql-binary.ts"
],
"@systemfsoftware/cell-architecture/ban-unknown": [
"packages/ai-decision/src/AutoModel.ts",
@@ -183,6 +185,8 @@
"packages/storage-memory/src/MemoryThreadStore.ts",
"packages/storage-memory/test/durable-thread-head.test.ts",
"packages/storage-postgres/src/internal/storage-layout.ts",
+ "packages/storage-postgres/test/integresql-binary.ts",
+ "packages/storage-postgres/test/postgres-server.ts",
"packages/storage-postgres/test/postgres-submission-ledger-faults.test.ts",
"packages/storage-postgres/test/postgres-thread-store-faults.test.ts",
"packages/storage-sql/src/SqlActivityStore.ts",
@@ -217,6 +221,8 @@
"packages/testing/test/durable-runtime.test.ts",
"packages/testing/test/durable-subagents.test.ts",
"packages/testing/test/durable-tools.test.ts",
+ "packages/testing/test/integresql-binary.ts",
+ "packages/testing/test/postgres-server.ts",
"packages/testing/test/travel-planner-subagents-durable.test.ts",
"scripts/verify-record-format.ts",
"test/fixtures/instrumented-storage.ts"
diff --git a/packages/storage-postgres/package.json b/packages/storage-postgres/package.json
index 7f9e4dbf..4fd2e311 100644
--- a/packages/storage-postgres/package.json
+++ b/packages/storage-postgres/package.json
@@ -51,6 +51,8 @@
"@effect/platform-node": "catalog:",
"@effect/sql-pg": "catalog:",
"@effect/vitest": "catalog:",
+ "@systemfsoftware/effect-microsandbox": "catalog:",
+ "@systemfsoftware/effect-readiness": "catalog:",
"effect": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:",
diff --git a/packages/storage-postgres/test/harness.ts b/packages/storage-postgres/test/harness.ts
index ff6a5a60..4cb427ac 100644
--- a/packages/storage-postgres/test/harness.ts
+++ b/packages/storage-postgres/test/harness.ts
@@ -6,24 +6,25 @@ import * as Effect from 'effect/Effect'
import * as Layer from 'effect/Layer'
import * as Redacted from 'effect/Redacted'
+import { withIntegresqlDatabase } from './postgres-server.js'
+
/**
* A live Postgres is required for transaction rollback and connection cleanup;
- * an in-process double cannot establish those properties. `EFFECT_AGENT_TEST_POSTGRES_URL` points CI at its own service.
+ * an in-process double cannot establish those properties. Unset, the suite boots
+ * Postgres in a microVM and checks a database out of IntegreSQL; set
+ * `EFFECT_AGENT_TEST_POSTGRES_URL` to point it at a server you already run.
*/
-const adminUrl = process.env.EFFECT_AGENT_TEST_POSTGRES_URL ??
- 'postgres://postgres:postgres@localhost:55432/effect_agent'
+const configuredUrl = process.env.EFFECT_AGENT_TEST_POSTGRES_URL
let databaseCounter = 0
-const admin = (effect: Effect.Effect) =>
+const admin = (url: string, effect: Effect.Effect) =>
effect.pipe(
- Effect.provide(PgClient.layer({ url: Redacted.make(adminUrl), maxConnections: 1 })),
+ Effect.provide(PgClient.layer({ url: Redacted.make(url), maxConnections: 1 })),
Effect.catchTag('SqlError', (error) =>
Effect.die(
new Error(
- 'The storage-postgres tests need a reachable configured Postgres server ' +
- '(set EFFECT_AGENT_TEST_POSTGRES_URL, or run one with ' +
- '`docker run -d -p 55432:5432 -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=effect_agent postgres:17-alpine`).',
+ 'The configured Postgres server (EFFECT_AGENT_TEST_POSTGRES_URL) is unreachable.',
{ cause: error },
),
)),
@@ -35,6 +36,14 @@ const admin = (effect: Effect.Effect) =>
*/
export const withTemporaryDatabase = (
use: (url: string) => Effect.Effect,
+): Effect.Effect =>
+ configuredUrl === undefined
+ ? withIntegresqlDatabase(use).pipe(Effect.orDie)
+ : withOwnedDatabase(configuredUrl, use)
+
+const withOwnedDatabase = (
+ adminUrl: string,
+ use: (url: string) => Effect.Effect,
): Effect.Effect =>
Effect.acquireUseRelease(
Effect.sync(() => {
@@ -44,6 +53,7 @@ export const withTemporaryDatabase = (
}).pipe(
Effect.tap((database) =>
admin(
+ adminUrl,
Effect.flatMap(PgClient.PgClient, (sql) => sql.unsafe(`CREATE DATABASE ${database}`)),
)
),
@@ -57,6 +67,7 @@ export const withTemporaryDatabase = (
},
(database) =>
admin(
+ adminUrl,
Effect.flatMap(PgClient.PgClient, (sql) => sql.unsafe(`DROP DATABASE IF EXISTS ${database} WITH (FORCE)`)),
).pipe(Effect.ignore),
)
diff --git a/packages/storage-postgres/test/integresql-binary.ts b/packages/storage-postgres/test/integresql-binary.ts
new file mode 100644
index 00000000..17c99ca5
--- /dev/null
+++ b/packages/storage-postgres/test/integresql-binary.ts
@@ -0,0 +1,106 @@
+import * as Data from 'effect/Data'
+import * as Effect from 'effect/Effect'
+import * as HttpClient from 'effect/http/HttpClient'
+import * as HttpClientRequest from 'effect/http/HttpClientRequest'
+import * as HttpClientResponse from 'effect/http/HttpClientResponse'
+import * as Schedule from 'effect/Schedule'
+import * as Schema from 'effect/Schema'
+import { createHash } from 'node:crypto'
+import { mkdir, readFile, rename, writeFile } from 'node:fs/promises'
+import { homedir } from 'node:os'
+import path from 'node:path'
+import { arch } from 'node:process'
+import { gunzipSync } from 'node:zlib'
+
+const REPOSITORY = 'allaboutapps/integresql'
+
+const V1_1_0_LAYER_DIGESTS: Readonly> = {
+ x64: 'sha256:8e4268615a42a8e45def4ecc7397241c9b598c3731e4c0a0c951c39e0c48093c',
+ arm64: 'sha256:77ba01934c00eb411a42df97af551d904dcc02b8d3db1027101378923f32aab3',
+}
+
+const CACHE = path.join(homedir(), '.cache', 'agent', 'integresql-layers')
+
+const BLOCK = 512
+
+export class IntegresqlUnavailable extends Data.TaggedError('IntegresqlUnavailable')<{ readonly reason: string }> {
+ override get message(): string {
+ return `the pinned IntegreSQL binary is unavailable: ${this.reason}`
+ }
+}
+
+const unavailable = (cause: unknown) =>
+ new IntegresqlUnavailable({ reason: cause instanceof Error ? cause.message : String(cause) })
+
+const digestOf = (bytes: Uint8Array): string => `sha256:${createHash('sha256').update(bytes).digest('hex')}`
+
+const entryOf = (archive: Uint8Array, name: string): Uint8Array | undefined => {
+ let offset = 0
+ while (offset + BLOCK <= archive.length) {
+ const header = Buffer.from(archive.subarray(offset, offset + BLOCK))
+ const nameEnd = header.indexOf(0)
+ const entry = header.toString('latin1', 0, nameEnd === -1 || nameEnd > 100 ? 100 : nameEnd).replace(/^\.\//, '')
+ if (entry === '') return undefined
+ const size = Number.parseInt(header.toString('latin1', 124, 136).replace(/\0/g, '').trim(), 8)
+ const data = offset + BLOCK
+ if (entry === name) return archive.subarray(data, data + size)
+ offset = data + Math.ceil(size / BLOCK) * BLOCK
+ }
+ return undefined
+}
+
+const TokenAnswer = Schema.Struct({ token: Schema.String })
+
+const pulled = Effect.fnUntraced(
+ function*(digest: string) {
+ const client = yield* HttpClient.HttpClient
+ const { token } = yield* client.get(`https://ghcr.io/token?scope=repository:${REPOSITORY}:pull`).pipe(
+ Effect.flatMap(HttpClientResponse.filterStatusOk),
+ Effect.flatMap(HttpClientResponse.schemaBodyJson(TokenAnswer)),
+ )
+ const response = yield* client.execute(
+ HttpClientRequest.get(`https://ghcr.io/v2/${REPOSITORY}/blobs/${digest}`).pipe(
+ HttpClientRequest.bearerToken(token),
+ ),
+ ).pipe(Effect.flatMap(HttpClientResponse.filterStatusOk))
+ return new Uint8Array(yield* response.arrayBuffer)
+ },
+ Effect.retry({ schedule: Schedule.exponential('1 second'), times: 4 }),
+ Effect.mapError(unavailable),
+)
+
+const cached = (file: string) =>
+ Effect.promise(() => readFile(file).then((bytes) => new Uint8Array(bytes), () => undefined))
+
+const kept = (file: string, blob: Uint8Array) =>
+ Effect.tryPromise({
+ try: async () => {
+ await mkdir(CACHE, { recursive: true })
+ const staged = `${file}.${process.pid}.partial`
+ await writeFile(staged, blob)
+ await rename(staged, file)
+ },
+ catch: unavailable,
+ })
+
+const layerOf = Effect.fnUntraced(function*(digest: string) {
+ const file = path.join(CACHE, digest.slice('sha256:'.length))
+ const hit = yield* cached(file)
+ if (hit && digestOf(hit) === digest) return hit
+ const blob = yield* pulled(digest)
+ if (digestOf(blob) !== digest) {
+ return yield* new IntegresqlUnavailable({ reason: `the pulled layer is ${digestOf(blob)}, not ${digest}` })
+ }
+ yield* kept(file, blob)
+ return blob
+})
+
+export const integresqlBinary = Effect.gen(function*() {
+ const digest = V1_1_0_LAYER_DIGESTS[arch]
+ if (!digest) return yield* new IntegresqlUnavailable({ reason: `no pinned layer for ${arch}` })
+ const blob = yield* layerOf(digest)
+ const archive = yield* Effect.try({ try: () => gunzipSync(blob), catch: unavailable })
+ const binary = entryOf(archive, 'integresql')
+ if (!binary) return yield* new IntegresqlUnavailable({ reason: `layer ${digest} holds no /integresql` })
+ return binary
+})
diff --git a/packages/storage-postgres/test/postgres-server.ts b/packages/storage-postgres/test/postgres-server.ts
new file mode 100644
index 00000000..9b89dafc
--- /dev/null
+++ b/packages/storage-postgres/test/postgres-server.ts
@@ -0,0 +1,167 @@
+import * as NodeCrypto from '@effect/platform-node/NodeCrypto'
+import { layer as nodeServicesLayer } from '@effect/platform-node/NodeServices'
+import { MicroVM } from '@systemfsoftware/effect-microsandbox'
+import { Readiness } from '@systemfsoftware/effect-readiness'
+import * as Data from 'effect/Data'
+import * as Effect from 'effect/Effect'
+import * as FetchHttpClient from 'effect/http/FetchHttpClient'
+import * as HttpClient from 'effect/http/HttpClient'
+import * as HttpClientRequest from 'effect/http/HttpClientRequest'
+import * as HttpClientResponse from 'effect/http/HttpClientResponse'
+import * as Layer from 'effect/Layer'
+import * as Schedule from 'effect/Schedule'
+import * as Schema from 'effect/Schema'
+import * as Scope from 'effect/Scope'
+import { integresqlBinary } from './integresql-binary.js'
+
+/**
+ * The house integration-database pattern: Postgres and IntegreSQL boot inside a hardware-isolated
+ * microVM on the runner's KVM device, so the suite needs no Docker daemon, no service container and
+ * no shared server. Each case checks out its own database from IntegreSQL and returns it afterwards.
+ */
+const POSTGRES = {
+ image:
+ 'mirror.gcr.io/library/postgres:17-bookworm@sha256:40865bc877a289da75963d97d72b59633f639fc5af7a4e856bfa3714cae5b536',
+ binaries: '/usr/lib/postgresql/17/bin',
+}
+
+const POSTGRES_PORT = 5432
+const INTEGRESQL_PORT = 5000
+const TEMPLATE = 'empty'
+const GUEST = '/opt/database-server'
+const RAM = '/dev/shm/database-server'
+const READY = 'database server ready'
+const FAILED = 'database server failed'
+const STATUS = `${RAM}/boot-status`
+
+const bootScript = (binaries: string) =>
+ `#!/bin/bash
+set -eu
+trap 'code=$?; [ "$code" -eq 0 ] || { [ -e ${STATUS} ] || printf "boot.sh exited with status %s" "$code" > ${STATUS} || true; echo "${FAILED}"; }' EXIT
+mkdir -p ${RAM}
+if [ "$(id -u)" -eq 0 ]; then chown postgres ${RAM}; as() { gosu postgres "$@"; }; else as() { "$@"; }; fi
+as ${binaries}/initdb --no-sync --encoding=UTF8 --locale=C.UTF-8 --username=postgres --auth=trust -D ${RAM}/data > ${RAM}/initdb.log 2>&1
+echo 'host all all 0.0.0.0/0 trust' >> ${RAM}/data/pg_hba.conf
+as ${binaries}/pg_ctl -D ${RAM}/data -l ${RAM}/postgres.log -w -t 60 -o "-c listen_addresses=* -c port=${POSTGRES_PORT} -c max_connections=200 -c fsync=off -c synchronous_commit=off -c full_page_writes=off" start
+cp ${GUEST}/integresql /tmp/integresql
+chmod +x /tmp/integresql
+INTEGRESQL_PORT=${INTEGRESQL_PORT} INTEGRESQL_PGHOST=127.0.0.1 INTEGRESQL_PGPORT=${POSTGRES_PORT} INTEGRESQL_PGUSER=postgres \\
+ INTEGRESQL_TEST_INITIAL_POOL_SIZE=2 INTEGRESQL_TEST_MAX_POOL_SIZE=8 /tmp/integresql > ${RAM}/integresql.log 2>&1 &
+server=$!
+until ( exec 3<>/dev/tcp/127.0.0.1/${INTEGRESQL_PORT} ) 2>/dev/null; do
+ kill -0 "$server" || { printf 'integresql exited' > ${STATUS}; exit 1; }
+ sleep 0.2
+done
+printf 'ready' > ${STATUS}
+echo '${READY}'
+wait "$server"
+`
+
+export class DatabaseServerFailed
+ extends Data.TaggedError('DatabaseServerFailed')<{ readonly step: string; readonly cause: unknown }>
+{
+ override get message(): string {
+ return `${this.step}: ${this.cause instanceof Error ? this.cause.message : String(this.cause)}`
+ }
+}
+
+interface ServerHandle {
+ readonly integresqlPort: number
+ readonly postgresPort: number
+ readonly vm: MicroVM.RunningVM
+}
+
+const guestFile = (vm: MicroVM.RunningVM, file: string) =>
+ MicroVM.exec(vm, 'cat', [file]).pipe(Effect.map(({ stdout, stderr }) => `${stdout}${stderr}`))
+
+const assertBooted = Effect.fnUntraced(function*(vm: MicroVM.RunningVM) {
+ const status = yield* guestFile(vm, STATUS)
+ if (status === 'ready') return
+ const logs = yield* Effect.all([
+ guestFile(vm, `${RAM}/initdb.log`),
+ guestFile(vm, `${RAM}/postgres.log`),
+ guestFile(vm, `${RAM}/integresql.log`),
+ ])
+ return yield* new DatabaseServerFailed({
+ step: 'boot the database server',
+ cause: `${status}\n${logs.join('\n')}`,
+ })
+})
+
+const templates = (port: number) => `http://127.0.0.1:${port}/api/v1/templates`
+
+const boot = Effect.gen(function*() {
+ const binary = yield* integresqlBinary
+ const vm = yield* MicroVM.spec(POSTGRES.image)
+ .withFiles({
+ [`${GUEST}/boot.sh`]: bootScript(POSTGRES.binaries),
+ [`${GUEST}/integresql`]: binary,
+ })
+ .withCommand(['bash', `${GUEST}/boot.sh`])
+ .withMemoryLimit(2048)
+ .withExposedPorts([INTEGRESQL_PORT, POSTGRES_PORT])
+ .withWaitStrategy(MicroVM.Wait.forLog(`${READY}|${FAILED}`))
+ .scoped
+ yield* assertBooted(vm)
+ const integresqlPort = yield* MicroVM.port(vm, INTEGRESQL_PORT)
+ const postgresPort = yield* MicroVM.port(vm, POSTGRES_PORT)
+ const client = (yield* HttpClient.HttpClient).pipe(HttpClient.filterStatusOk)
+ yield* client.execute(
+ HttpClientRequest.post(templates(integresqlPort)).pipe(
+ HttpClientRequest.bodyJsonUnsafe({ hash: TEMPLATE }),
+ ),
+ )
+ yield* client.execute(HttpClientRequest.put(`${templates(integresqlPort)}/${TEMPLATE}`))
+ return { integresqlPort, postgresPort, vm } satisfies ServerHandle
+})
+
+// The server outlives every case in the process, so its scope is created once and never closed; the
+// guest is torn down when the test process exits.
+let serverPromise: Promise | undefined
+
+const server = () =>
+ serverPromise ??= Effect.runPromise(
+ boot.pipe(
+ Effect.provideService(Scope.Scope, Scope.makeUnsafe()),
+ Effect.provide(Layer.mergeAll(
+ nodeServicesLayer,
+ NodeCrypto.layerSecureRandom,
+ Readiness.NodeHostProber.layer,
+ FetchHttpClient.layer,
+ )),
+ ),
+ )
+
+const TestDatabase = Schema.Struct({
+ id: Schema.Int,
+ database: Schema.Struct({ config: Schema.Struct({ database: Schema.String }) }),
+})
+
+/** Check out one database for the duration of `use`, then hand it back to IntegreSQL. */
+export const withIntegresqlDatabase = (
+ use: (url: string) => Effect.Effect,
+): Effect.Effect =>
+ Effect.scoped(Effect.gen(function*() {
+ const { integresqlPort, postgresPort } = yield* Effect.tryPromise({
+ try: server,
+ catch: (cause) => new DatabaseServerFailed({ step: 'start the database server', cause }),
+ })
+ const client = (yield* HttpClient.HttpClient).pipe(HttpClient.filterStatusOk)
+ const tests = `${templates(integresqlPort)}/${TEMPLATE}/tests`
+ const checkedOut = yield* Effect.acquireRelease(
+ client.get(tests).pipe(
+ Effect.flatMap(HttpClientResponse.schemaBodyJson(TestDatabase)),
+ Effect.mapError((cause) => new DatabaseServerFailed({ step: 'check out a database', cause })),
+ ),
+ // A case may finish with pooled connections still open; IntegreSQL can only recreate a
+ // database nothing is connected to, so the hand-back retries until the pool drains.
+ ({ id }) =>
+ client.execute(HttpClientRequest.post(`${tests}/${id}/recreate`)).pipe(
+ Effect.retry({ schedule: Schedule.spaced('100 millis'), times: 50 }),
+ Effect.orDie,
+ ),
+ )
+ return yield* use(
+ `postgres://postgres@127.0.0.1:${postgresPort}/${checkedOut.database.config.database}`,
+ )
+ })).pipe(Effect.provide(FetchHttpClient.layer))
diff --git a/packages/storage-postgres/vitest.config.ts b/packages/storage-postgres/vitest.config.ts
index 071cd2d4..235b2b93 100644
--- a/packages/storage-postgres/vitest.config.ts
+++ b/packages/storage-postgres/vitest.config.ts
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
cache: false,
+ maxWorkers: 1,
silent: 'passed-only',
testTimeout: 60_000,
},
diff --git a/packages/testing/package.json b/packages/testing/package.json
index 32a7ce88..2b8c8cfc 100644
--- a/packages/testing/package.json
+++ b/packages/testing/package.json
@@ -77,6 +77,8 @@
"@systemfsoftware/agent-storage-memory": "workspace:*",
"@systemfsoftware/agent-storage-postgres": "workspace:*",
"@systemfsoftware/agent-storage-sqlite": "workspace:*",
+ "@systemfsoftware/effect-microsandbox": "catalog:",
+ "@systemfsoftware/effect-readiness": "catalog:",
"effect": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:",
diff --git a/packages/testing/test/certification-postgres.test.ts b/packages/testing/test/certification-postgres.test.ts
index 8ee68e71..daff0251 100644
--- a/packages/testing/test/certification-postgres.test.ts
+++ b/packages/testing/test/certification-postgres.test.ts
@@ -7,28 +7,40 @@ import * as Effect from 'effect/Effect'
import * as Layer from 'effect/Layer'
import * as Redacted from 'effect/Redacted'
-/** Keep coordinator checks outside the adapter package to avoid a storage-postgres -> testing cycle. */
-const adminUrl = process.env.EFFECT_AGENT_TEST_POSTGRES_URL ??
- 'postgres://postgres:postgres@localhost:55432/effect_agent'
+import { withIntegresqlDatabase } from './postgres-server.js'
+
+/**
+ * Keep coordinator checks outside the adapter package to avoid a storage-postgres -> testing cycle.
+ * Unset, the suite boots Postgres in the house microVM and checks a database out of IntegreSQL.
+ */
+const configuredUrl = process.env.EFFECT_AGENT_TEST_POSTGRES_URL
let databaseCounter = 0
-const admin = (statement: string) =>
+const admin = (url: string, statement: string) =>
Effect.flatMap(PgClient.PgClient, (sql) => sql.unsafe(statement)).pipe(
- Effect.provide(PgClient.layer({ url: Redacted.make(adminUrl), maxConnections: 1 })),
+ Effect.provide(PgClient.layer({ url: Redacted.make(url), maxConnections: 1 })),
Effect.orDie,
)
-/** A database per run; `WITH (FORCE)` ends any pooled connection the run left open. */
+/** A database per run from IntegreSQL, or one this suite owns when a server is configured. */
const withTemporaryDatabase = (
use: (url: string) => Effect.Effect,
+): Effect.Effect =>
+ configuredUrl === undefined
+ ? withIntegresqlDatabase(use).pipe(Effect.orDie)
+ : withOwnedDatabase(configuredUrl, use)
+
+const withOwnedDatabase = (
+ adminUrl: string,
+ use: (url: string) => Effect.Effect,
): Effect.Effect =>
Effect.acquireUseRelease(
Effect.sync(() => {
databaseCounter = databaseCounter + 1
return `effect_agent_certification_${process.pid}_${databaseCounter}`
- }).pipe(Effect.tap((database) => admin(`CREATE DATABASE ${database}`))),
+ }).pipe(Effect.tap((database) => admin(adminUrl, `CREATE DATABASE ${database}`))),
(database) => {
const url = new URL(adminUrl)
@@ -36,7 +48,7 @@ const withTemporaryDatabase = (
return use(url.toString())
},
- (database) => admin(`DROP DATABASE IF EXISTS ${database} WITH (FORCE)`).pipe(Effect.ignore),
+ (database) => admin(adminUrl, `DROP DATABASE IF EXISTS ${database} WITH (FORCE)`).pipe(Effect.ignore),
)
const combinedAdapters = (url: string) =>
diff --git a/packages/testing/test/integresql-binary.ts b/packages/testing/test/integresql-binary.ts
new file mode 100644
index 00000000..17c99ca5
--- /dev/null
+++ b/packages/testing/test/integresql-binary.ts
@@ -0,0 +1,106 @@
+import * as Data from 'effect/Data'
+import * as Effect from 'effect/Effect'
+import * as HttpClient from 'effect/http/HttpClient'
+import * as HttpClientRequest from 'effect/http/HttpClientRequest'
+import * as HttpClientResponse from 'effect/http/HttpClientResponse'
+import * as Schedule from 'effect/Schedule'
+import * as Schema from 'effect/Schema'
+import { createHash } from 'node:crypto'
+import { mkdir, readFile, rename, writeFile } from 'node:fs/promises'
+import { homedir } from 'node:os'
+import path from 'node:path'
+import { arch } from 'node:process'
+import { gunzipSync } from 'node:zlib'
+
+const REPOSITORY = 'allaboutapps/integresql'
+
+const V1_1_0_LAYER_DIGESTS: Readonly> = {
+ x64: 'sha256:8e4268615a42a8e45def4ecc7397241c9b598c3731e4c0a0c951c39e0c48093c',
+ arm64: 'sha256:77ba01934c00eb411a42df97af551d904dcc02b8d3db1027101378923f32aab3',
+}
+
+const CACHE = path.join(homedir(), '.cache', 'agent', 'integresql-layers')
+
+const BLOCK = 512
+
+export class IntegresqlUnavailable extends Data.TaggedError('IntegresqlUnavailable')<{ readonly reason: string }> {
+ override get message(): string {
+ return `the pinned IntegreSQL binary is unavailable: ${this.reason}`
+ }
+}
+
+const unavailable = (cause: unknown) =>
+ new IntegresqlUnavailable({ reason: cause instanceof Error ? cause.message : String(cause) })
+
+const digestOf = (bytes: Uint8Array): string => `sha256:${createHash('sha256').update(bytes).digest('hex')}`
+
+const entryOf = (archive: Uint8Array, name: string): Uint8Array | undefined => {
+ let offset = 0
+ while (offset + BLOCK <= archive.length) {
+ const header = Buffer.from(archive.subarray(offset, offset + BLOCK))
+ const nameEnd = header.indexOf(0)
+ const entry = header.toString('latin1', 0, nameEnd === -1 || nameEnd > 100 ? 100 : nameEnd).replace(/^\.\//, '')
+ if (entry === '') return undefined
+ const size = Number.parseInt(header.toString('latin1', 124, 136).replace(/\0/g, '').trim(), 8)
+ const data = offset + BLOCK
+ if (entry === name) return archive.subarray(data, data + size)
+ offset = data + Math.ceil(size / BLOCK) * BLOCK
+ }
+ return undefined
+}
+
+const TokenAnswer = Schema.Struct({ token: Schema.String })
+
+const pulled = Effect.fnUntraced(
+ function*(digest: string) {
+ const client = yield* HttpClient.HttpClient
+ const { token } = yield* client.get(`https://ghcr.io/token?scope=repository:${REPOSITORY}:pull`).pipe(
+ Effect.flatMap(HttpClientResponse.filterStatusOk),
+ Effect.flatMap(HttpClientResponse.schemaBodyJson(TokenAnswer)),
+ )
+ const response = yield* client.execute(
+ HttpClientRequest.get(`https://ghcr.io/v2/${REPOSITORY}/blobs/${digest}`).pipe(
+ HttpClientRequest.bearerToken(token),
+ ),
+ ).pipe(Effect.flatMap(HttpClientResponse.filterStatusOk))
+ return new Uint8Array(yield* response.arrayBuffer)
+ },
+ Effect.retry({ schedule: Schedule.exponential('1 second'), times: 4 }),
+ Effect.mapError(unavailable),
+)
+
+const cached = (file: string) =>
+ Effect.promise(() => readFile(file).then((bytes) => new Uint8Array(bytes), () => undefined))
+
+const kept = (file: string, blob: Uint8Array) =>
+ Effect.tryPromise({
+ try: async () => {
+ await mkdir(CACHE, { recursive: true })
+ const staged = `${file}.${process.pid}.partial`
+ await writeFile(staged, blob)
+ await rename(staged, file)
+ },
+ catch: unavailable,
+ })
+
+const layerOf = Effect.fnUntraced(function*(digest: string) {
+ const file = path.join(CACHE, digest.slice('sha256:'.length))
+ const hit = yield* cached(file)
+ if (hit && digestOf(hit) === digest) return hit
+ const blob = yield* pulled(digest)
+ if (digestOf(blob) !== digest) {
+ return yield* new IntegresqlUnavailable({ reason: `the pulled layer is ${digestOf(blob)}, not ${digest}` })
+ }
+ yield* kept(file, blob)
+ return blob
+})
+
+export const integresqlBinary = Effect.gen(function*() {
+ const digest = V1_1_0_LAYER_DIGESTS[arch]
+ if (!digest) return yield* new IntegresqlUnavailable({ reason: `no pinned layer for ${arch}` })
+ const blob = yield* layerOf(digest)
+ const archive = yield* Effect.try({ try: () => gunzipSync(blob), catch: unavailable })
+ const binary = entryOf(archive, 'integresql')
+ if (!binary) return yield* new IntegresqlUnavailable({ reason: `layer ${digest} holds no /integresql` })
+ return binary
+})
diff --git a/packages/testing/test/postgres-server.ts b/packages/testing/test/postgres-server.ts
new file mode 100644
index 00000000..9b89dafc
--- /dev/null
+++ b/packages/testing/test/postgres-server.ts
@@ -0,0 +1,167 @@
+import * as NodeCrypto from '@effect/platform-node/NodeCrypto'
+import { layer as nodeServicesLayer } from '@effect/platform-node/NodeServices'
+import { MicroVM } from '@systemfsoftware/effect-microsandbox'
+import { Readiness } from '@systemfsoftware/effect-readiness'
+import * as Data from 'effect/Data'
+import * as Effect from 'effect/Effect'
+import * as FetchHttpClient from 'effect/http/FetchHttpClient'
+import * as HttpClient from 'effect/http/HttpClient'
+import * as HttpClientRequest from 'effect/http/HttpClientRequest'
+import * as HttpClientResponse from 'effect/http/HttpClientResponse'
+import * as Layer from 'effect/Layer'
+import * as Schedule from 'effect/Schedule'
+import * as Schema from 'effect/Schema'
+import * as Scope from 'effect/Scope'
+import { integresqlBinary } from './integresql-binary.js'
+
+/**
+ * The house integration-database pattern: Postgres and IntegreSQL boot inside a hardware-isolated
+ * microVM on the runner's KVM device, so the suite needs no Docker daemon, no service container and
+ * no shared server. Each case checks out its own database from IntegreSQL and returns it afterwards.
+ */
+const POSTGRES = {
+ image:
+ 'mirror.gcr.io/library/postgres:17-bookworm@sha256:40865bc877a289da75963d97d72b59633f639fc5af7a4e856bfa3714cae5b536',
+ binaries: '/usr/lib/postgresql/17/bin',
+}
+
+const POSTGRES_PORT = 5432
+const INTEGRESQL_PORT = 5000
+const TEMPLATE = 'empty'
+const GUEST = '/opt/database-server'
+const RAM = '/dev/shm/database-server'
+const READY = 'database server ready'
+const FAILED = 'database server failed'
+const STATUS = `${RAM}/boot-status`
+
+const bootScript = (binaries: string) =>
+ `#!/bin/bash
+set -eu
+trap 'code=$?; [ "$code" -eq 0 ] || { [ -e ${STATUS} ] || printf "boot.sh exited with status %s" "$code" > ${STATUS} || true; echo "${FAILED}"; }' EXIT
+mkdir -p ${RAM}
+if [ "$(id -u)" -eq 0 ]; then chown postgres ${RAM}; as() { gosu postgres "$@"; }; else as() { "$@"; }; fi
+as ${binaries}/initdb --no-sync --encoding=UTF8 --locale=C.UTF-8 --username=postgres --auth=trust -D ${RAM}/data > ${RAM}/initdb.log 2>&1
+echo 'host all all 0.0.0.0/0 trust' >> ${RAM}/data/pg_hba.conf
+as ${binaries}/pg_ctl -D ${RAM}/data -l ${RAM}/postgres.log -w -t 60 -o "-c listen_addresses=* -c port=${POSTGRES_PORT} -c max_connections=200 -c fsync=off -c synchronous_commit=off -c full_page_writes=off" start
+cp ${GUEST}/integresql /tmp/integresql
+chmod +x /tmp/integresql
+INTEGRESQL_PORT=${INTEGRESQL_PORT} INTEGRESQL_PGHOST=127.0.0.1 INTEGRESQL_PGPORT=${POSTGRES_PORT} INTEGRESQL_PGUSER=postgres \\
+ INTEGRESQL_TEST_INITIAL_POOL_SIZE=2 INTEGRESQL_TEST_MAX_POOL_SIZE=8 /tmp/integresql > ${RAM}/integresql.log 2>&1 &
+server=$!
+until ( exec 3<>/dev/tcp/127.0.0.1/${INTEGRESQL_PORT} ) 2>/dev/null; do
+ kill -0 "$server" || { printf 'integresql exited' > ${STATUS}; exit 1; }
+ sleep 0.2
+done
+printf 'ready' > ${STATUS}
+echo '${READY}'
+wait "$server"
+`
+
+export class DatabaseServerFailed
+ extends Data.TaggedError('DatabaseServerFailed')<{ readonly step: string; readonly cause: unknown }>
+{
+ override get message(): string {
+ return `${this.step}: ${this.cause instanceof Error ? this.cause.message : String(this.cause)}`
+ }
+}
+
+interface ServerHandle {
+ readonly integresqlPort: number
+ readonly postgresPort: number
+ readonly vm: MicroVM.RunningVM
+}
+
+const guestFile = (vm: MicroVM.RunningVM, file: string) =>
+ MicroVM.exec(vm, 'cat', [file]).pipe(Effect.map(({ stdout, stderr }) => `${stdout}${stderr}`))
+
+const assertBooted = Effect.fnUntraced(function*(vm: MicroVM.RunningVM) {
+ const status = yield* guestFile(vm, STATUS)
+ if (status === 'ready') return
+ const logs = yield* Effect.all([
+ guestFile(vm, `${RAM}/initdb.log`),
+ guestFile(vm, `${RAM}/postgres.log`),
+ guestFile(vm, `${RAM}/integresql.log`),
+ ])
+ return yield* new DatabaseServerFailed({
+ step: 'boot the database server',
+ cause: `${status}\n${logs.join('\n')}`,
+ })
+})
+
+const templates = (port: number) => `http://127.0.0.1:${port}/api/v1/templates`
+
+const boot = Effect.gen(function*() {
+ const binary = yield* integresqlBinary
+ const vm = yield* MicroVM.spec(POSTGRES.image)
+ .withFiles({
+ [`${GUEST}/boot.sh`]: bootScript(POSTGRES.binaries),
+ [`${GUEST}/integresql`]: binary,
+ })
+ .withCommand(['bash', `${GUEST}/boot.sh`])
+ .withMemoryLimit(2048)
+ .withExposedPorts([INTEGRESQL_PORT, POSTGRES_PORT])
+ .withWaitStrategy(MicroVM.Wait.forLog(`${READY}|${FAILED}`))
+ .scoped
+ yield* assertBooted(vm)
+ const integresqlPort = yield* MicroVM.port(vm, INTEGRESQL_PORT)
+ const postgresPort = yield* MicroVM.port(vm, POSTGRES_PORT)
+ const client = (yield* HttpClient.HttpClient).pipe(HttpClient.filterStatusOk)
+ yield* client.execute(
+ HttpClientRequest.post(templates(integresqlPort)).pipe(
+ HttpClientRequest.bodyJsonUnsafe({ hash: TEMPLATE }),
+ ),
+ )
+ yield* client.execute(HttpClientRequest.put(`${templates(integresqlPort)}/${TEMPLATE}`))
+ return { integresqlPort, postgresPort, vm } satisfies ServerHandle
+})
+
+// The server outlives every case in the process, so its scope is created once and never closed; the
+// guest is torn down when the test process exits.
+let serverPromise: Promise | undefined
+
+const server = () =>
+ serverPromise ??= Effect.runPromise(
+ boot.pipe(
+ Effect.provideService(Scope.Scope, Scope.makeUnsafe()),
+ Effect.provide(Layer.mergeAll(
+ nodeServicesLayer,
+ NodeCrypto.layerSecureRandom,
+ Readiness.NodeHostProber.layer,
+ FetchHttpClient.layer,
+ )),
+ ),
+ )
+
+const TestDatabase = Schema.Struct({
+ id: Schema.Int,
+ database: Schema.Struct({ config: Schema.Struct({ database: Schema.String }) }),
+})
+
+/** Check out one database for the duration of `use`, then hand it back to IntegreSQL. */
+export const withIntegresqlDatabase = (
+ use: (url: string) => Effect.Effect,
+): Effect.Effect =>
+ Effect.scoped(Effect.gen(function*() {
+ const { integresqlPort, postgresPort } = yield* Effect.tryPromise({
+ try: server,
+ catch: (cause) => new DatabaseServerFailed({ step: 'start the database server', cause }),
+ })
+ const client = (yield* HttpClient.HttpClient).pipe(HttpClient.filterStatusOk)
+ const tests = `${templates(integresqlPort)}/${TEMPLATE}/tests`
+ const checkedOut = yield* Effect.acquireRelease(
+ client.get(tests).pipe(
+ Effect.flatMap(HttpClientResponse.schemaBodyJson(TestDatabase)),
+ Effect.mapError((cause) => new DatabaseServerFailed({ step: 'check out a database', cause })),
+ ),
+ // A case may finish with pooled connections still open; IntegreSQL can only recreate a
+ // database nothing is connected to, so the hand-back retries until the pool drains.
+ ({ id }) =>
+ client.execute(HttpClientRequest.post(`${tests}/${id}/recreate`)).pipe(
+ Effect.retry({ schedule: Schedule.spaced('100 millis'), times: 50 }),
+ Effect.orDie,
+ ),
+ )
+ return yield* use(
+ `postgres://postgres@127.0.0.1:${postgresPort}/${checkedOut.database.config.database}`,
+ )
+ })).pipe(Effect.provide(FetchHttpClient.layer))
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 870b5e24..a906c88b 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -203,6 +203,12 @@ catalogs:
'@effect/tsgo':
specifier: 0.70.0
version: 0.70.0
+ '@systemfsoftware/effect-microsandbox':
+ specifier: ^6.1.0
+ version: 6.1.0
+ '@systemfsoftware/effect-readiness':
+ specifier: ^1.1.4
+ version: 1.1.4
'@types/node':
specifier: 26.1.2
version: 26.1.2
@@ -645,6 +651,12 @@ importers:
'@effect/vitest':
specifier: 4.1.2
version: 4.1.2(effect@4.1.2)(vitest@5.0.3(@types/node@26.1.2)(vite@8.3.8(@types/node@26.1.2)(esbuild@0.28.1)(jiti@2.7.0)(yaml@2.9.1)))
+ '@systemfsoftware/effect-microsandbox':
+ specifier: 'catalog:'
+ version: 6.1.0(effect@4.1.2)(redis@6.3.1)(typescript@7.0.2)
+ '@systemfsoftware/effect-readiness':
+ specifier: 'catalog:'
+ version: 1.1.4(effect@4.1.2)(redis@6.3.1)(typescript@7.0.2)
effect:
specifier: 4.1.2
version: 4.1.2
@@ -756,6 +768,12 @@ importers:
'@systemfsoftware/agent-storage-sqlite':
specifier: workspace:*
version: link:../storage-sqlite
+ '@systemfsoftware/effect-microsandbox':
+ specifier: 'catalog:'
+ version: 6.1.0(effect@4.1.2)(redis@6.3.1)(typescript@7.0.2)
+ '@systemfsoftware/effect-readiness':
+ specifier: 'catalog:'
+ version: 1.1.4(effect@4.1.2)(redis@6.3.1)(typescript@7.0.2)
effect:
specifier: 4.1.2
version: 4.1.2
@@ -1961,6 +1979,9 @@ packages:
'@mermaid-js/parser@1.2.1':
resolution: {integrity: sha512-n12NohV3mrUyUL2o93IgG/ifeW9FTyeJn3zDxkhwa8MJ9Fxg3HQMlA3RiGmD/3UnJvheztkjjQAjA2T4LmUcpw==}
+ '@microsandbox/types@0.7.8':
+ resolution: {integrity: sha512-GCLuiSbTXU/5s8/VhyQzRc8AtDyz4uaIk3fP0GbWAPvj2xJfR7rpUr51UYZIFd9ONwAqa7XEfpyr8jnlFInkhA==}
+
'@napi-rs/wasm-runtime@1.2.6':
resolution: {integrity: sha512-mRyDmEw9/fCDXCGfL1sbgIw/GUK0PVxRW4YwgPN61F3LQ+fSyoBFarJVzgGyhF6kRzEQZ0FejDqm4WLXSeqQmw==}
engines: {node: ^20.19.0 || ^22.13.0 || >=23.5.0}
@@ -2711,6 +2732,55 @@ packages:
'@speed-highlight/core@1.2.24':
resolution: {integrity: sha512-qeW2e1l78afw8VhRPfPQ1Gjj+KU5XFQ/OFV5ti6eTa9bruO7mJyZtA4vw0ofqmA3tKCkROE9xLk3VZoeRc98nw==}
+ '@superradcompany/microsandbox-darwin-arm64@0.7.8':
+ resolution: {integrity: sha512-WoTlB2b06o32AXW3D3Xp6GLiSoAXGNqNikbakA/RP2Uqj2Z8mfoDZ7mYKONLG7PXUAWu/vTTqJkOtVt8JFEWvA==}
+ engines: {node: '>= 22'}
+ cpu: [arm64]
+ os: [darwin]
+
+ '@superradcompany/microsandbox-linux-arm64-gnu@0.7.8':
+ resolution: {integrity: sha512-NRm8GVXlgoPsLYX8BovMTwg4oNWiT0EZp34+6zM7s7slhCbv3TItebbg6urKj8yqKoLP1T+OHH/7Y/RnD9omZw==}
+ engines: {node: '>= 22'}
+ cpu: [arm64]
+ os: [linux]
+ libc: [glibc]
+
+ '@superradcompany/microsandbox-linux-x64-gnu@0.7.8':
+ resolution: {integrity: sha512-4AnLhlDSvgzQPTrKcd6kCpCpgPWq275sGWTy7tg1deo42lU0PXKtwnaUlBx7uBdQO4YFIGfIx0T8lgsGO9h5EA==}
+ engines: {node: '>= 22'}
+ cpu: [x64]
+ os: [linux]
+ libc: [glibc]
+
+ '@superradcompany/microsandbox-win32-arm64-msvc@0.7.8':
+ resolution: {integrity: sha512-wwXD/B9JwmyDAhrkX2V4L4VHVumDK1JbMnUFTOuNCoozyeNV4fogL+BziINp3HeInBTbKOJrAI7+A8kTawKfPA==}
+ engines: {node: '>= 22'}
+ cpu: [arm64]
+ os: [win32]
+
+ '@superradcompany/microsandbox-win32-x64-msvc@0.7.8':
+ resolution: {integrity: sha512-m11kPzyaid/DMXK5kJRvDZEGkdlvndmOzfjNjfhqpL+LFQssnJgQ2WSyYfBQMrHj17pRfDkDxqwZPr9iXZoSMw==}
+ engines: {node: '>= 22'}
+ cpu: [x64]
+ os: [win32]
+
+ '@systemfsoftware/effect-cell-types@12.2.4':
+ resolution: {integrity: sha512-ZOQEB320yvtbJ4bw9+4q6MsDNotZPyDW+cD7RnAjVyAEKUv+RDt89wW5DtmHg4EhywV5VdAsUaBQdd/ochpjBw==}
+ peerDependencies:
+ effect: 4.1.2
+
+ '@systemfsoftware/effect-microsandbox@6.1.0':
+ resolution: {integrity: sha512-YTeMvbwzVdz0FyKXRKo0IqXIWz7P5NKLVu9fMTEiE69sKyh1qvC20ZOd42QWGOBaxAvuE4rp3BNVR2TkZnOBwQ==}
+ peerDependencies:
+ effect: 4.1.2
+ typescript: '>=7.0.0'
+
+ '@systemfsoftware/effect-readiness@1.1.4':
+ resolution: {integrity: sha512-DVoty5PIXkr6ez5jE9a2Wu3kuK+mUlCNyTxBohPxtSPrncdTal6+syvrr2b7ssq0jMus/vqRynwAJr8GglKO9A==}
+ peerDependencies:
+ effect: 4.1.2
+ typescript: '>=7.0.0'
+
'@systemfsoftware/oxlint-config-cell-architecture@6.0.5':
resolution: {integrity: sha512-rju0BG6XXU81WZrfzeOIHYEAkLGFKNf3AoeM7xaq3/b59DrGFQWFUlpDu8W9IcrjbKCiE2f2lOdELJvjwhoVMQ==}
peerDependencies:
@@ -4310,6 +4380,11 @@ packages:
resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==}
engines: {node: '>=8.6'}
+ microsandbox@0.7.8:
+ resolution: {integrity: sha512-bUll2JNeVhAdvtlemsD5rNkVpLU0KQSXVpuSjXFmkG6Z52Z2ZL9sP8hAdFT8pIGoEPLj+OB9ohgFEPsJgBVkFg==}
+ engines: {node: '>= 22'}
+ hasBin: true
+
mimic-function@5.0.1:
resolution: {integrity: sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==}
engines: {node: '>=18'}
@@ -6045,6 +6120,8 @@ snapshots:
dependencies:
'@chevrotain/types': 11.1.2
+ '@microsandbox/types@0.7.8': {}
+
'@napi-rs/wasm-runtime@1.2.6(@emnapi/core@2.0.0-beta.2)(@emnapi/runtime@2.0.0-beta.2)':
dependencies:
'@emnapi/core': 2.0.0-beta.2
@@ -6632,6 +6709,49 @@ snapshots:
'@speed-highlight/core@1.2.24': {}
+ '@superradcompany/microsandbox-darwin-arm64@0.7.8':
+ optional: true
+
+ '@superradcompany/microsandbox-linux-arm64-gnu@0.7.8':
+ optional: true
+
+ '@superradcompany/microsandbox-linux-x64-gnu@0.7.8':
+ optional: true
+
+ '@superradcompany/microsandbox-win32-arm64-msvc@0.7.8':
+ optional: true
+
+ '@superradcompany/microsandbox-win32-x64-msvc@0.7.8':
+ optional: true
+
+ '@systemfsoftware/effect-cell-types@12.2.4(effect@4.1.2)':
+ dependencies:
+ effect: 4.1.2
+
+ '@systemfsoftware/effect-microsandbox@6.1.0(effect@4.1.2)(redis@6.3.1)(typescript@7.0.2)':
+ dependencies:
+ '@effect/platform-node': 4.1.2(effect@4.1.2)(redis@6.3.1)
+ '@systemfsoftware/effect-cell-types': 12.2.4(effect@4.1.2)
+ '@systemfsoftware/effect-readiness': 1.1.4(effect@4.1.2)(redis@6.3.1)(typescript@7.0.2)
+ effect: 4.1.2
+ microsandbox: 0.7.8
+ typescript: 7.0.2
+ transitivePeerDependencies:
+ - bufferutil
+ - redis
+ - utf-8-validate
+
+ '@systemfsoftware/effect-readiness@1.1.4(effect@4.1.2)(redis@6.3.1)(typescript@7.0.2)':
+ dependencies:
+ '@effect/platform-node': 4.1.2(effect@4.1.2)(redis@6.3.1)
+ '@systemfsoftware/effect-cell-types': 12.2.4(effect@4.1.2)
+ effect: 4.1.2
+ typescript: 7.0.2
+ transitivePeerDependencies:
+ - bufferutil
+ - redis
+ - utf-8-validate
+
'@systemfsoftware/oxlint-config-cell-architecture@6.0.5(effect@4.1.2)(oxlint@1.93.0(oxlint-tsgolint@7.0.2007))(typescript@7.0.2)':
dependencies:
'@systemfsoftware/oxlint-config-rule-authoring': 3.0.3(oxlint@1.93.0(oxlint-tsgolint@7.0.2007))(typescript@7.0.2)
@@ -8437,6 +8557,16 @@ snapshots:
braces: 3.0.3
picomatch: 2.3.2
+ microsandbox@0.7.8:
+ dependencies:
+ '@microsandbox/types': 0.7.8
+ optionalDependencies:
+ '@superradcompany/microsandbox-darwin-arm64': 0.7.8
+ '@superradcompany/microsandbox-linux-arm64-gnu': 0.7.8
+ '@superradcompany/microsandbox-linux-x64-gnu': 0.7.8
+ '@superradcompany/microsandbox-win32-arm64-msvc': 0.7.8
+ '@superradcompany/microsandbox-win32-x64-msvc': 0.7.8
+
mimic-function@5.0.1: {}
miniflare@5.20260811.1-alpha:
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index 425eac60..56dafc25 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -40,6 +40,8 @@ catalog:
"@effect/sql-d1": "4.1.2"
"@effect/sql-pg": "4.1.2"
"@effect/sql-sqlite-do": "4.1.2"
+ "@systemfsoftware/effect-microsandbox": "^6.1.0"
+ "@systemfsoftware/effect-readiness": "^1.1.4"
"@types/react": "19.2.17"
"@types/react-dom": "19.2.3"
"class-variance-authority": "0.7.1"