Skip to content

docs(adr): accept ADR-0026, hold the cursor until a resubscribe round is complete - #61

Merged
grrowl merged 7 commits into
mainfrom
docs/adr-0026-accepted
Nov 17, 2026
Merged

grrowl merged 7 commits into
mainfrom
docs/adr-0026-accepted

Conversation

@grrowl

@grrowl grrowl commented Nov 17, 2026

Copy link
Copy Markdown
Owner

Adds ADR-0026 as an accepted design. No code changes.

The decision

After a reconnect the client resubscribes every collection, and each answer can move the one shared cursor. If one subscription moves it before another has caught up, a second drop makes the slower one resume past changes it never received. tests/cursor-resubscribe-round.test.ts on main reproduces the loss with expected failures.

The ADR holds the cursor for the subscriptions that were already caught up when the round started, until each of them has its answer. It also says what happens when an app callback throws inside a round (the round is abandoned through the reconnect policy), and how a reset and a restarted watch behave.

Status

Accepted as a design, not built. Two things are built first, in this order:

  1. The server closes the socket when a subscription fails unexpectedly. The design needs every subscription in a round to get an answer or the socket to close.
  2. The transport part of this ADR.

How it was checked

An independent check of the original proposal ran probes in workerd and overturned its first rule. Four adversarial reviews of the rewritten text followed, by a different model than the author. The last found no blocker. The probes were throwaway and are not in the repository; each fact the ADR takes from them is pinned by a test in its validation contract, except one that only motivates deferred work.

🤖 Generated with Claude Code

grrowl and others added 7 commits November 17, 2026 12:54
Limit the cohort to bootstrapped entries, preserve reset and seed repair, and defer adapter export work. Record the independent evidence and the revised implementation pins.

Co-Authored-By: Codex <noreply@openai.com>
Require server reply or close before the transport change, stop on synchronous callback failure, narrow export promises, and add discriminating validation pins.

Co-Authored-By: Codex <noreply@openai.com>
Replace the second revision's permanent transport stop with the policy
review 2 recommends. A callback that throws while a round is held
completes and releases nothing; the round is discarded, the socket is
replaced through the reconnect policy, and the error is rethrown. Outside
a held round today's behaviour stays. Add the four riders: backoff is not
reset after such an abandonment until a round completes, bootstrapped is
set only after the terminal callback returns, a reset dispatch runs every
callback and rethrows the first error, and a throwing restart callback
abandons its socket attempt.

Narrow the server prerequisite to "no reply reaches the client after the
failure", state what the client shows for both a refusal and a close of a
cohort entry, note that every server reset is scoped, and note that
ignoring unknown scoped boundaries changes behaviour outside a hold. Name
the gap that stays outside a round under the deferred decisions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… backoff rules

Answer review 3 of ADR-0026. Rider 2 left an on-demand watch whose first
terminal callback threw after commit unbootstrapped, so a later drop
restarted it through dropHolds and lost rows of covered fetches. A watch
the adapter has accepted now treats onRestart as its onReset does, so the
build touches do-collection.ts. State the liveness cost of a row that
throws every round, let an unscoped reset finish its cleanup after a
socket change, report a restart callback's error uncaught, and restore the
lost pin details and the three ssr-adapter test names.

Take in two decisions made outside this ADR. The server refuses
deliberately and closes with 1011 on an unexpected failure; D4 drops fetch
and splits its pin by outcome. Rider 1 now points at the ADR-0016 backoff
amendment and requires abandonment to go through the reconnect policy,
not forceReconnect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t scope

Answer review 4 of ADR-0026. The watch pin now uses a bounded watch and a
covered fetch outside its snapshot window, so it fails without the adapter
change, and asserts the old sub id is not resent and each replacement is
sent once. Rider 2 gives the stronger reason (live-delta rows beyond the
window are lost too) and states the cost. An unscoped reset skips entries
removed or replaced by earlier callbacks. A receipt that rejects after its
callback returned is listed as not covered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace local paths, thread ids, a work branch and commits of this ADR's
own earlier texts with descriptions a reader of the repository can
follow. Point the refusal rule at pull request #60 and the backoff rule
at pull request #59, and state that the 1011 close rule has no ADR or
code yet and must come before the transport build. Mark the ADR and its
index row accepted as a design, not built yet. No design sentence
changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… is complete

The design is accepted after an independent check and four reviews. It is
not built yet. The server close rule for an unexpected failure is built
first, then the transport part.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@grrowl
grrowl merged commit 3a5b80c into main Nov 17, 2026
8 checks passed
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