Skip to content

fix(faucet): start a redelivery gap where the read it stands for stops - #36

Merged
ThomasK33 merged 3 commits into
mainfrom
fix/redelivery-gap-overlap
Nov 16, 2026
Merged

ThomasK33 merged 3 commits into
mainfrom
fix/redelivery-gap-overlap

Conversation

@ThomasK33

Copy link
Copy Markdown
Member

Why

The redelivery sweep promises that every failed delivery ends recovered, given up, or inside a counted gap. A gap starts at the old position, but the read it stands for goes 5 minutes lower, to catch attempts that GitHub writes late. A late failure listed in those 5 minutes ends in neither a read nor a gap. This fix needs no clock change, so it ships ahead of the #26 redesign.

What changed

  • A gap now starts where its read stops, at the old position less RedeliveryReadOverlap. This applies in three places: the head after a long cron outage, a range that expires unread, and a range read to the end of the list.
  • New tests in faucet/redeliver_gaps_test.go cover each place. The first commit adds them, and they fail on main.
  • The README gap entry says that a gap includes the overlap.

Scope

Blast Radius

Gaps get 5 minutes wider at their old end. A quiet hook logs its gap after a cron outage of 71h55m instead of 72h. A range opened by the first run can overlap the first run's gap by 5 minutes. Gaps can overlap, and no code assumes that they do not. These two effects come from reading the code. No test covers them.

Verification

  • Each new test fails at the test commit, and each place has its own test: putting back main's code in one place fails one case.
  • With Postgres, go test -race ./... passes. go vet passes, and golangci-lint reports 0 issues.
  • e2e in verify/: 234 of 234 passed.

Refs #26


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

GitHub writes an attempt down when it ends, so a failure can be listed a
few seconds below the position of the run before. A read reaches
RedeliveryReadOverlap below that position, but the gap that stands for
an unread read starts at the position itself. A late failure in that
overlap that no run reads before GitHub deletes it ends in neither a
read nor a gap.

The new tests list a failure L 3 seconds below the position A, after the
run that read A, and check that L ends tracked, stored or inside a
logged gap. Each case reaches one of the three places where a gap
replaces a read:

- the head reads to the end of the list after a cron outage longer than
  GitHub's retention;
- a range left open by a burst expires unread;
- a range is read to the end of the list after GitHub deleted L.

All three fail on main. requireNoSilentLoss now prints the logged gaps,
so a failure shows how far above L each gap starts.
A read of the head or of a range stops RedeliveryReadOverlap below its
old end, because GitHub lists an attempt that ended late below one that
ended earlier. The gap that a run records in place of that read started
at the old end, so a late failure in the overlap that GitHub deleted
before any run read it ended in neither a read nor a gap.

The three gaps that stand for a read now start at the read's bound:

- the head's gap when it reads to the end of the list;
- the gap of a range that expires unread;
- the gap of a range that is read to the end of the list.

The first run's before-tracking gap keeps its start, because that read
has no overlap. The gaps that a hook change closes in the stores keep
theirs too.

TestRedeliverRecordsOnlyTheExpiredPartOfARangeAsAGap now expects the gap
to start the overlap below the earlier position. The Redeliver doc
comment and the README's `gap` state say that a gap holds the overlap.
---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
@ThomasK33
ThomasK33 merged commit e8382ff into main Nov 16, 2026
9 checks passed
@ThomasK33
ThomasK33 deleted the fix/redelivery-gap-overlap branch November 16, 2026 09:26
ThomasK33 added a commit that referenced this pull request Nov 16, 2026
…d above it

Since #36 the gap of a range that closes unread starts at OlderAt - O,
but it still ended at max(NewerAt, OlderAt). A range whose NewerAt lay
inside the overlap below OlderAt then logged a gap up to 3 minutes above
the oldest attempt that a run had read. UnreadGap now ends at
max(NewerAt, OlderAt - O), rule 8's [OlderAt - O, NewerAt], for the
expired ranges and the ranges of a changed hook.

The #36 test "the range expires unread" closes its range by reading it,
because its one run after the outage still has the Date from before it. A
new test closes a range in the run after that, without a page for it, and
checks both ends of its gap.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant