1644de87f7
Reviewer changes-requested on #565. F2 (real bug): a save on an empty page (or a missing page row) hung the client for the full 20s ack window and then falsely reported the collab server as unreachable + advised retry. Root cause: handleSaveVersion gated its broadcastStateless on `if (result)`, and `result` stays undefined on the two reachable early returns (isEmptyParagraphDoc and !page), so the server sent NOTHING and the client waited out its timeout. - SERVER (persistence.extension.ts): both early-return branches now record a skip reason and the tail broadcasts a terminal `version.skipped` reply (reason 'empty' | 'page-not-found'). Exactly one terminal reply per handled save. Added VERSION_SAVED/VERSION_SKIPPED message consts. - CLIENT (collaboration.ts): the predicate now matches both version.saved and version.skipped; SaveVersionResult gains {saved, skipped, reason}. An empty skip resolves to a clean {saved:false, skipped:true, reason:'empty'} (no stall); page-not-found throws an immediate, truthful error; the genuine no-reply timeout path is unchanged (that is the real "unreachable" case). A terminal reply leaves the session cached (healthy connection); only a transport failure destroys it. Kept the message-literal in-sync comments. - tool-specs.ts / pages.ts: description + docstring reflect the new result shape. F1 (coverage): added tests for the 4 previously-uncovered sendStatelessAndAwait branches — unrelated-then-real (predicate filters noise), teardown-mid-wait (rejects + removes the stateless listener, no leak), concurrent-in-flight guard — plus the F2 empty-skip / page-not-found client outcomes. Server spec gains empty-page and page-not-found terminal-reply tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>