githubnext/chopinPublic

Let's compose rich plans together

Open the document when the transport can carry it

A transport comes up on its own schedule and whatever mounted against it does
not. The provider opened the document once, when the editor mounted, so a
socket still mid-handshake cost the plan entirely: ask refused with "not
connected", nothing tried again, and the editor sat locked for the session
under a status chip still saying "Loading". Whether it happened came down to
whether the handshake beat MDXEditor's initialisation, which is why it only
bit sometimes.

The same gap swallowed reconnects, and worse. #open is the only thing that
asks for the updates missed while the connection was down, and the only thing
that replays the outbox — so a client came back unlocked over a document
quietly short of everyone else's edits, with no way to notice.

Both are one mechanism: resume() opens the document if it is not open and
brings it up to date if it is, and PlanEditor calls it whenever the connection
says it can carry a request. #open already handles either case, sending the
epoch and state vector so a resume fetches only the difference. Transport
gains an optional `connected` so the provider can ask rather than assume, and
resume stays quiet when the answer is no — the connection will say when it
changes.

Both bugs predate the comments work; the error surfacing added alongside it is
what made them visible rather than a silent permanent "Loading". The guards in
that commit stay: a throw there would still lock the room, and they are what
made this diagnosable. They were not the fix.

Five tests, each verified by reinstating the fault.
KCKrzysztof Cieslak authored
9aaab79Patch
Parent8328c88
6 files changed+180-5
StackedSplit
agents.md+9 −0
apps/web/src/wire.ts+11 −0
packages/editor/src/plan-editor.tsx+17 −0
packages/editor/src/provider.test.ts+96 −3
packages/editor/src/provider.ts+35 −2
packages/editor/src/transport.ts+12 −0