writeonce/runtime/test
shoney.arickathil d432bc5301 test(wal): kill -9 DURING compaction — 40 rounds, mutation-proven — T4
databasev2 3, task 4. The plan called this the riskiest task because a race
can pass by luck, so it is argued with mutants rather than green runs.

The battery: a forked child inserts, acks, deletes the oldest so HISTORY
grows while the live set stays ~17, and compacts every 24 iterations. The
parent SIGKILLs at varied instants so kills land before, inside and after
rewrites, then replays and checks the ACKED LIVE SET. The existing
battery's "records >= acks" oracle cannot be reused: collapsing history is
exactly what compaction is for.

A REAL DEFECT IN MY FIRST VERSION, found by the failures and fixed in the
TEST, not by weakening it:

- the child acked deletes AFTER committing them, so a kill in between left
  the row legitimately gone on disk while the last ack still said
  "inserted" — the parent then demanded a row the engine was right to
  remove. Symptom was an acked insert missing near the end of the stream,
  ~1 run in 3
- deletes now announce INTENT BEFORE committing, so such a row's fate is
  simply UNKNOWN to the parent, which is the honest thing to assert. Every
  acked insert never marked for deletion must still be present with its
  acked value
- the stale-temp assertion was also wrong: it checked for absence after
  wo_wal_replay, which never opens the WAL. The guarantee is "removed AT
  OPEN", so the test now opens and then asserts. A temp surviving a kill
  is expected debris, not a defect

Proven to have teeth, which matters because assertions were softened:

- against the design's rejected alternative (in-place rewrite instead of
  the atomic rename) it fails EVERY run, reporting log_records=0 — the
  kill landed mid-copy and destroyed the log. That is the corruption
  rename exists to prevent
- on correct code: 10 consecutive runs x 40 rounds clean, plus the suite

Also carried the log's PREALLOCATION to the replacement. The WAL is
preallocated so appends never extend the file, which is what lets
fdatasync alone be the ack barrier; a replacement opened with prealloc 0
silently changes that property and the zero-padded tail the scan relies
on. Stated honestly: this is hygiene making the replacement equivalent to
what open() would have produced — I could NOT prove it was the cause of
the observed loss, and the ack race above explains it.

Verified: just wovm-test — 36 suites 0 fail, test_wal 760 pass, cli_smoke OK.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 05:55:58 +02:00
..
.gitkeep feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
cli_smoke.sh feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
mkwob.c feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
t.h feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
test_arena.c feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
test_borrow.c feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
test_builtin.c feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
test_cont.c feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
test_crypto.c feat: iteration 34 — digest builtins sha1/sha256/hmac_sha256 (ids 85-87) 2026-08-23 00:42:43 +02:00
test_cycle.c feat(runtime): incremental tri-color mark-sweep replaces RC (7b Phase 3a) 2026-08-19 16:52:48 +02:00
test_fiber.c feat(runtime): fiber run queue + reduction budget (arc T2) 2026-08-20 07:03:40 +02:00
test_icall.c feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
test_loader.c feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
test_mailbox.c feat: bounded mailboxes + WO_T_ACTOR (trap 13); try-arm place-copy fix 2026-08-23 01:05:13 +02:00
test_obj.c feat(runtime): incremental tri-color mark-sweep replaces RC (7b Phase 3a) 2026-08-19 16:52:48 +02:00
test_objops.c feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
test_rc.c feat(runtime): incremental tri-color mark-sweep replaces RC (7b Phase 3a) 2026-08-19 16:52:48 +02:00
test_table.c feat: O(1) read path — index probe wired end to end 2026-08-22 16:44:56 +02:00
test_unwind.c feat: retire RC from the emitter and the format — .wob v4 (7b Phase 3b) 2026-08-19 17:07:43 +02:00
test_vm.c feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
test_wal.c test(wal): kill -9 DURING compaction — 40 rounds, mutation-proven — T4 2026-08-29 05:55:58 +02:00
test_wobbuild.c feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00
wob_build.c feat: secondary indexes + @unique trap (iteration 9, Task 4; wob v3) 2026-08-15 12:57:32 +02:00
wob_build.h feat(runtime): wovm VM core (Iteration 2) 2026-08-10 09:35:55 +02:00