Artifacts Associated With Ticket 0c51d50626446d4f6139a09ed55485fd30cf0a8b
Ticket change [635a0488b1] (rid 1051) by dmestas on 2026-08-19 10:43:52:
- Untracked field cmimetype: "text/x-markdown"
- comment initialized to:
A fold that fails leaves its artifacts unacked, the publisher cursor advances on a later healthy round, and the messages age out of the bounded stream (1 GiB, one hour, discard-old). The artifacts are then never republished. Nothing errors at the moment of loss. Every surface built on the index renders the hole as if it were the truth, and the only repair is a full store re-read, which needs exclusive access to the index files — so recovering costs an outage. Observed twice now: - as "2 branches on the timeline" when a check-in went missing; - again on 2026-08-19, when a schema change made every ticket fold fail with "no such column". Folds errored for minutes, the cursor advanced, and `ticket_change` went to 0 rows on a store that holds thousands. The failure was loud in the log and completely invisible in the data. ### Required **A failed fold must not advance the cursor.** Retry with backoff; if an artifact keeps failing, stop the pipeline for that repository and alarm. A stalled indexer that says so is strictly better than a silently incomplete one that looks healthy — the store is always correct, so stopping loses nothing but time. ### Also needed - A post-fold completeness invariant: artifacts the store holds versus artifacts the index accounts for, checked per round, alarming on divergence. `lostArtifacts` already does this for dangling parents; generalise it rather than adding a second mechanism. - The check belongs in the serving path, not only in the harness. The disposability test proves a rebuild is faithful; nothing currently proves the RUNNING index is. Related: #d725bd29c5 (tk: artifacts the store holds are missing and a rebuild does not repair it) is very likely the same root cause.
- priority initialized to: "Immediate"
- severity initialized to: "Critical"
- status initialized to: "Open"
- subsystem initialized to: "ingest"
- title initialized to:
A failed fold must never advance the cursor: silent, permanent index loss
- type initialized to: "Code_Defect"
Ticket change [eb68502359] (rid 1106) by dmestas on 2026-08-19 12:10:37:
- subsystem changed to: "ingest"
Ticket change [ca59baa859] (rid 1147) by dmestas on 2026-08-19 12:29:31:
- 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.
- mimetype: "text/x-markdown"
- resolution changed to: "Fixed"
- status changed to: "Fixed"
- icomment:
Ticket change [e71bfd2c6e] (rid 12472) by zeitgeist on 2026-09-24 00:53:01:
- Untracked field number: "37"