Skip to content
quarry Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: ca59baa859e1fbc895db1f6863871f11fdabf4fadf3b6858cd9540a8e34cfcda
Ticket: 0c51d50626446d4f6139a09ed55485fd30cf0a8b
A failed fold must never advance the cursor: silent, permanent index loss
User & Date: dmestas on 2026-08-19 12:29:31
Changes

  1. icomment:
    Fixed in 02f05e42.
    
    **The invariant, enforced structurally:** `watch` no longer saves the
    publisher cursor — it returns a save closure, and `round` invokes it
    only after the final fold succeeds. A failed fold now costs one
    re-read-and-republish of the same tail next round (idempotent folds
    absorb it); it can no longer cost artifacts. `TestFailedFoldDoesNotAdvanceCursor`
    reproduces the incident shape (fold failing the way the schema bug made
    it fail) and pins the cursor in place.
    
    **Stop and alarm:** after 3 consecutive failures the pipeline STALLS —
    one loud log line with the cause, `stalled` + `retryAt` on the health
    surface and a red badge on /fleet, and exponential backoff (30s
    doubling, capped 10m). Backoff rather than a latch: the store is intact
    and the cursor held, so when the cause is fixed the next attempt heals
    with no operator ceremony. `quarry reindex` bypasses the stall
    deliberately. While stalled, `Sync` returns `ErrStalled`; the poller
    does not re-log it, and a write op treats it as lag rather than failing
    a write the store already recorded.
    `TestStallBacksOffAlarmsAndRecovers` drives the full arc: fail, stall,
    refuse, heal.
    
    **Found while testing:** a round after a failed fold blocks in the
    drain loop up to the consumer's AckWait (30s) waiting for redelivery.
    The wait is honest — breaking early would let the cursor save with
    messages unfolded — so it is now an explicit, configurable knob
    (`ackWait`) rather than an accident of NATS defaults.
    
    **Remaining (not blocking closure):** the generalized per-round
    completeness invariant. `lostArtifacts` already probes dangling parents
    each round and feeds Gaps on /fleet; widening it beyond parent edges is
    follow-on work, tracked alongside #d725bd29c5 where the question is
    live.
    
  2. mimetype: "text/x-markdown"
  3. resolution changed to: "Fixed"
  4. status changed to: "Fixed"