Files
sisi/done/storage-engine.md
T
swaitsandClaude Fable 5.2 2fc1fe9c2d
ci / tests (macos-latest, python 3.11) (push) Canceled after 0s
ci / tests (macos-latest, python 3.13) (push) Canceled after 0s
ci / tests (macos-latest, python 3.9) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.11) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.13) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.9) (push) Canceled after 0s
sisi 0.1.0: a shared rulebook and verification tool for AI coding agents
Contracts with a ladder of checks, an end-of-turn gate, retrospectives and
shared lessons, time-to-delivery measurement, a library of 140 verification
techniques and 20 recipes, personal data kept outside the clone, and
releases with rollback. Standard library only.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 22:29:02 -07:00

34 lines
2.1 KiB
Markdown

---
id: storage-engine
title: A storage engine, database layer or persistent format
applies_to: Code that writes data to disk or a database and must read it back correctly after crashes, upgrades and concurrency.
---
## Done means
- What is written is what is read back, for all value shapes, including the empty, the largest and the unusual.
- A crash or power loss at any point leaves the store either as before or as after, never in between, and recovery works.
- Concurrent readers and writers see consistent states, with the isolation the documentation promises.
- Files written by every earlier version still open; the new version's files are rejected or migrated safely by older ones.
- Corruption is detected and reported, not silently returned.
- Disk full, permission denied and a failed write are handled without damaging existing data.
- Performance and size on realistic volume are measured.
## Checks
- Round trip and model: `stateful-model-test`, `round-trip`, `model-test-from-spec` (many-inputs), rung 2.
- Crash and failure: `fault-injection-storage`, `deterministic-simulation` (concurrency), rung 2.
- Consistency: `linearizability-checking`, `loom` or `shuttle`, `stress-repeat`.
- Old data: `old-data-compatibility`, `replay-equivalence`, `derived-view-agreement`; migration: `db-migration-safety`.
- Hostile files: `cargo-fuzz`, `structure-aware-fuzzing`.
- Design: `tlaplus` or `quint` for recovery protocols (design), rung 1.
- Read-only paths: `read-only-guarantee`. Speed: `perf-regression`.
## Common false finishes
- Tests never kill the process mid-write; the write-then-rename or log protocol was not exercised.
- `fsync` was not called (or the directory was not synced), and the test machine's cache hid it.
- The store was tested in memory or on tmpfs, not on a real disk.
- One thread only; a second writer breaks it.
- The test reopened the store in the same process, which kept caches alive. Restart a fresh process.
- An old file from the previous release was never opened.
- Corrupted bytes are returned as valid data because there is no checksum.
- A lock file is left behind after a crash and blocks the next start.