hawdb 0.41.0

An embedded Rust graph database for local data-plane workloads
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
# MVCC Commit Validation Protocol

Status: partial implementation for #231 and #232.
This document separates the current protocol from the remaining acceptance
work. It does not declare either issue complete.

## Current implementation and boundaries

HawDB has immutable COW snapshots, transaction-private workspaces, one
process-local database owner, and one serialized WAL publication stream.
`ConcurrentTransaction` executes statements against its private state outside
`CommitSequencer`; commit enters the sequencer. Concurrent statement execution
is already implemented, not contingent on implementing a new version index.

Optimistic graph commits use per-key first-committer-wins validation.
Pessimistic commits can rebase under their acquired locks. The restricted
optimistic conflict-noop SQL path can also rebase; it recomputes mutation
outcomes at commit. These are distinct protocols: permitting either rebase path alone does not
demonstrate per-key optimistic SQL validation. The qualified explicit-key SQL
path below now has separate per-key validation evidence.

| Mechanism | Current source and scope |
| --- | --- |
| Version storage | `crates/storage/src/version.rs`: `VersionIndex` is a COW map containing the latest epoch and live/tombstone disposition for each recorded identity. |
| Write-set collection | `crates/storage/src/store/graph_commit.rs`: `collect_version_writes` derives graph keys from final canonical operations; typed relational/append staging extends the same bounded set before WAL append. |
| Legacy direct commits | `finish_non_relational_commit` publishes a `Database` stamp after applying an already-durable direct graph/catalog/import mutation. These entry points lack a proven complete narrow write set. |
| Optimistic validation | `validate_version_writes` checks recorded keys plus database/schema barriers against the transaction's `base_commit_epoch`. Conflicts become retryable `HawDBError::TransactionConflict`. |
| Private statement execution | `src/api/concurrent.rs`: statements operate on transaction-owned state; `commit_with_result` submits publication to the sequencer. |
| Rebase selection | `commit_with_result` enables it for pessimistic transactions and the narrowly checked conflict-noop-only optimistic transaction shape. |
| Publication and group sync | `src/api/concurrent/coordinator.rs` serializes commit tasks and retains the database mutex through the shared durability barrier. |
| Writer snapshot lifetime | `DatabaseTransactionState` owns a `ReaderPin` from snapshot capture through private execution and queued commit; rollback/drop releases it and first-statement refresh replaces it. |
| Version reclamation | `GraphStore::snapshot` registers writable/savepoint history protection; `snapshot_for_read` retains data without registering a history watermark. Checkpoint and version-budget reclamation retain stamps at or after the oldest protected epoch. A monotonic `history_floor` rejects stale read-to-write upgrades after history is discarded. |
| Recovery baseline helper | `VersionIndex::from_live_keys_at_epoch` exists but is not wired into open or replay. The current index starts empty on a new store handle. |

Default transactions retain SI. Explicit `TransactionIsolation::Serializable`
adds transaction-owned complete read capture and sequencer-time validation for
[the qualified subset](specs/TRANSACTION_READ_DEPENDENCIES.md). Unsupported or
incomplete captures refuse; pessimistic/conflict-noop rebase cannot bypass read
validation. This does not imply arbitrary-query serializability, automatic
upgrading of SI peers, time travel, multi-process writers or persisted transactions.

## Identities actually emitted

`VersionKey` declares more identities than the commit collector currently uses.
A declared enum variant alone is not evidence that a domain has fine-grained
validation.

| Canonical operation | Recorded identity |
| --- | --- |
| Node create/property update | `GraphNode(id)`, live |
| Node delete | `GraphNode(id)`, tombstone |
| Relationship create/delete | `GraphRelationship(id)` plus source/outgoing and target/incoming `GraphAdjacency` identities; relationship deletion records a tombstone |
| Relationship property update | `GraphRelationship(id)`, live |
| Relationship delete without known endpoints | Relationship tombstone plus conservative `Database` barrier |
| Catalog/index/constraint changes | `Schema` barrier |
| Prepared strict-append rows, including materialized generated-order rows | `AppendTable(table)` live stamp for every written table |
| Prepared strict-append table creation | `Schema` barrier |
| Qualified explicit relational insert/replacement or primary-key deletion | `RelationalRow(table, primary_key)`, live or tombstone; every intent is retained, including net-zero effects |
| Complete-primary-key DELETE on unconstrained/unreferenced tables, or UPDATE preserving all primary/unique/FK columns | `RelationalRow` intent even for absent rows or false residuals |
| Pure relational Error-mode insert with unique/FK constraints or incoming references | `RelationalRow` plus each non-NULL `RelationalIndex` unique identity; shared parent reads are not write identities |
| Other relational predicate/UPSERT/DDL, destructive unique/FK-related writes, opaque relational WAL/snapshot, opaque append WAL, graph projection, initial-import marker | `Database` barrier |
| Nested canonical batch | Recursively collect its operations |
| Legacy direct graph/catalog/import commit | `Database` barrier at the completed commit epoch |

`RelationalIndex` now identifies the unique values of qualified pure inserts;
`ForeignKey` remains reserved. Unconstrained explicit replacements and primary-key
deletes keep row identities. Constrained/referenced tables qualify only when all
of their operations are Error-mode inserts or constraint-preserving point updates;
other destructive operations keep both Database-barrier directions. The
[relational intent proof](tla/RELATIONAL_MVCC_PROOF.md),
[point-predicate refinement](tla/PRIMARY_KEY_PREDICATE_MVCC_PROOF.md),
[constraint-preserving update refinement](tla/CONSTRAINT_PRESERVING_UPDATE_MVCC_PROOF.md),
and [constrained-insert refinement](tla/CONSTRAINED_INSERT_MVCC_PROOF.md) explain
NULL handling, shared-parent reads, eligibility and the complete intent union.
Typed strict-append staging now emits `AppendTable` from the same prepared
transaction that is encoded into WAL. Generated sequence counters are table-wide,
so different partitions in one table still conflict. The opaque WAL collector
retains its database fallback because it has no typed preparation evidence.
See the [append footprint proof](tla/APPEND_MVCC_PROOF.md). Narrowing relational
identities still needs complete constraint and recovery coverage. Pessimistic SQL point-lock concurrency alone is not evidence of complete
optimistic SQL validation. Legacy direct commits likewise use the conservative barrier;
older optimistic workspaces retry even when their keys appear unrelated.

`VersionWriteSet` contains a `BTreeMap<VersionKey, VersionWrite>` with entry
and estimated-byte limits. Defaults are `DEFAULT_MAX_WAL_BATCH_OPERATIONS`
and `DEFAULT_MAX_WAL_RECORD_BYTES` (16 MiB), respectively. `with_limits` permits
explicit budgets; `new(max_entries)` keeps the default byte budget. Charges use
`VersionKey::cow_page_bytes()` plus the inline `VersionWrite` size. Repeated keys
retain their resident key and only replace disposition, without charging again.
Checked addition rejects overflow or a byte-budget breach before map mutation.
Collectors propagate failure before WAL publication and discard partial local
preparation. See the [admission proof](tla/MVCC_VALIDATION_PROOF.md#write-set-byte-admission).

This is an estimated retained key/write payload budget, excluding B-tree node
and allocator overhead, spare capacity and the incoming key allocation. It is
not a global bound across transactions, canonical/history COW pages or snapshot
lifetimes. The read epoch belongs to the transaction, not this map.

The [snapshot retention qualification](MVCC_SNAPSHOT_RETENTION_QUALIFICATION.md)
maps combined facade/storage ownership to executable tests, exact physical root
sets, low-budget retries, and separate allocation/payload/RSS observations.

## Read-consumer metadata

Embedded read transactions, descendants of published read snapshots and runtime
planning snapshots use `GraphStore::snapshot_for_read`. Their data/catalog view
and physical/storage pins are unchanged, but they retain only a Database barrier
at the capture epoch instead of all historical conflict-index pages. Epoch-zero
captures need no stamp. Writable workspaces/savepoints retain precise indexes
through the ordinary `snapshot` method.

Ordinary synchronous SQL autocommit reads borrow the already captured immutable
publication directly; its `Arc` retains the same store and generation pin until
completion. Virtual catalog reads fork a private context for fresh observation
tables. This avoids per-query store/metadata copies without adding timestamp
lookup, persisted row versions, or a different visibility boundary.

A new transaction starts at or after capture, so older stamps cannot affect its
validation. A pre-capture transaction submitted to the low-level read-optimized
store is conservatively rejected by the barrier. The facade read API rejects
writes outright. See the [conditional proof](tla/MVCC_VALIDATION_PROOF.md#read-consumer-conflict-baseline).
This reduces read-consumer conflict metadata to constant size; it does not bound
all retained data pages, writer snapshots or active pin counts.

## Current-index payload admission

The production commit path additionally limits the current `VersionIndex` to a
64 MiB key/stamp estimate (`DEFAULT_MAX_VERSION_INDEX_BYTES`). Its counter
includes a permanent Database-barrier reservation, even when no barrier stamp
exists. Updating an existing identity does not consume additional budget.
Before WAL append, admission counts new identities in the complete write set.
If it cannot fit, the store first performs the existing safe watermark-based
history reclamation, then retries admission. Failure returns a storage error
before WAL/data publication. It does not drop still-required stamps, invalidate
old readers or substitute a broad conflict identity.

The reservation matters because legacy direct commits publish their Database
barrier after WAL. That stamp is an inline fixed field; all other stamps remain
in the COW map, so updating the barrier does not detach shared index pages. They can always use that reserved identity without a new
post-WAL resource failure. Successful pruning recomputes the current estimate;
cloned indexes retain their own consistent counter and immutable pages.

This is a bound on the production current-index estimate, not total version
memory: historical COW roots, B-tree/page overhead, transient copy-on-write
allocations, spare capacities, and the number of concurrent snapshots remain
outside it. Low-level `VersionIndex::apply` and `from_live_keys_at_epoch` are
unmanaged construction/test primitives, not admission APIs; the bound is enforced
by `GraphStore`'s serialized commit path. The latter constructor has no current
production callers. Reopen resets process-local conflict history as before.
Long-lived writable/savepoint/dependency pins can reject index growth; callers
must release those protections and checkpoint before retrying. Ordinary read
snapshots retain data separately and no longer block conflict-history reclamation.
There is no automatic transaction cancellation.
The 64 MiB default is a fixed admission policy, not a measured global memory
requirement or an allocator guarantee.

While a prepared read is registered, commits also stage read invalidation
summaries in this same 64 MiB current-index estimate and the shared 256 MiB
retained-root estimate. These are overlapping admission views, not two
additional RSS reservations. If only the optional read summaries exceed either
admission, the commit keeps its mandatory write-intent stamps and installs the
fixed-size `ReadBarrier` instead. The writer can commit; registered reads then
fail validation and must prepare again. An oversized mandatory write set can
still be refused before WAL. `GraphStore::read_summary_collapse_count` and the
embedded `Database` API count successful fallback commits for one open instance;
`read_dependency_validation_failures` separates barrier, database, domain,
exact, and schema conflicts. These counts reset on reopen and do not measure
allocator RSS or guarantee that a particular workload will make progress.

## Current-epoch candidate baseline

Before preparing the next index, the store checks its shared snapshot pins. If
none exists or the oldest pin is at least the current commit epoch C, it stages
from a constant Database barrier at C rather than copying earlier narrow-key
history. Every usable writer has E >= C, so previous stamps cannot affect its
validation. New writes still receive their exact identities and next epoch.
Any older source, workspace or descendant disables this replacement and keeps
precise conflict history. The candidate still passes both payload admissions;
WAL rejection refunds it without publishing the baseline.

Exclusive store access and registration-before-escape ensure no older pin can
appear between reading the minimum and using it. Descendants inherit an
already-live ancestor floor, including across private commits and savepoints.
The [source refinement and updated finite models](tla/MVCC_VALIDATION_PROOF.md#current-epoch-candidate-compaction-and-pin-registration)
state these assumptions explicitly. Strict-watermark pressure/checkpoint
reclamation remains available when an older pin prevents baseline replacement.

## Shared retained-history admission

Each open GraphStore and its snapshot/workspace descendants share a separate
256 MiB budget (`DEFAULT_MAX_RETAINED_VERSION_HISTORY_BYTES`) for narrow-key
version-page payload estimates. Each immutable physical page owns one credit;
different snapshot roots share that credit with the page. The credit is dropped
after the page entries, so even an older unmanaged recovery/construction root
retains the charge after another root adopts its shared pages.

Before COW preparation or WAL, a candidate reserves the complete input payload
of each touched page plus new identities and any uncharged source pages. It
adopts source pages before detaching them, then distributes the remaining
reservation among new pages, including split descendants. Unchanged pages need
no duplicate credit. Both new-key insertion and existing-key replacement can
fail admission; cancellation or WAL refusal releases only the candidate's new
pages, while older snapshots retain their original credits. Safe reclamation
and one retry still precede a final pre-WAL storage refusal.

Watermark pruning uses cached per-page epoch bounds. Fully retained pages stay
shared, fully obsolete pages retire without copying, and only mixed pages are
filtered. A shared mixed page needs its full input payload reserved before
copying; a unique mixed page shrinks its existing credit after filtering. When
copy credit is unavailable, whole obsolete pages can still retire while mixed
pages conservatively retain extra evidence. The history floor and pin watermark
are unchanged. Inline Database/ReadBarrier publication needs no new page credit.

The budget excludes allocator/RSS overhead, root directories, private user-data
workspaces, internal transient restructuring and independent opens. It is not a
total process memory cap or a measured workload guarantee. The historical
[root-lease model](tla/MVCC_VALIDATION_PROOF.md#shared-retained-history-leases)
models the earlier conservative root accounting; it does not prove physical
page aliasing in this implementation. Current native regressions in
`version/page_history_tests.rs` and `version.rs` exercise page sharing, initial
adoption, cancellation/refusal, full-budget pruning, stale upgrades and final
retirement.

Concurrent facade commits seal graph operations before entering the sequencer.
Compaction and graph-only persistent WAL operation encoding use the private
transaction alone. The sealed object retains its workspace/pins while queued. Governed facade
mutations retain the originating `RuntimePermit` throughout preparation and the
queue; existing mutation admission reserves two maximum WAL records plus bounded
operation, affected-row and result bookkeeping. This change does not introduce
a total workspace/RSS guarantee for hosts using ungoverned manual transactions.
The sequencer still validates current dependencies, catalog and constraints,
admits version pages, binds the final WAL LSN/commit epoch, frames/checks/adopts
and appends the WAL, and completes the configured durability barrier before
publication. SQL/append staging that depends on current rows, constraints or
commit epoch remains serialized. Mixed transactions discard graph-only prepared
bytes and use the existing complete mixed WAL encoding path. Prepared records
use exactly the existing binary record format.

The manual [MVCC hot-path measurement](benchmarks/mvcc_hot_paths_macos_2026_10_25/README.md)
compares identical release harnesses on the pre-change and optimized revisions.
It records fixed-work reads/COW updates, synchronized graph transactions,
group/fsync diagnostics, process resources and shared-host limitations. These
measurements do not establish a lock-duration bound or power-loss qualification.

## Commit and visibility order

The non-rebased path passes the transaction's base epoch into
`commit_prepared_mutation_ops`. The commit path stages canonical graph,
relational and append changes against current state, collects their version
keys, validates them, checks publication requirements and graph constraints,
reserves and prepares the complete version root, and appends the WAL. A version conflict occurs before WAL append or live root
publication. Earlier staging/constraint errors can occur before version
validation; not every rejected overlapping operation necessarily returns the
version-conflict variant.

After successful WAL append, the path applies canonical operations, advances
`commit_epoch`, and installs the prepared version root. These updates are sequential
Rust operations protected by the sequencer, not one hardware-atomic root swap.
With group commit enabled, internal roots and stamps may advance before the
shared fsync so later tasks in that same group can validate against earlier
ones. The database mutex remains held through `finish_wal_sync_group`, and
successful requests are delivered after the barrier. A group sync failure
rejects the requests and poisons the handle; callers must close and reopen.
Thus the intended boundary is durable-before-external-visibility and successful
acknowledgement, not an assertion that no internal mutation precedes fsync.

Read-only transactions do not supply a write-validation epoch. Failed
statements restore their private state/operations; version keys are collected
from the surviving final operations at commit. There is no independently
accumulated transaction version-key set requiring a separate savepoint today.

## Validation argument and its limits

Let `E` be a transaction's read epoch, `C` the current commit epoch, `W` its
collected keys, and `V(k)` the latest recorded epoch (zero if absent). Ignoring
earlier semantic errors, the current validator accepts exactly when:

```text
for every k in W: V(k) <= E
for each b in {Database, Schema}:
    V(b) <= E and (b not in W or C <= E)
```

This gives the following conditional safety argument:

1. Assume the collector includes every conflicting write identity, epochs
   increase, and relevant stamps have not been removed. If a first commit
   writes `k` at `c > E`, a later commit with `k` in its set observes
   `V(k) >= c > E` and rejects before WAL append. Serialization prevents a
   competing publication between validation and stamp application.
2. With disjoint keys and no newer database/schema barrier, the first commit
   changes none of the second commit's tested stamps. Version validation alone
   therefore permits both. Other constraints, allocation collisions and
   resource limits can still reject them.
3. A broad writer rejects any intervening epoch, even if preceding writers
   emitted only narrow keys. Conversely, a newer broad stamp rejects a stale
   narrow writer. Both directions are necessary; checking only identical keys
   would leave the narrow-before-broad direction unprotected.
4. A deletion stamp at epoch `d` cannot safely be discarded while a transaction
   with `E < d` can still commit against that identity. The helper retains it
   when `d >= oldest_reader_epoch` and removes it only when strictly older.
   The watermark includes all writable workspaces, savepoints and active read
   dependency collectors. Ordinary read snapshots are excluded: reclamation
   records a monotonic `history_floor`, and a later nonempty writer with
   `E < history_floor` is rejected even if its keys now have absent stamps.
   Registering an old descendant after pruning cannot recover lost evidence.
   Current-epoch compaction similarly sets the floor to its capture epoch.
   Physical generation pins remain independent. See the updated
   [read-history argument]tla/MVCC_VALIDATION_PROOF.md#ordinary-read-data-without-conflict-history-protection.

These are deductive arguments about the validation rule under stated
assumptions, not a machine-checked refinement proof of the Rust implementation.
In particular, complete key derivation, crash recovery, resource bounds, and
watermark integration require separate evidence.

### Recovery does not require surviving transaction history

A process restart invalidates every pre-crash transaction. If recovery restores
a consistent root at epoch `R`, every new transaction starts at `E >= R`.
All pre-restart stamps would be at most `R`, so omitting them cannot change a
comparison of the form `V(k) > E`. New commits must still record their stamps,
and broad writers must still check the current epoch. An empty process-local
validation index is therefore not, by itself, evidence of corrupt recovery.

This supersedes the original proposal's unconditional requirement to persist a
non-empty version index alongside every non-empty database. It is a conditional
restart argument, not permission to reset the index while old transactions
remain alive. Canonical WAL/checkpoint recovery, epoch restoration, and rejection
of corrupt or incomplete durable state remain mandatory. Exact pre-crash stamp
identity need not equal post-restart stamp identity; canonical data and observable
commit behavior must agree with the recovered serial order.

## Versioned projection publication

The [versioned publication specification](specs/MVCC_VERSIONED_PUBLICATION_SPEC.md)
defines the required #231/#232 follow-up: complete read dependencies, scoped
validation, source durability, private staging and a validation-to-publication
fence. Its finite model is a new protocol artifact, not evidence that the embedded
outer-owner bottleneck is already removed. The specification retains the full
acceptance ledger and the existing adverse latency evidence.

## Existing evidence and remaining work

`src/api/tests/concurrent_transactions.rs` already includes:

- `optimistic_transactions_commit_disjoint_graph_updates_from_one_snapshot`;
- `optimistic_transactions_prepare_in_parallel_and_reject_the_conflicting_committer`;
- `optimistic_transaction_reads_its_private_workspace`;
- `optimistic_mvcc_reopen_preserves_disjoint_commits_and_same_key_conflicts`;
- `optimistic_mvcc_reopen_preserves_both_database_barrier_directions`;
- `disjoint_primary_key_point_locks_allow_both_pessimistic_writers_to_commit`;
- `repeated_covered_point_read_keeps_its_snapshot_after_a_disjoint_commit`;
- `wal_group_commit_shares_one_sync_without_changing_record_order`;
- `wal_group_sync_failure_rejects_commit_and_poisons_until_reopen`.

The version module separately tests same-key conflict, disjoint keys,
disposition replacement, entry limits, tombstone watermark boundaries, and COW
page sharing. These are bounded cases, not full #231/#232 acceptance.

The existing [transaction model](tla/HawDBTransactionConcurrency.tla) still uses
whole-epoch optimistic validation: `OptimisticFirstCommitterWins` requires
`commitEpoch = baseEpoch + 1`. That property intentionally excludes a successful
stale but disjoint graph writer and is **not** the current per-key invariant.
Its lock/publication checks remain useful within that restricted model; they
cannot certify the added per-key executions. The new
[per-key validation model](tla/MVCC_VALIDATION_PROOF.md) separately checks the
version-index rule against a full-history oracle, including broad barriers,
restart, retained source snapshots, and safe version-history pruning. See the [model scope](tla/README.md#optimistic-and-pessimistic-transaction-publication).

The [group-admission proof](tla/OPTIMISTIC_COMMIT_ADMISSION_PROOF.md#mixed-domain-subprocess-crash-qualification)
now also records 28 subprocess crash cases: two residency modes, disjoint or
overlapping writers, and seven WAL/shared-sync/checkpoint exit points. Exact
graph, relational and generated-append rows must recover as a complete serial
prefix, preserving prior acknowledgements; fresh post-restart conflicts and a
second reopen are checked. This is selected process-loss evidence, not hardware
power-loss or every-instruction recovery qualification.

The [40-pair single-stream measurement](CONCURRENT_WRITER_BENCHMARK.md#shared-history-single-stream-result-2026-09-25)
compares runtime `0b9906f9` against PR-base `a703cc0f` using isolated builds.
All 480 cases pass correctness, but the predeclared zero-increase latency gate
fails: memory and ungrouped durable commit p50 show regression evidence, while
the other four endpoints remain inconclusive. The earlier five-pair result is
not final-runtime acceptance; correction and requalification remain required.

Remaining acceptance work, without reimplementing existing mechanisms:

1. Extend the bounded per-key model evidence to source-level completeness and
   composition with the real recovery/group-sync paths. The finite model and
   its negative controls do not alone discharge these obligations.
2. Qualify total version-memory overhead and cleanup cost under representative
   churn and long-lived pins. Checkpoint cleanup now reclaims eligible
   live and deleted stamps, including barriers, but long-lived pins and historical
   COW maps still retain metadata within the shared payload-estimate budget.
   Allocator and per-handle overhead are excluded; neither a global RSS bound nor bounded
   checkpoint latency follows.
3. Extend relational identities beyond the qualified explicit-key path only
   with complete predicate/constraint and recovery coverage. Typed append writes now have table identities; finer partition
   identities would require separating table-wide generated-order state.
   Preserve conservative paths for unsupported/opaque shapes.
4. Qualify canonical crash/reopen equivalence and post-restart conflict behavior
   across WAL/checkpoint boundaries; do not require identical discarded
   process-local stamp history.
5. Produce the #232 writer scaling, fairness and starvation evidence, plus
   single-stream latency and group-commit comparisons. Existing concurrency
   unit tests do not substitute for this workload evidence. The local
   [fixed-work writer benchmark]CONCURRENT_WRITER_BENCHMARK.md provides
   1/4/8-writer lifecycle controls and full result/reopen checks; its outcomes
   must be assessed rather than treating the presence of a harness as acceptance.

Late pessimistic SQL lock acquisition validates the original snapshot's newly
protected key/range under the commit sequencer after waiting. It uses a
begin-time history pin and read-summary lease, primary row stamps and
payload-sensitive secondary-index summaries, including absent keys and
tombstones. It does not refresh earlier reads or infer safety from the final
write set. Schema/database barriers, incomplete summaries or history, and
bounded-validation refusal still require retry; graph lock discovery retains
its epoch fence. [Storage](STORAGE.md) documents the scope and limits. This
changes Snapshot Isolation admission, not the separate Serializable contract.

## Future direction: table-scoped version retention

This is a deferred design direction, not an implemented capability or a
prerequisite for #986. Current relational row/index identities include the
table name, but the store shares a commit epoch, version index, snapshot-pin
registry and version-memory admission. Narrow conflict identities do not imply
independent per-table snapshot retention or reclamation.

A future design may partition conflict metadata, retention pins and reclamation
by relational table while preserving one transaction commit epoch and atomic
WAL publication. The intended benefit is to prevent a reader whose access is
restricted to one table from unnecessarily retaining another table's version
metadata. It must preserve cross-table snapshot consistency, schema and database
barriers, index/foreign-key dependencies, recovery and the existing durability
contract. Per-table accounting must retain an aggregate memory limit; partitioning
does not remove a hot table's own history pressure or establish an RSS bound.

Safe retention requires a proven access scope. A transaction that can later read
another table must keep conservative snapshot protection unless the design
proves that acquiring that table's protection preserves its original snapshot.
Independent per-table clocks or capturing each table at its first access cannot
be assumed to provide an atomic cross-table view. Graph entities and adjacency
also need explicit ownership rules rather than treating labels as disjoint
relational tables.

Before implementation, define these ownership and retention rules and qualify
cross-table reads/writes, late table access, long-lived readers, concurrent DDL,
memory admission, and WAL/checkpoint recovery. No implementation change is
included in this proposal.

## Concurrent optimistic commit admission

Optimistic transactions acquire a database `OptimisticCommit` logical lock
before enqueueing. These permits coexist, but remain incompatible with all
ordinary shared/exclusive locks until retirement. The commit sequencer still
validates/applies each task serially, including conflicts with earlier tasks in
the same unsynced group. This permits shared durability without exposing
pre-fsync results or weakening pessimistic coordination. See the
[admission proof and model](tla/OPTIMISTIC_COMMIT_ADMISSION_PROOF.md).
The [lock-wait protocol](tla/LOCK_WAIT_FAIRNESS_PROOF.md) now prevents new
conflicting holders from bypassing an older queued request. This is conditional
per-request progress, not fairness of whole transactions or their retries.

## Governed transaction lifetime

Hosts can admit one mutation request through their existing RuntimeGovernor and
pass the permit and task context to `begin_admitted_transaction`. The transaction
retains admission across statements, queued commit and durability, without a
second admission. The queue retains an independent owner after callback
consumption. Plain `begin_transaction` remains caller-managed. See the
[lease invariant and scope](tla/TRANSACTION_ADMISSION_LEASE_PROOF.md); this does
not complete whole-transaction fairness or total workspace memory accounting.

The optimistic admission model also retains acknowledgement evidence across
crash and allows complete uncertain WAL records to survive a failed group sync.
Its prefix invariant does not equate a returned storage error with rollback.
The two-writer failure regression checks exact serial prefixes, unchanged WAL
on poisoned-handle rejection, atomic two-node batches, strict torn-tail/LSN
rejection and fresh-handle commits after reopen. Filesystem/apply/checkpoint
composition remains outside that finite model; see the updated
[shared-durability proof](tla/OPTIMISTIC_COMMIT_ADMISSION_PROOF.md).


## Conditional progress with full-capacity host admission

A separate [governed writer proof and workload](tla/GOVERNED_WRITER_PROGRESS_PROOF.md)
now covers a same-priority large writer requesting all CPU slots from a shared
RuntimeGovernor while smaller requests repeatedly arrive. With stable capacity,
eventual retirement/service, finite valid work and every mutator participating,
queue priority lets capacity accumulate, and the retained permit prevents
competing governed snapshots until the large transaction publishes and retires.
The memory/durable fixture commits 64 statements atomically ahead of 128
recurring small transactions and checks exact reopen state and resource refunds.
This is an explicit host policy, not a default database-wide exclusion or a
guarantee for arbitrary-size, mixed-priority or ungoverned transaction retries.

The [aged-background writer refinement](tla/AGED_WRITER_PROGRESS_PROOF.md) extends
the full-capacity governed progress policy to one background large waiter under
recurring foreground arrivals, assuming deadline passage and fair host retry.
Partial-capacity retry fairness and arbitrary priority mixtures remain separate.

The [governed conflict-retry policy](tla/GOVERNED_CONFLICT_RETRY_PROOF.md) qualifies
a shared first attempt followed by full-capacity admission after a typed
pre-publication conflict. The host retains its waiter and captures a new snapshot
after admission; uncertain durability failures are not automatically replayed.
This is an explicit conditional fallback, not automatic fairness of every retry.