Skip to content

Bug bash: eight defects fixed, two filed with measurements - #717

Merged
nockawa merged 11 commits into
mainfrom
bug-bash
Aug 8, 2026
Merged

nockawa merged 11 commits into
mainfrom
bug-bash

Conversation

@nockawa

@nockawa nockawa commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Closes #709, closes #713, closes #712, closes #715, closes #711, closes #676, closes #708.

Nine commits, one per defect (plus one superseded first attempt kept for its reasoning, and the rule-verifier tags). Docs land in the companion PR log2n-io/typhon-claude #68.

Suite 5032 passed / 0 failed / 15 skipped, twice. QUARANTINE.md 13 → 9 rows. Rule-coverage audit 0 blocking (was 7).


The fixes

#709 — DirtyBitmap loses a dirty bit · 1bbc258f + d8508006

Interlocked.Or on an array reference the thread captured earlier, which Grow/Snapshot can replace in between: atomic on an object nobody reads again. A lost bit is a dirty chunk that is never checkpointed — silent data loss, no error, no CRC mismatch, on a clean shutdown.

My first fix was wrong and the suite caught it. Re-reading _bits after the OR closes the swap window but not the one before it: Grow copies before it publishes, so a writer landing in between still sees its own array as live. A seqlock around the copy did not close it either — 6 failures in 30 runs, the tell being contiguous runs of lost bits at each thread's first writes rather than isolated ones. So the copy is gone: words live in fixed 8-word blocks, growth replaces only the reference table, Snapshot drains in place. 30 consecutive runs green.

#713 — NRE on spawn+write in one transaction · 7ebd38a4

Not really a null reference — an identity bug. WriteEcsComponentData re-derived the staging key from the content-chunk header, which FinalizeSpawns only stamps at publish time, so every own-spawn write staged under key 0 (probe: stagedKey=0 routing=0 meta=NULL). The two-entity case is the worse face: both stage under key 0, so the second silently overwrites the first rather than crashing.

#712 — crash-recovered engine restarts WAL LSNs at 1 · 9d0103f7

An ordering bug: the LSN floor is chosen in the constructor from information that only exists later. Regression test asserts the watermarks, not entity survival, so it fails if and only if the floor is wrong — Expected: 16, But was: 1 against the old code.

#715 — the recovery seal reclaims the WAL without persisting what makes the data reachable · 7c13e893

Found while fixing #712 and independent of it. An engine that recovers and then crashes with zero writes in between came back empty: all three shapes, scanned=0 applied=0. SealRecovery advances CheckpointLSN — reclaiming the WAL — while deferring the segment SPIs to "the first steady-state checkpoint". There may not be one.

This is a CK-10 conformance fix, not a deviation from it. CK-10 already says a consolidating checkpoint MUST record the SPIs in the same cycle, and the observed loss is its on_violation sentence verbatim. The pre-existing carve-out was the departure.

#711 — mixed publication timings corrupt the secondary index · 8c46b38b

The shadow bit is per-entity; the shadow entries are per-slot. The destroy trusted the bit. Two probes contradict the issue's title: writing only the indexed component and destroying passes; writing only the unindexed sibling and destroying fails identically. No key move is involved. Both are permanent cases now, because a fix aimed at the documented "key move" would have greened the titled shape and left the real one red.

Deleting the MixesPublicationTimings narrowing (as the quarantine row instructed) then exposed the issue's second shape, SvPlusTransient + Commit, which the narrowing had been hiding.

#676 — ULong index stores keys as signed · 9ff7c5e0

Everything above the storage layer was already correct — Comparer<ulong>, KeyRange.Compare, OrderedKeyEncoding all order unsigned. The L64BTree<long> declaration made all three unreachable. Fixing it exposed the next layer (EcsQuery still cast to BTree<long>); both fixed together. New tests straddle 2^63 deliberately — a fixture using only small handles passes against the old code, which is exactly how the suite came to have no ulong-indexed field at all.

#708 — concurrent Transient spawn hands out colliding slots · 99681a26

A probe over every id every thread received found zero duplicate EntityIds — it was never the id allocator. Both ClaimSlot overloads CAS once and, on failure, commit the retry with a plain store, three lines under a CAS introduced "for future-proof concurrent commit". Two losers of the first CAS pick the same slot and both store it. Failed 8/12 before, 0/15 after.

#695 — commit publish livelocks after the WAL append · ac85a57b

ReadVersion() returns 0 for LOCKED and OBSOLETE alike; both iterative paths treated the two the same, and both callers looped on that with while (true). An obsolete leaf spun forever. This is precisely the conflation IXS-03 forbids and precisely the consequence it predicts — the rule was written for readers, and the writer half was never written.

CreateDeleteRecreate_RapidLifecycle
without the change no result inside a 240 s cap — hangs, as reported
with the change 147 ms

The 10,000-iteration bound is a backstop, not the fix. The test stays quarantined, retargeted to #696 — now that it terminates it reports a different defect ("duplicate key in a unique index") about 1 run in 4. Calling it green would be false.


Filed, not fixed

Note for the reviewer

The one change I would not merge unreviewed is #715's arming move — see the CK-10 citation above. Everything else is local to the defect it fixes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FE5GUBSF5D1DhyPAuTBbYk

nockawa and others added 11 commits August 8, 2026 11:23
…aps the array under it

Set and TestAndSet captured _bits, then performed an Interlocked.Or on the captured array. Grow and Snapshot both replace _bits wholesale, so a
writer descheduled between the capture and the OR did an atomic OR on an array nobody reads any more. The OR was atomic on the wrong object; the
element-level atomicity was never the hazard, the array-reference swap was, and nothing re-checked it.

A lost bit is a dirty chunk that is never checkpointed — silent data loss, no error, no CRC mismatch, on a clean shutdown.

Both writers now re-read _bits after the OR and repeat against the new array when a swap slipped in. This cannot livelock: it only repeats when
another thread has already published a new array, so every iteration is preceded by system-wide progress, and swaps are rare by construction
(Grow doubles; Snapshot fires once per tick fence). Grow publishes with a release write and every reader acquires, per the arm64 discipline.

TestAndSet keeps the FIRST OR's verdict rather than the last. Grow copies the old array forward, so a retried OR can report "already set" purely
because it is observing the caller's own bit copied into the new array — trusting that would make the first writer skip a shadow capture that
never happened. Keeping the first observation errs toward a duplicate capture, never a missing one.

Tests: DirtyBitmap_ConcurrentSet un-quarantined (it covers the Grow half). Added DirtyBitmap_ConcurrentSetWhileSnapshotting for the Snapshot half,
which the existing test cannot reach because it joins every writer before snapshotting — it pre-sizes the bitmap so Grow cannot fire, leaving
Snapshot's Exchange as the only swap under test. Against the old code it reports 7992 of 8000 bits, which is the measurement that a growth-only
fix would have been incomplete. 6/6 green five times running; affected fixtures 358/360.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FE5GUBSF5D1DhyPAuTBbYk
… staging them under a key the chunk does not carry yet

Spawning an entity and writing one of its components in the same transaction threw NullReferenceException out of BuildCommitBatch under
DurabilityDiscipline.Commit. The identical sequence under TickFence has always worked.

The staging map is keyed by entity PK, but WriteEcsComponentData re-derived that key by reading the content chunk header (*(long*)head) instead of
taking it from the caller. FinalizeSpawns stamps the PK into the chunk at publish, so for an entity spawned in the open transaction the header is
still zero: every own-spawn write staged under key 0, and BuildCommitBatch then resolved routing id 0 to a null ArchetypeMetadata. Probe on the
repro: stagedKey=0 routing=0 meta=NULL. Two entities spawned and written in one transaction is the worse face — both stage under the same key 0, so
the second write silently overwrites the first instead of crashing.

Fixing only the key would not have been enough. StagedSlot.Location on this path is a content chunk id, while PublishStagedEntry reads it as a
cluster location (chunkId*64+slot); the publish would run against a HEAD that does not exist yet; and FinalizeSpawns would then overwrite whatever
it published with the spawn value.

So an own spawn no longer stages at all. It has no HEAD to protect — it lives in a spawn-staging chunk that no other transaction can reach until
FinalizeSpawns publishes it — which makes an in-place write exactly as atomic as the spawn itself, and is what the working TickFence path already
does. The value then rides the spawn's own SV Slot record that BuildCommitBatch already emits for Commit discipline (#395 D5 / CM-06): one record,
one truth. Index reconciliation is unaffected: an own spawn has no old key, and InsertClusterIndexEntries inserts the final one at FinalizeSpawns.

EntityRef carries the own-spawn marker (set where Transaction.ResolveEntity builds a ref from a SpawnEntry) and now passes the entity PK it already
holds into both the read and write accessors, so neither re-derives an identity from storage. CM-02 escalation is untouched.

Tests: four in CommittedDisciplineTests — the repro, read-your-own-writes before commit, the two-entity collision, and the TickFence counterpart as
a guard against regressing the side that worked. One in CommittedDisciplineRecoveryTests: spawn+write in one Commit transaction, hard crash, no
checkpoint — recovery must return the write, not the spawn value, which is what proves the value reached the record that replaced the staging path.

Suite 5010 passed / 0 failed / 15 skipped.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FE5GUBSF5D1DhyPAuTBbYk
…y just replayed

A crash-recovered engine restarted its LSN allocator at 1, below the window its own recovery had replayed. Every commit it then durably acknowledged
landed at an LSN the previous session already used, and the next recovery discarded the whole post-recovery window as already-consolidated. Silent:
the commits are acked, reads see them, they vanish at the next crash. LOG-08's failure mode on the crash path — the clean-reopen half was already fixed.

The defect is an ordering one. InitializeWalManager picks the LSN floor in the constructor from max(LastValidLSN, persisted CheckpointLSN), and on
the crash path both terms are 0: no checkpoint ran, and WAL v2 recovery has not started yet. Its frontier — the authoritative one — only exists later,
inside InitializeArchetypes. The seal then persists CheckpointLSN from that same frontier, so the engine ended up with a checkpoint watermark above its
own writer's counter: measured frontier 16, LastAppendedLsn 9, DurableLsn 16, next open scans 8 records and applies 0.

RunWalV2Recovery now raises the floor as soon as the frontier is known and before InitializeArchetypes returns, which is the last moment before the
engine can accept a transaction and the only point that satisfies both constraints. Seeding the durable watermark to the same frontier matches what the
reopen path already does.

SeedNextLsn's contract was "before the writer thread starts"; this call site has it running. WalManager.SeedRecoveryFrontier therefore asserts the
equivalent quiescence instead of assuming it — WalCommitBuffer.NothingClaimedYet. Nothing claimed means no producer exists, and PerformSwap (the only
writer of the LSN base on the writer thread) runs only in response to a producer filling a buffer. If a claim ever did precede the frontier, rebasing
would strand those records below the new floor still colliding, so the open fails loudly rather than shipping the collision.

Tests: PostRecoveryWrite_ContinuesTheLsnSequenceAboveTheReplayedFrontier, three shapes, asserting the watermarks rather than entity survival so it fails
if and only if the LSN floor is wrong. Against the old code all three report "Expected: 16, But was: 1".

Note: this restores LSN monotonicity but does NOT yet green PostRecoveryWrite_SurvivesASecondCrash. With the floor fixed, the second recovery applies
the post-recovery window correctly (scanned=8 applied=4 maxLsn=24) and the four post-recovery entities survive; the eight from generation 1 are lost to
a second, independent defect on the same path, filed separately and fixed in the next commit.

Suite 5013 passed / 0 failed / 15 skipped.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FE5GUBSF5D1DhyPAuTBbYk
…ead of trying to detect when it has

My first fix for #709 was wrong, and the suite caught it. Re-reading _bits after the Interlocked.Or and repeating on a change closes the swap window
but not the one before it: Grow does Array.Copy BEFORE it publishes the new reference, so a writer whose OR lands in between still sees its own array
as the live one, returns satisfied, and the bit reaches neither array. Adding a seqlock around the copy did not close it either — 6 failures in 30 runs
of the new growth case, and the tell was CONTIGUOUS runs of lost bits at a thread's first writes (3001..3007) rather than isolated ones.

The class of bug is the copy, so the copy is gone. Words now live in fixed 8-word blocks (one cache line, 512 chunk ids) behind a block table. Growth
replaces only the table, and the table holds references, so a writer that resolved its block through the old table ORs into the very same block object
the new table points at. There is no window to detect and no retry to get right. Snapshot drains in place, one Interlocked.Exchange per word, instead of
swapping the storage out: a concurrent Set either lands before the exchange and is reported by this snapshot, or after it and stays set for the next one.

The write path costs one extra dependent load. That is the right trade here — a lost bit is a dirty chunk that is never checkpointed, i.e. silent data
loss with no error and no CRC mismatch on a perfectly clean shutdown.

Snapshot reports the whole allocated capacity rather than the constructor's requested word count, because a block is allocated whole and a word inside it
is writable and must therefore be reportable — DirtyBitmap_SparseHighBits sets bit 64 on a bitmap built for 64 bits and reads it back. ShrinkForTesting
keeps an exact logical count so ClusterMigrationTests can still express a snapshot shorter than a later chunk id.

Tests: DirtyBitmap_ConcurrentSetAcrossManyGrowths added — it starts each round at the smallest possible bitmap so every round crosses several extensions,
and it is what falsified both earlier attempts. 30 consecutive runs green on this layout. DirtyBitmap_ConcurrentSet (un-quarantined) and
DirtyBitmap_ConcurrentSetWhileSnapshotting cover the steady-state and drain halves.

Suite 5020 passed / 0 failed / 15 skipped, twice.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FE5GUBSF5D1DhyPAuTBbYk
…eckpoint, not in a later one that may never run

A crash-recovered engine that crashed again lost EVERYTHING the recovery had restored. No post-recovery write was needed: an engine that recovers and
then crashes with zero activity in between came back empty. Found while fixing #712 and independent of it — #712 was the LSN allocator, this is the
seal's metadata.

SealRecovery advances CheckpointLSN to the replayed frontier, which reclaims every WAL segment below it, but the per-archetype segment SPIs that make
the consolidated base REACHABLE were left for "the first steady-state checkpoint". There may not be one. In between, the WAL no longer holds the data
and the data file cannot be navigated to it — and that window opens at the moment a database is most likely to crash again, immediately after
recovering from a crash. Measured on the isolation probe, all three storage shapes: third open reports scanned=0 applied=0 and every entity lost.

The SPI hook is now armed before the seal, so the seal's own ForceCheckpoint records the SPIs alongside the data it is consolidating. This deviates
from the #395 comment that deliberately deferred it; the ordering concern it raises does not survive inspection, because the seal runs after apply,
scrub, index rebuild and suspect resolution, so the segments are final when the hook fires. The residual — a cycle-start SPI snapshot lagging a segment
the same checkpoint grows while flushing — is not specific to the seal: PersistDurableMetadataHook runs at cycle start for every steady-state
checkpoint too. Flagging it as a deliberate deviation for review.

Tests: RecoveredEngine_CrashingWithNoWrite_StillHasEverythingItRecovered, three shapes — deliberately writes nothing between the recovery and the second
crash, so no post-recovery window exists and #712 cannot be the cause of a failure. What it leaves under test is the seal's own promise: that advancing
CheckpointLSN, and reclaiming the WAL on the strength of it, means the consolidated base is reachable and not merely written.

PostRecoveryWrite_SurvivesASecondCrash leaves quarantine (all three shapes) — it needed both this and #712.

Suite 5020 passed / 0 failed / 15 skipped, twice. Suppression lint clean.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FE5GUBSF5D1DhyPAuTBbYk
…s the tick fence maintains

Destroying an entity in the same transaction as any sibling write left the secondary index holding the released slot: silent for AllowMultiple (a leaf
pointing at an unoccupied cluster slot), loud on the next rebuild for Unique.

The destroy skipped B+Tree removal whenever the entity's shadow BIT was set, on the grounds that the tick fence would detect occupancy=0 and remove the
old key. But the bit is per-ENTITY and is set by a write to any component, while the shadow ENTRIES are per-indexed-slot and cover only what
ShadowClusterIndexedFields captured — every indexed NON-Versioned slot. So a single write to an unindexed Transient sibling was enough to make the
destroy hand a Versioned slot's entry to a fence that had never captured it, and nobody removed it.

Two probes fix the boundary, and they contradict the issue's title. Writing only the INDEXED Versioned component and destroying PASSES; writing only
the UNINDEXED Transient sibling and destroying FAILS with the identical error. No key move is involved, so this is not "mutate-then-destroy" — it is
"destroy after any write that does not shadow the indexed slot". Both are now permanent cases, because a fix aimed at reconciling the key move would
have greened the documented shape and left the real one red.

The fix gives both sides one definition to read: ArchetypeMetadata.FenceMaintainedSlotsUnder(discipline). The shadow capture skips its complement and
the destroy removes its complement inline, so they cannot drift again.

Widening the matrix then exposed the issue's OTHER shape, which the narrowing had hidden: SvPlusTransient under Commit discipline failed
RepeatedMovesAcrossDuplicateKeys with a leaf naming an unoccupied slot. Same root, different face — under Commit an SV write is staged and reconciled
by PublishStagedCommitWrites, but the sibling's capture still shadowed that SV slot, so the fence applied a SECOND MoveValue from a pre-write OldKey
the commit publish had already moved away from. FenceMaintainedSlotsUnder returns only the Transient slots under Commit, which stops the double
maintenance at the source.

Also guards ReconcileClusterIndexAndViews against an entity destroyed in the same transaction. Both its callers are commit-scoped and both run in the
same commit as the destroy, and maintaining an index entry for a slot about to be released is never right. Guarding the shared method rather than each
caller keeps the two from drifting.

Tests: MixedPublicationTimings_MutateAndDestroy_LeaveTheIndexAgreeing leaves quarantine. Added the two boundary cases above. Deleted
AxisArchetypes.MixesPublicationTimings and both KeyMoveCells narrowings, as the quarantine row instructed — the key-move behaviours now run the FULL
cell set, which is how the second shape surfaced. Index matrix 129/129; index + commit-discipline surface 184/184.

Suite 5028 passed / 0 failed / 15 skipped, twice. Suppression lint clean. QUARANTINE.md down to 10 rows.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FE5GUBSF5D1DhyPAuTBbYk
…oring it reinterpreted as signed

ULongSingleBTree / ULongMultipleBTree were declared L64BTree<long> / L64MultipleBTree<long>, so ulong keys were stored reinterpreted as SIGNED and the tree
ordered them that way: anything at or above 2^63 sorted before zero, and the full range [0, ulong.MaxValue] read as the signed pair [0, -1], which is empty.

The defect lived at the storage level, and everything above it was already right. Comparer<TKey>.Default orders ulong unsigned; KeyRange.Compare already had
a ULong arm comparing unsigned; OrderedKeyEncoding.Encode already had the sign-flip. Only the declaration was wrong, and it made all three unreachable, so
KeyRange.IsStreamable excluded ULong to keep queries off the path — unordered ones fell to the SoA scan and stayed correct, ordered ones answered nothing.

Changing the declaration compiled clean (keys move by raw pointer) but exposed the next layer: EcsQuery's typed dispatch still cast a ULong index to
BTree<long>, which now throws InvalidCastException rather than silently mis-ordering. Both were fixed together, since either alone is worse than neither.

Also removes ULong from IsStreamable and gives IndexStatistics.DeriveKeyType a ulong arm — the two halves of the planner used to disagree about the same
index, DeriveKeyType reporting Long while QueryResolverHelper.MapFieldTypeToKeyType reported the field as ULong.

Tests: UlongIndexOrderingTests, three cases, all straddling the sign boundary — 2^63 and ulong.MaxValue are both negative read as long, so any signed
comparison left anywhere in the stack fails them. A fixture using only small handles would have passed against the old code, which is exactly how the suite
came to have no ulong-typed indexed field at all. Ordered scan, range across the boundary, and equality on a high handle. Updated the two tests that asserted
the old exclusion.

Not done, deliberately: QueryPathEquivalenceTests has no ulong column, so ULong does not yet join its operator × sign matrix. Adding one is worthwhile
follow-up and is now called out in that fixture's remarks rather than left implied.

Suite 5031 passed / 0 failed / 15 skipped, twice.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FE5GUBSF5D1DhyPAuTBbYk
…store

Two threads spawning Transient entities concurrently could land in the SAME cluster slot, so one silently overwrote the other's component data and a thread
read back another thread's value through an EntityId its own Spawn had returned.

The issue offered two candidate mechanisms — colliding slot allocation, or unstable EntityId resolution. A probe that collected every id every thread
received and checked for duplicates never fired once: the ids are fine. It is the slot claim.

Both ClaimSlot overloads CAS once and, on failure, re-read the occupancy word and commit the second attempt with a PLAIN STORE. The Persistent one states
the premise out loud — "Direct write — single-writer (no concurrent commit)" — three lines under a CAS introduced "for future-proof concurrent commit",
which is the same method disagreeing with itself. The premise is false for Transient spawns, which commit from independent transactions on independent
threads. Two losers of the first CAS then read the same word, both take TrailingZeroCount of the same available mask, and both store their result.

A retry that abandons the atomicity of the attempt it is retrying is not a retry. Both overloads now share ClaimFreeBit, which loops until it either wins a
CAS or finds the word full, so every attempt is atomic and the returned bit is exclusively the caller's.

Measured: Transient_SpawnDestroy_Throughput failed 8 of 12 runs before, 0 of 15 after. It leaves quarantine, which also removes the intermittent
ParallelSpawn_SameArchetype_AllEntitiesUnique red that PR #714 flagged as this bug escaping its quarantine.

Suite 5032 passed / 0 failed / 15 skipped, twice. Suppression lint clean. QUARANTINE.md down to 9 rows.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FE5GUBSF5D1DhyPAuTBbYk
…und the retry loops it fed

Transaction.Commit could hang forever in the PUBLISH phase, after the WAL append: four threads spinning 24+ minutes with CPU climbing and no progress, no
exception, no timeout, no way out but killing the process.

OlcLatch.ReadVersion() returns 0 for a LOCKED node and for an OBSOLETE one alike, and the two need opposite treatment. Locked is transient — the holder
releases in nanoseconds and retrying is right. Obsolete is permanent: the node was replaced by a structure modification and will never become valid again.
Both InsertIterative and RemoveIterative saw the 0, took the "wait for the holder, then restart" branch, and reported not-completed — and both callers
looped on that with `while (true)` and no bound. An obsolete leaf therefore spun forever. This is precisely the conflation IXS-03 forbids and precisely the
consequence it predicts ("on_violation: livelock"); the rule was written for readers and enforced at two reader sites, and the writer half was never written.

The descent now checks IsObsolete first and does not wait on, or lock, an obsolete node — not locking it also keeps it off #716's hazard, where a writer
acquires a merge-detached node and writes into it. Both retry loops additionally take a bound (MaxPessimisticRestarts, 10_000) and throw a diagnostic naming
the condition rather than hanging. That bound is a backstop, not the fix: it is three orders of magnitude above what real contention needs, so reaching it
means no further retrying would have helped. Turning a permanent silent hang into a loud error is the same trade IX-03 makes elsewhere.

Measured on the reproducer, ChaosStressTests.CreateDeleteRecreate_RapidLifecycle: without this change, no result line at all inside a 240 s wall cap — it
hangs, exactly as reported. With it, 147 ms.

The test stays quarantined, retargeted from #695 to #696. Now that it terminates it reports something else, about 1 run in 4: "A duplicate key was detected
in a unique index" — a concurrent unique-index correctness defect, #696's family and possibly #716's mechanism. The livelock is fixed; that is not, and
saying the test is green would be false.

Suite 5032 passed / 0 failed / 15 skipped, twice. Suppression lint clean.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FE5GUBSF5D1DhyPAuTBbYk
Five [VerifiesRule] attributes, one per test the corresponding rule now names in its `verified:` line. Without them the rule-coverage audit counts the
rules as unverified no matter what the tests assert, and a reader grepping for the id finds nothing.

  IX-06   ClusterIndexMatrixTests — the three #711 cases (the documented shape, the unindexed-sibling shape that contradicts its title, and the control)
  LOG-08  DifferentialRecoveryOracleTests.PostRecoveryWrite_ContinuesTheLsnSequenceAboveTheReplayedFrontier — the crash-path half; the existing verifier
          shuts session 1 down CLEANLY, which is why it never covered it
  CK-10   DifferentialRecoveryOracleTests.RecoveredEngine_CrashingWithNoWrite_StillHasEverythingItRecovered — the recovery seal's half

coverage/rule-coverage.md is deliberately NOT regenerated here. It is generated from the rules corpus, and this worktree's claude/ clone is missing the
three rules still sitting in the unmerged typhon-claude PR #67 — regenerating drops RB-06 from the matrix and reports 180 rules falling to 177 with the
mutant count 4 → 3, which is precisely the decrease the audit's ratchet exists to block. It should be regenerated once #67 merges.

Suite 5032 passed / 0 failed / 15 skipped. Scope check: 178 scope lines, all symbols resolve. Doc links: 1857 links, 0 broken.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FE5GUBSF5D1DhyPAuTBbYk
… has merged

Deliberately deferred in the previous commit: the matrix is generated from the rules corpus, and this worktree's claude/ clone was three rules short
while typhon-claude PR #67 sat unmerged. Regenerating then dropped RB-06 and reported 180 rules falling to 177 with mutants 4 -> 3 — a decrease booked
by a commit whose purpose was to increase coverage, and exactly what the audit's ratchet exists to block.

With #67 merged every count moves the right way:

  rules 180 -> 183, with a [VerifiesRule] 16 -> 18, [fatal] with a verifier 13 -> 15, mutants 4 (unchanged)

The audit now reports 14 findings and 0 BLOCKING, down from 7 blocking. All seven were pre-existing and all seven were #67's absence: the six duplicate
rule ids it resolves, and [RuleMutant("RB-06")] in DifferentialRecoveryOracleTests naming a rule that existed only inside that PR. The 14 remaining are
the non-blocking VERIFIER_WITHOUT_MUTANT list, which the ratchet only forbids growing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FE5GUBSF5D1DhyPAuTBbYk
@nockawa
nockawa merged commit 2028e81 into main Aug 8, 2026
16 checks passed
@nockawa
nockawa deleted the bug-bash branch August 8, 2026 14:27
nockawa added a commit that referenced this pull request Aug 10, 2026
The rule database sat in the private docs repo because it is markdown, but it is not prose about code — it is checked against it: ~185 `scope:` lines name C# symbols, 70 `[VerifiesRule]` attributes name rule ids, and the ratchet baseline counting them already lived here.

The boundary cost a PAT in a public repo's CI, an audit fork PRs silently skipped, a path filter blind to rule edits, two steps that guessed the companion branch by name, and a deadlock where each gate demanded the other repo merge first (#702, #717, #719 — main red for twelve hours). All deleted rather than tuned: a rule, its verifier and the code it scopes now land in one commit. IXW-03 arrives carried through the one conflict this move can produce, with the count it changes.

`rules/` sits at the root — a contract, not documentation output. The scope check runs in `invariants`, unconditionally, because an unresolved `scope:` symbol is a source-side defect no rules-path filter would see. `--skip-if-no-rules` is gone: a gate that can decline to run is one a reader must check the logs to trust.

`check-doc-links.py` inherits the enforced tier `check-doc-drift.py` gives up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment