Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/conformance/results.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ The native engine column is from `npm run test:native` on the same host (29 Oct

Every column above is one local run on macOS arm64. CI runs the Wrangler and native suites on Ubuntu x64 (Node 22) on every change, and builds the linux/amd64 Docker image and checks that `sobjects` and `celld` start in it; it does not run `test:celld` or `test:cloudflare`, and it records no results. Linux arm64 has no conformance evidence beyond the Compose stack on Docker Desktop. Treat the table as macOS arm64 evidence plus unrecorded Ubuntu x64 CI coverage, not as a cross-platform claim.

## Soak

The two-week fault-injection soak that gates beta is separate from these
conformance runs. Its harness, procedure and current status are recorded in
[soak.md](soak.md); the 14-day run has not been completed.

## Not covered

This v0 run does not test hibernation on Wrangler, the alarm-across-restart check on Cloudflare or Wrangler, sockets across a cell move between nodes, all
Expand Down
39 changes: 39 additions & 0 deletions docs/conformance/soak-validation-2026-11-02.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"startedAt": "2026-11-02T08:26:15.941Z",
"hoursRun": 0.5,
"targetDays": 0.02,
"runnerStarts": 1,
"totals": {
"acked": 31802,
"failed": 62,
"verifications": 24,
"excusedLosses": 0,
"socketEchoes": 497,
"socketFailures": 0,
"socketConnects": 51,
"socketCloses": 51
},
"faults": {
"kill9": 3,
"sigterm": 3,
"wipe-restore": 2,
"crash-thread": 2
},
"violationCount": 0,
"recentViolations": [],
"trend": {
"engineRssMb": {
"firstHours": 203,
"last24h": 203
},
"engineFds": {
"firstHours": 225,
"last24h": 225
},
"p99Ms": {
"firstHours": 29,
"last24h": 29
},
"dataMb": 23
}
}
12 changes: 12 additions & 0 deletions docs/conformance/soak-validation-2026-11-02.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Soak report 2026-11-02

Running 0.5 h of 0.48 h. Violations: **0**.

- Writes acknowledged: 31802; failed (not acknowledged): 62; verifications: 24
- Losses excused by disk wipes (within the backup window): 0
- Socket echoes: 497; missed outside faults: 0
- Faults: kill9 3, sigterm 3, wipe-restore 2, crash-thread 2
- Engine RSS: 203 MB at start, 203 MB over the last 24 h
- Engine open files: 225 at start, 225 over the last 24 h
- Write p99: 29 ms at start, 29 ms over the last 24 h; data on disk 23 MB

81 changes: 81 additions & 0 deletions docs/conformance/soak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Soak

The M3 gate is conformance parity with celld on the Durable Objects suite, then
a two-week fault-injection soak before beta. Parity is recorded in
[results.md](results.md); this page is the soak's record.

The harness lives in [`packages/conformance/soak/`](../../packages/conformance/soak/README.md).
It drives the published CLI (`sobjects dev --engine native --threads 2
--backup-bucket … --backup-mode durable`) with SeaweedFS as the bucket, so it
needs no network and no external bucket. It checks that no acknowledged write is
lost, that every ledger passes `PRAGMA quick_check`, that five self-rearming
alarms keep firing, that five hibernatable WebSockets keep echoing, and that
engine memory, open files, data size and write latency stay flat. Faults are
injected about every 45 minutes: `kill9`, `sigterm`, `crash-thread`,
`bucket-outage`, `disk-full` and `wipe-restore`.

## Running it

Use a Linux host that stays up, with a small dedicated filesystem for the
engine's data so `disk-full` runs instead of being skipped. Build the image with
the release under test; there is no default, so a soak cannot silently test an
old CLI.

```sh
docker build --build-arg SOBJECTS_VERSION=$(npm view serverless-objects version) \
-t sobjects-soak packages/conformance/soak
mkdir -p /opt/sobjects-soak/state /opt/sobjects-soak/data
fallocate -l 2G /opt/sobjects-soak/data.img && mkfs.ext4 -q /opt/sobjects-soak/data.img
mount -o loop /opt/sobjects-soak/data.img /opt/sobjects-soak/data
docker run -d --name sobjects-soak --restart unless-stopped --network none \
--cpus 1 --memory 1280m --log-opt max-size=20m --log-opt max-file=3 \
-v /opt/sobjects-soak/data:/soak/data -v /opt/sobjects-soak/state:/soak/state sobjects-soak
```

The runner saves its journal every minute and resumes if the container restarts.
When the run reaches `SOAK_DAYS` it writes the final report, stops the engine and
the bucket, and exits 0, so a finished soak does not look like a container that
is still running.

## Recording the outcome

Copy `report.json` and the last `report-YYYY-MM-DD.md` from the state directory
into this folder, and record alongside them:

- the host (OS, architecture, CPU and memory, and whether the data directory was
its own small filesystem so `disk-full` ran)
- the CLI version under test and the image digest
- the settings (`SOAK_DAYS`, `SOAK_RATE`, `SOAK_FAULT_MINUTES`,
`SOAK_VERIFY_MINUTES`, `SOAK_THREADS`, `SOAK_BACKUP_MODE`, `SOAK_FAULTS`)
- the verdict: violations by kind, and any fault that was skipped

Any violation becomes its own issue.

## Status

**The 14-day run has not been completed.** The gate is open.

The harness itself was validated on 2 Nov 2026 with two 0.5-hour runs
(`SOAK_DAYS=0.02`, faults every 2 minutes) on macOS arm64 under Docker Desktop,
against `serverless-objects` 0.13.6. The second run's
[report.json](soak-validation-2026-11-02.json) and
[daily report](soak-validation-2026-11-02.md) are recorded here:

- 0 violations, 24 verifications, 31,802 acknowledged writes and 62 failed
(not acknowledged) writes
- 497 socket echoes and no missed echo outside a fault
- faults: `kill9` 3, `sigterm` 3, `wipe-restore` 2, `crash-thread` 2; the first
run also injected `bucket-outage`
- both `wipe-restore` faults lost nothing acknowledged and excused nothing, as
durable mode should
- engine RSS 203 MB and 225 open files at both ends of the run; write p99 29 ms
- `disk-full` was skipped in both runs: the data directory was not its own small
disk, which is why the 14-day run wants a Linux host

That run also found and fixed a harness defect: the runner kept its timers and
sockets alive after the final report, so a completed soak never exited. It now
clears them, stops the engine and the bucket, and exits 0.

A short run is not the gate. It shows the harness drives the engine, injects
every fault it can on that host, and reports honestly; it says nothing about
two weeks of drift.
2 changes: 1 addition & 1 deletion packages/conformance/soak/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ docker run -d --name sobjects-soak --restart unless-stopped --network none \
-v /opt/sobjects-soak/data:/soak/data -v /opt/sobjects-soak/state:/soak/state sobjects-soak
```

Read `/opt/sobjects-soak/state/report.json`, or the daily `report-YYYY-MM-DD.md` next to it. The runner saves its journal every minute and picks up where it left off if the container restarts.
Read `/opt/sobjects-soak/state/report.json`, or the daily `report-YYYY-MM-DD.md` next to it. The runner saves its journal every minute and picks up where it left off if the container restarts. When it reaches `SOAK_DAYS` it writes the final report, stops the engine and the bucket, and exits 0, so a finished soak does not look like a container that is still running.

Settings (environment): `SOAK_DAYS` (14), `SOAK_RATE` writes/s (20), `SOAK_FAULT_MINUTES` (45), `SOAK_VERIFY_MINUTES` (15), `SOAK_THREADS` (2), `SOAK_BACKUP_MODE` (`durable`, or `interval`), `SOAK_BACKUP_INTERVAL` seconds (10), `SOAK_FAULTS` (comma-separated subset), `SOAK_OUTAGE_SECONDS` (300), `SOAK_DISK_FULL_SECONDS` (180).

Expand Down
34 changes: 28 additions & 6 deletions packages/conformance/soak/soak.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ let faultActive = null;
let lastOutageEnd = 0;
let hourSamples = [];
let stopping = false;
const sockets = [];

const log = (message) => console.log(`${new Date().toISOString()} ${message}`);
const sleep = (ms) => new Promise((resolveSleep) => setTimeout(resolveSleep, ms));
Expand Down Expand Up @@ -171,9 +172,12 @@ async function restartAfterCrash() {
downtime.push([down, Date.now()]);
}

// A child killed by a signal has a null exitCode, so check both.
const engineAlive = () => Boolean(engine) && engine.exitCode === null && engine.signalCode === null;

async function stopEngine(signal) {
const child = engine;
if (!child || child.exitCode !== null) return;
if (!engineAlive()) return;
child.kill(signal);
const timeout = sleep(30_000).then(() => "timeout");
if ((await Promise.race([child.exited, timeout])) === "timeout") {
Expand Down Expand Up @@ -247,6 +251,7 @@ function startSockets() {
const connect = () => {
if (stopping) return;
const socket = new WebSocket(`${ENGINE.replace("http", "ws")}/echo?name=echo-${index}`);
sockets.push(socket);
const waiting = new Map();
let timer;
// A connection attempt made while the engine restarts can hang in the
Expand Down Expand Up @@ -404,7 +409,7 @@ async function injectFault(name) {
} catch (error) {
record.error = String(error?.message ?? error);
violation("fault-recovery", `${name}: ${record.error}`);
if (engine?.exitCode !== null) await restartAfterCrash();
if (!engineAlive()) await restartAfterCrash();
} finally {
faultActive = null;
}
Expand Down Expand Up @@ -543,10 +548,12 @@ async function main() {
const loadTimer = setInterval(() => {
if (Date.now() < endAt && faultActive !== "kill9" && faultActive !== "wipe-restore") void appendOnce();
}, 1000 / CONFIG.writesPerSecond);
setInterval(save, 60_000);
setInterval(sampleHour, 3_600_000);
setInterval(writeDaily, 3_600_000);
setInterval(() => void verifyAlarms(), 30 * 60_000);
const timers = [
setInterval(save, 60_000),
setInterval(sampleHour, 3_600_000),
setInterval(writeDaily, 3_600_000),
setInterval(() => void verifyAlarms(), 30 * 60_000),
];
let nextVerify = Date.now() + CONFIG.verifyMinutes * 60_000;
let nextFault = Date.now() + CONFIG.faultMinutes * 60_000 * (0.5 + Math.random());
while (Date.now() < endAt) {
Expand All @@ -561,6 +568,16 @@ async function main() {
}
}
clearInterval(loadTimer);
for (const timer of timers) clearInterval(timer);
// Stop the load and the sockets before the final check, so the report is
// final and the process can exit: a finished soak must not look like a
// container that is still running.
stopping = true;
for (const socket of sockets) {
try {
socket.close();
} catch {}
}
await sleep(10_000);
await verifyLedgers("final");
await verifyAlarms();
Expand All @@ -569,6 +586,11 @@ async function main() {
save();
writeDaily();
log(`soak finished: ${report.violationCount} violations`);
await stopEngine("SIGTERM");
weed?.kill("SIGTERM");
// Always 0: a non-zero exit would make `--restart unless-stopped` start the
// finished soak again. The report carries the verdict.
process.exit(0);
}

for (const signal of ["SIGTERM", "SIGINT"]) {
Expand Down
Loading