Skip to content

ComponentCollection: crash-safety — CC buffer mutations are not WAL-redo-logged (dangling _bufferId after mid-window crash) #389

Closed

Description

@nockawa

Problem

ComponentCollection<T> (CC) buffer content is not crash-safe. After a crash in the window commit → WAL-durable → (before next checkpoint), the component row's _bufferId is recovered but the buffer it points at is not — leaving a dangling reference and a divergent RefCounter. This is orthogonal to #387: #387 makes CC survive a clean close→reopen; it does nothing for crash recovery.

This was found while assessing #387 — by reading the WAL chunk types + the replay path, not by inference.

Root cause (evidence)

Typhon's redo model is "logical replay of component ops re-derives everything downstream" (it's why indexes need no redo records — replay re-inserts them; and why content/revision chunks survive — their bytes are the WAL payload). CC silently falls outside this guarantee.

  • The WAL has exactly six chunk types (Durability/internals/WalChunkHeader.cs:10): Transaction, FullPageImage, TickFence, ClusterTickFence, BulkBegin/End. None carries CC buffer content. Every component-touching record carries the component row (ComponentStorageSize / PerEntityPayload bytes) — which holds the _bufferId but never the CC elements.
  • WalReplayHelper.ReplayCreate/Update (Durability/internals/WalReplayHelper.cs:132/:184) reconstruct the component row + revision chain by writing the WAL payload into freshly-allocated chunks. They never touch the VSBS segment that backs CC.
  • CC buffer content + the RefCounter (in the VariableSizedBufferRootHeader) reach disk only via checkpoint (data-page pipeline). FPI provides only the before-image (revert-to-checkpoint-start), never forward redo.

A ComponentCollection<T> field is a pointer (_bufferId) into a separately-durable segment. Pointers in a redo log are only safe when the pointee shares the same redo timeline. CC's pointee lives on the checkpoint timeline, while _bufferId lives on the WAL-redo timeline. Mismatched timelines = the hole.

Crash scenario

tx adds element to CC buffer B (VSBS pages dirtied in cache), sets component _bufferId = B, commits
WAL flush (FUA) → Transaction/TickFence/ClusterTickFence record durable  (carries the row incl. _bufferId = B)
[CRASH]  ← before the next checkpoint
Recovery Phase 5: replay rewrites the component row with _bufferId = B (and allocates fresh content/rev chunks)
            but buffer B's content = state at the LAST checkpoint. If B was allocated after that checkpoint,
            B does not exist on disk → _bufferId = B dangles; RefCounter reverts and diverges from references.

Result on reopen: dangling _bufferId, wrong RefCounter → use-after-free / leak / AddElement's own RefCounter <= 0 tripwire (VariableSizedBufferSegment.cs:269) firing.

Why this is CC-specific (and not the revision chain)

The revision chain stores a ComponentChunkId, which looks similar — but it is safe because that chunk's content is the WAL payload and replay rewrites it. CC's content is not in any payload, so replay has nothing to reconstruct it from.

Scope / relationship to #387

Proposed approaches (not final)

  1. Dedicated CC WAL chunk type — log CC buffer deltas (Add/Remove/Clear/Clone/AddRef/Release) or a per-commit buffer snapshot, replayed forward against the VSBS. Mirrors how the UoW registry earns durability via its own WAL records. Cleanest semantically; most work.
  2. Physical after-image redo of dirtied VSBS pages — capture after-images (not just FPI before-images) of dirtied component-collection pages into the WAL at commit, so replay restores them. Physical redo scoped to one segment kind.
  3. Checkpoint-ordering bind — guarantee the _bufferId write is never WAL-durable ahead of its buffer content being checkpointed. Likely defeats the perf model (WAL is the fast path, checkpoint is async) — listed for completeness, probably rejected.

Approaches 1 or 2 are the realistic paths.

Acceptance criteria

  • A crash test (kill/abort after WAL flush, before checkpoint) that writes CC data, recovers, and asserts: elements intact, _bufferId resolves to a live buffer, RefCounter consistent with references — for Versioned and SingleVersion, on clustered and non-clustered archetypes.
  • No dangling _bufferId, no RefCounter divergence, no buffer leak after crash recovery.
  • Mid-window crash + recovery + subsequent mutate (overwrite/destroy) leaves CC buffer lifecycle correct (no use-after-free, no leak).
  • A claude/rules/durability.md invariant pinning "CC buffer content is recoverable to the same frontier as the _bufferId that references it."
  • Verify BulkLoad's CC path (writes pages direct to .bin, fsync via checkpoint, advances CheckpointLSN) is unaffected — i.e. the hole is the normal interactive/tick commit path only.

References

Activity

  1. moved this to Backlog in Typhon devon Jun 1, 2026
  2. added theissue type on Jun 29, 2026
  3. updated Area Durability, Priority P1-High and Estimate L on Jun 29, 2026
  4. moved this to Todo in Typhonon Aug 6, 2026
  5. nockawa commented on Aug 7, 2026

    @nockawa
    CollaboratorAuthor

    Proven by running code — and it is worse than this issue describes

    Branch epic-411 @ 7e382da3. New fixture: test/Typhon.Engine.Tests/Durability/CrashRecovery/CcDurabilityProbeTests.cs. All outputs verbatim.

    First: the evidence in the issue body is stale. WalReplayHelper.cs no longer exists (cited at :132/:184); FPI was retired in increment D so "exactly six chunk types" is now five; recovery is RecoveryDriver + RecoveryApplier. The conclusion holds — the mechanism description needs rewriting.

    1. CollectionDelta is never emitted — proven by counting, not grep

    Workload: one SV (Commit-discipline) spawn with a 5-element collection, one Versioned spawn with a 5-element collection, plus a post-spawn append to an existing collection — the canonical delta case. Immediate durability, uow.Flush(), then scan the WAL with the recovery read path (WalSegmentReader + RecordCodec.TryReadRecord):

    live bufferIds: sv=1 v=3
    WAL record counts: None=0 Slot=3 Lifecycle=2 CollectionDelta=0 BulkManifest=0 FenceBlock=0
    

    Controls are non-trivial (Slot=3, Lifecycle=2), so the scanner works and the transactions really reached the log. D3 is unimplemented, exactly as claude/rules/durability.md:200-201 says.

    2. 🔴 Raw bufferIds leak into the WAL — proven byte-for-byte (LOG-06 violated)

    CC field offset in component storage = 4, storage size = 8
    Slot lsn=2 tsn=2 slotIndex=0 payloadLen=8 bytes=[44-33-22-11-01-00-00-00]
    live _bufferId = 1; bufferId bytes IN THE WAL = 1
    
    Failed ExperimentB_RawBufferId_LeaksIntoTheLog
      Expected: 0   But was: 1
    

    First 4 bytes are the scalar A=0x11223344; the trailing 4 are the collection field — the live handle. All four production AddSlot sites (Transaction.cs:2411, :2446, :2457, DatabaseEngine.TickFence.cs:197) omit the optional handleRanges argument, so HandleRangeCount == 0 and RecordCodec.ZeroHandleRanges (:556) iterates an empty span. The zeroing code is correct and never runs.

    The guard cannot catch the bug

    RecordCodecPropertyTests.HandleRanges_AreZeroed_RestOfPayloadPreserved — the verifier LOG-06 cites — is GREEN in the same build, because it constructs CommitBatchBuilder directly and supplies the ranges itself (:344). It tests the codec's arithmetic and is structurally incapable of failing on the production path. Same anti-pattern as [VerifiesRule] on a method that skips a case (#398): a rule with a verifier that cannot fail is worse than a rule with none, because it reports confidence.

    3. Crash outcome — silent loss, escalating to wrong data

    PRE-CRASH:  bufferId=1 elementCount=5 A=77
    POST-CRASH: IsAlive=True  A=77  recovered bufferId=1
    POST-CRASH: elementCount=0 elements=[]
    

    Outcome (a) silent data loss: entity alive, scalar intact, handle restored verbatim, collection empty. No throw, no diagnostic — the database looks healthy and answers queries.

    It escalates to (b) wrong elements after any post-recovery collection allocation:

    PRE-CRASH:  handles=[1, 3]        (two distinct entities)
    POST-CRASH: recovered handles=[1, 3]
    POST-CRASH: a fresh allocation returned handle 1
      entity 0 (handle 1) sees [7777,8888]     <-- another owner's data
      entity 1 (handle 3) sees []
    shared buffer refcount = 1 despite two owners
    

    The VSBS free-list restarts empty (its pages died with the data file), so the next allocation hands back a handle a live recovered entity still holds. Refcount 1 on a two-owner buffer is the shape of a free-under-a-live-holder — use-after-free is not demonstrated, only its mechanism; I did not drive a destroy-then-access to a fault.

    4. 🔴 The differential oracle false-greens on collections — demonstrated

    RecoveryShadowModel.Diff() returned zero diffs while the collection went 5 → 0 elements. CaptureValues (RecoveryShadowModel.cs:73) snapshots er.ReadRaw(s), which for a collection field is the 4-byte bufferId — faithfully round-tripped, hence a clean diff.

    Anyone adding a collection workload to the T-5 oracle will "prove" #389 fixed on a database that lost every collection. The oracle must dereference collection fields before it is allowed to speak about this issue. Please treat that as a prerequisite of the fix, not a follow-up.

    What I got wrong, recorded so nobody re-derives it

    My first aliasing framing was refuted: the post-recovery spawn and the recovered entity turned out to be the same EntityId (Key=1, raw 65537), so it was entity overwrite, not buffer aliasing. Rebuilding the experiment to allocate on a local value with no Spawn removed entity identity from the question, and the aliasing then held. The overwrite itself was a separate real bug — filed as #697 (post-recovery Spawn re-issues a just-recovered EntityId).

    Recommended split

    1. Ship the bufferId zeroing on its own, now. A few lines; converts memory-unsafety into honest emptiness. Worth doing even if the redo work slips.
    2. Fix the oracle to dereference collections — otherwise the redo fix cannot be verified.
    3. Then CollectionDelta emit + apply. Note the apply side is bigger than a switch case: RecoveryDriver's Rec type (:36-48) has no FieldId, and :166 discards non-Slot payloads, so it structurally cannot carry a delta today.
    4. If (3) slips past alpha, document collections as non-durable loudly rather than leaving D3 claiming the opposite.

    Not established: the Versioned crash path (experiments B/C/C2 ran SV/Commit-discipline; A shows Versioned also emits nothing and :2446 also omits handleRanges, so the same defect is expected) and the tick-fence path (DatabaseEngine.TickFence.cs:197 — no FenceBlock records appeared in any scan).

    ⚠️ 5 of the 6 new probe tests are RED by design — they assert correct behaviour the engine lacks. Decide deliberately whether to keep them as standing guards or mark them [Explicit]/[Ignore("#389")] until the fix lands. ExperimentA is the exception: it asserts CollectionDelta == 0, i.e. today's behaviour, and must be inverted by whoever fixes this.

    🤖 claude/research/Durability/epic-411-reassessment/05-collections-and-changeset.md.

  6. added 2 commits that reference this issue on Aug 10, 2026
  7. changed the issue type fromtoon Aug 10, 2026
  8. nockawa commented on Aug 10, 2026

    @nockawa
    CollaboratorAuthor

    Unblocked, reclassified, and starting

    Reclassified: Type Feature → Bug, label bug added, Bug status → Confirmed

    It was typed Feature, which is how a data-loss defect stays invisible: the backlog filters on Type, so a crash-safety hole filed as a feature request never appears in a bug view. ComponentCollection<T> ships today; a user who crashes in the commit → checkpoint window loses collection contents. That is a bug by any user-facing reading, whatever the shippability framing.

    Confirmed because it reproduces deterministically, every run:

    PayloadAxes_SurviveACrash
      Entity(Key=1, Arch=1) collection field 0: 0 element(s), expected 1
      Entity(Key=2, Arch=1) collection field 0: 0 element(s), expected 2
      ... all 8 entities, all 0 elements
    

    The oracle's own message names this issue by shape: "A collection that recovers EMPTY behind an intact buffer descriptor is #389's exact shape — the raw-bytes comparison cannot see it."

    Unblocked

    The body says "likely gated behind #387 (no point hardening crash recovery for a feature that doesn't yet survive clean reopen)". #387 is closed — clean close→reopen persistence shipped. The gate is lifted.

    Priority — flagging, not changing

    Left at P1-High. There is a real argument for P0: silent data loss, 100 % within the crash window, on an engine whose headline claim is ACID. The argument against is that this is pre-GA work under #411 (WAL v2 → GA) and CC has never been declared crash-safe. That is a call for @nockawa rather than one to make unilaterally.

    Worth stating plainly either way: the merge gate is green while this is live, because PayloadAxes_SurviveACrash is correctly quarantined. The quarantine is doing its job; the consequence is that the board shows no red for deterministic data loss. That is the same shape that let #297 sit for 160 days.

    Quarantine audit (done alongside)

    Every issue referenced by QUARANTINE.md — #389, #400, #406, #410, #552, #696 — is open. No test is excluded from the gate for a bug that has since been fixed, which was the failure mode worth checking for.

    Next

    Reading claude/design/Durability/MinimalWal/ before proposing anything, to establish whether an existing increment already covers CC redo or whether this needs its own design decision between the body's approaches 1 (dedicated CC WAL chunk type) and 2 (physical after-image redo of dirtied VSBS pages).

  9. moved this from Todo to In Progress in Typhonon Aug 10, 2026
  10. nockawa commented on Aug 10, 2026

    @nockawa
    CollaboratorAuthor

    Accepted implementation plan — Option B, full-content emission at commit

    Branch feature/389-cc-crash-safety (worktree bug-bash). Plan derived from todo.md at the worktree root, itself written from a five-agent sweep over the WAL / ECS / VSBS / test / design surfaces. Scope: all phases 0–6, run autonomously.

    The decision

    In BuildCommitBatch, for every component already emitted as a Slot record whose table has HasCollections, emit the collection's entire current content as Clear followed by Append × N.

    This is a deliberate deviation from the frozen D3 design, which assumed per-operation deltas journalled at mutation time. D3's per-mutation journalling is unimplementable against the actual API: the accessor holds none of entityId / slot / fieldId, is never given the Transaction, and the ref it binds may legally point at a stack local before the entity exists. Full-content emission also dissolves EnsureBase (03-recovery.md:143-145), which is likewise unimplementable — once the handle is zeroed for LOG-06 there is no reverse index from a buffer back to its owning row. Under Option B the fold always has baseDiscarded = true, so EnsureBase is never called.

    Cost — whole-collection emission on every commit touching a collection-bearing component — is accepted for v1 as correct-by-construction, optimisable later behind a per-field dirty flag. Not pre-optimised.

    Refuted and not to be re-attempted (recorded in todo.md §3): (A) journal deltas at mutation time; (B) adding a CollectionDelta case to RecoveryDriver's switch alone — the record is already stripped of FieldId/Index/elements at scan; (C) physical after-image redo of dirtied VSBS pages.

    Phases and acceptance criteria

    Phase Deliverable Acceptance criteria
    0 Recovery oracle can fail on collections 0.1 unchanged engine ⇒ PayloadAxes_SurviveACrash fails naming the collection divergence, not a byte-compare · 0.2 a mutation test proves the oracle reacts to a dropped element
    1 Stop the LOG-06 violation 1.1 a [VerifiesRule("LOG-06")] test driving a real commit asserts no bufferId in the emitted bytes · 1.2 collections recover honestly empty rather than dangling
    2 The VSBS Set primitive 2.1 set-to-empty / smaller / larger / over-a-COW-shared-buffer / on bufferId == 0 · 2.2 RefCounter conserved, no orphaned chunks · 2.3 idempotent in content and refcount (AP-12)
    3 Emit full content at commit 3.1 decode reproduces content exactly, through a real transaction · 3.2 LOG-07 ordering preserved (verify — Bucket = 1 already) · 3.3 collection-free components emit byte-identical batches · 3.4 build the offsetInComponentStorage → FieldId map (does not exist today)
    4 Carry and apply 4.1 all five ops in the fold · 4.2 out-of-range RemoveAt/UpdateAt ⇒ loud failure · 4.3 FoldFlush runs after every Slot apply for the same entity (load-bearing; the design never states it) · 4.4 idempotence by actually applying twice
    5 The gate 5.1 CollectionDurabilityTests per 08-test-plan.md row A1.7 · 5.2 un-quarantine PayloadAxes_SurviveACrash — that test going green is the acceptance criterion · 5.3 Versioned + SingleVersion × clustered + non-clustered · 5.4 un-filter ComponentCollectionMatrixTests' ReopenKind axis if it passes
    6 Ratify 6.1 DC-01 into rules/durability.md · 6.2 AP-12's collections clause UNBUILT note · 6.3 Option B's deviation into 03-recovery.md §5 · 6.4 ADR-056's crash-safety exclusion annotated superseded · 6.5 close the 06-durability.md vs 04-data.md/ADR-056 contradiction

    Deviations from todo.md, declared up front

    D1 — Phase 0 was already built. ICollectionProjector, RecoveryShadowModel.DiffCollections and AssertCollectionsAreObservable are all present on this branch, and PayloadPayloadWorkload implements the projector. Verified empirically rather than assumed: on the unmodified engine, PayloadAxes_SurviveACrash fails with 8 mismatches of the form collection field 0: 0 element(s), expected N — AC 0.1 exactly. AC 0.2 is CollectionOracle_DroppedElement_IsDetected, green. Phase 0 is therefore verification, not construction.

    D2 — the Set primitive must be type-erased. todo.md §4 Phase 2 says build Set on "VSBS or the accessor". Both call sites — BuildCommitBatch (read, for emit) and RecoveryApplier (write, for FoldFlush) — hold only VariableSizedBufferSegmentBase<PersistentStore>, because that is the value type of ComponentTable.ComponentCollectionVSBSByOffset. A Set<T> on the generic subclass is unreachable from both. So the raw primitives go on the base class and work in bytes at ElementSize stride; a typed forwarder on the generic subclass is kept for tests and ergonomics.

    Out of scope, decided — do not widen

    • VSBS free-list not restored at recovery (RB-06). Real, [fatal], silent handle re-issue onto live objects — its own issue.
    • Schema-catalog collections stay checkpoint-only. SaveInSystemSchema / PersistSchemaChanges / PersistNewArchetypes build accessors outside any transaction. To be stated explicitly in the rule text so the next reader does not read it as an oversight.
    • Perf optimisation of full-content emission. Correct first, measure, then decide.

    Also to file, per todo.md §8: rollback may not undo collection appends — an atomicity violation on the happy path, no crash required. Code-derived, not measured; one test settles it before filing.

  11. nockawa commented on Aug 11, 2026

    @nockawa
    CollaboratorAuthor

    Implementation complete — acceptance criteria and evidence

    Branch feature/389-cc-crash-safety, six commits, not pushed pending review.

    DifferentialRecoveryOracleTests.PayloadAxes_SurviveACrash is green and un-quarantined. That test going green is this issue's acceptance criterion. Its QUARANTINE.md row is deleted.

    This issue's own acceptance criteria

    AC Evidence
    Crash test: elements intact, _bufferId resolves to a live buffer, RefCounter consistent — Versioned and SingleVersion, clustered and non-clustered CollectionDurabilityTests.Collections_SurviveAHardCrash (both homes) · AxisArchetypesTests.EveryDurableCollectionCell_KeepsItsElementsAcrossAReopen (16 cells, storage shape × clean/crash) · PayloadAxes_SurviveACrash
    No dangling _bufferId, no RefCounter divergence, no buffer leak The handle never reaches the log at all — Commit_WithCollections_PutsNoBufferIdOnTheWire [VerifiesRule("LOG-06")], with Log06Verifier_RejectsABufferIdOnTheWire [RuleMutant] proving it can fail. Leak: VsbsSetElementsTests.Set_RepeatedlyOverOneCollection_LeaksNoChunks
    Mid-window crash + recovery + subsequent mutate leaves lifecycle correct ReapplyingTheWindow_ConvergesInContentAndRefcount re-applies the same window and requires content and refcounts unchanged
    A rule pinning "content recoverable to the same frontier as the _bufferId referencing it" DC-01 ratified into rules/durability.md, plus AP-12's collections clause flipped from 🔵 UNBUILT to built
    BulkLoad's CC path unaffected BL-01 holds — a SuppressWalSerialization UoW appends nothing, so it emits no CollectionDelta either. Full suite green covers the bulk fixtures

    Phase ACs

    All met except one, which I did the opposite of, deliberately:

    AC 5.4 — not done as written. The plan said to lift ComponentCollectionMatrixTests' ReopenKind filter. It must not be lifted. That fixture's bodies never reopen anything, so removing the narrowing generates duplicate in-session cases whose names advertise a reopen that never happens — #704's trap 2 verbatim. The reopen harness lives in AxisArchetypesTests, so the collection reopen axis went there instead (16 cells, green). Recorded in both fixtures so it is not re-derived.

    AC 0.1/0.2 were already built and were verified rather than constructed: on the unmodified engine PayloadAxes_SurviveACrash failed with 8 mismatches of the form collection field 0: 0 element(s), expected N — naming the collection divergence, exactly as specified.

    Three things the plan did not anticipate

    1. A fifth LOG-06 leak site. The plan enumerated four AddSlot sites. The columnar tick-fence path (#559) bulk-copies component columns straight out of the cluster page and had no handle zeroing at all. Not merely hygiene: the fence's Slot expansion is the latest value recovery sees for an entity, so an unzeroed handle would be written back into the recovered row and dangle. It also needs its own CollectionDelta batch, for the reason below.

    2. Zeroing the handle makes emission mandatory, not opportunistic. Once the payload's handle is zero, applying a Slot record sets the recovered row's handle to zero — so a Slot with no fold behind it empties the collection, including content that was already checkpointed and would previously have survived untouched. Every emitter that writes a Slot for a collection-bearing table must emit content, or the fix trades a dangling reference for silent loss.

    3. A pre-existing chunk leak, found by writing the "no orphaned chunks" test. BufferRelease and DeleteBuffer both walked the chunk chain from rh.FirstStoredChunkId — which is the append cursor (the tail), not the head. The head is the root chunk, where VariableSizedBufferAccessor starts reading. Releasing a multi-chunk buffer freed the tail and orphaned everything between; a single-chunk buffer has root == tail, which is why it survived. Both paths now walk from the root and drain the free-chunk chain too. Red before the fix, green after.

    Deliberate deviations from the frozen design

    D3's mutation-time journalling is unimplementable against this API: the accessor holds neither entity id, slot nor field id, is never given the Transaction, and the ref it binds may legally point at a stack local before the entity exists — that being the documented idiom for filling a collection before Spawn. Option B (full content at commit) has every fact in hand at the AddSlot line.

    EnsureBase is dead by construction and must stay that way. 03-recovery.md:143-145 cannot be implemented: once LOG-06 zeroes the handle there is no route from a record back to its buffer — reachable only through the row's inline _bufferId, no reverse index, no owner back-pointer on the buffer root. Complete emission means Clear always precedes the element ops, so the base is never consulted.

    FoldFlush must run AFTER the Slot apply, which the design never states. Load-bearing twice: a Slot apply overwrites the whole value, so an earlier flush is clobbered; and since the payload's handle is zeroed, the flush is what gives the collection back its buffer. Now recorded in AP-12.

    Follow-ups

    Verification

    Full suite 5150 passed / 0 failed (quarantine excluded) on the final run. Three earlier runs each produced one failure, a different test each time — WaitContextTests.HighFrequency_ShouldStop_Consistent, Transient_SpawnDestroy_Throughput, and the quarantined #400 Linearizability set — every one green in isolation and none touching collections or durability. That is #720's documented random-victim flake, baselined rather than assumed.

    check-rule-scopes ✅ · audit-rule-coverage ✅ (0 blocking) · check-doc-links ✅

  12. added a commit that references this issue on Aug 11, 2026
  13. moved this from In Progress to Todo in Typhonon Aug 11, 2026
  14. added a commit that references this issue on Aug 11, 2026
  15. nockawa commented on Aug 11, 2026

    @nockawa
    CollaboratorAuthor

    Closing — the last AC now has a test, not an argument

    PR #773 merged as 32de4c89 and carried every acceptance criterion except the last, which was answered by reasoning: "BL-01 holds — a SuppressWalSerialization UoW appends nothing, so it emits no CollectionDelta either." The reasoning is correct, and it was the only AC with nothing executable behind it — the same shape as the LOG-06 verifier this issue's own investigation retired in #703. It has one now.

    The argument, verified structurally

    All three emitters live in Transaction.BuildCommitBatch (Transaction.cs:2425, :2466, :2482). That method has exactly one caller — AppendToWal:2524 — and the gate is one line above it at :2516:

    if (State != TransactionState.Created && OwningUnitOfWork?.SuppressWalSerialization != true)

    So a bulk UoW cannot reach an emitter. BL-01 holds through this change by construction.

    A fact the AC's wording assumes away

    A bulk session cannot put an element in a collection at all. ComponentCollectionAccessor is obtainable only from Transaction.CreateComponentCollectionAccessor<T>, and BulkLoadSession exposes no transaction — its surface is Spawn / OpenMut / Update<T> / Destroy / CompleteBulkLoad. The only bulk-reachable shape is a collection-bearing component with a null handle. "BulkLoad's CC path" as the body describes it — pages written direct to .bin, fsynced by checkpoint — carries component rows, never collection content.

    That makes the interesting case the composition, not the bulk path alone: a row that arrived on the checkpoint timeline whose elements arrive later on the WAL timeline. That is precisely what this change made fragile — a Slot applied over an already-checkpointed row now zeroes the handle, so the fold behind it is the only thing that puts the content back.

    Two tests, in CollectionDurabilityTests

    Test Asserts
    BulkLoad_WithCollections_PutsNothingOnTheWire No record of any kind carries a bulk-spawned entity. An ordinary commit runs in the same session as a control and its CollectionDeltas are required to be present — without it the assertion holds equally on a scan that read nothing, which is a live failure mode here (the reader drain-gap BulkLoadRecoveryTests documents).
    BulkSpawned_ThenFilled_CollectionsSurviveAHardCrash Bulk-spawn → CompleteBulkLoad → ordinary commit fills the collections → SimulateHardCrash → reopen → elements intact, both storage homes.

    Falsified before being trusted: skipping the fill in the second test fails it (Failed: 1), so the assertion observes recovered elements rather than passing on an empty collection. Fixture: 14/14 green, ~0.9 s.

    Suite

    Category!=Quarantine (the merge gate's filter): 5238 passed, 1 failed — Transient_SpawnDestroy_Throughput, green on its own, and one of the three victims #773's own verification named. Unfiltered runs 3× with the change and 3× on unmodified main are indistinguishable: the same two quarantined #400 tests every run plus a rotating victim. One earlier run put ~10 victims in AxisArchetypesTests, which did not reproduce in 3 further runs and does not reproduce on main either — #720's band, baselined rather than assumed.

    Unrelated observation, filed nowhere

    Bulk-load → CompleteBulkLoad → SimulateHardCrash → reopen recovers all 16 entities, and open-time verification reports 1 non-fatal finding, verdict DataLoss, reproducibly. Collections are not involved — it reproduces with empty ones. It is plausibly the bounded page-leak BulkLoadRecoveryTests' remarks describe as deferred (Phase 3b, explicit page-free), now visible because #729's verifier ships. Not investigated, not filed — flagging it because "verdict DataLoss on a clean reopen" is a bad thing to leave undescribed.

  16. moved this from Todo to Done in Typhonon Aug 11, 2026
  17. added 2 commits that reference this issue on Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Priority

    P0-Critical

    Estimate

    L

    Area

    Durability

    Start date

    None yet

    Target date

    None yet

    Bug status

    Verified

    Product

    Engine

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions