Repository navigation
feat(id-web): collab note-session wiring — WS note resolution + checkpoint publish on session end (#3819 slice 2) - #10831
Conversation
…he WS handler, publish checkpoints on session end (#3819 slice 2)
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 38 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Refs #3819 — Phase 3 slice 2 of 4 (route/WS wiring). Slice 1 (checkpoint core + note-ID session keying) landed in PR #10808.
What this slice wires
collab.rs): a WebSocketdoc_idof the formnote:<note id hex>now resolves a note session throughCollabState::get_or_create_for_note— by the note's stable ID, never by filename. Every otherdoc_idkeeps the exact filename path it had.parse_note_doc_idis the one place that decides which namespace adoc_idbelongs to.CollabState: anArc<Mutex<NoteCheckpoints>>plus the session-key → note-ID bindings recorded when a note session opens.seed_note_eventsrebuilds the log from applied note events (the restart/sync entry — the events are the durable state), andnote_eventsreads them back for persistence and sync.publish_note_checkpoint): takes the session's current plain text (the sameextract_plain_textthe save path uses), references it through the document path (DocumentRef::for_bytes), and records one signed revision in the core. The first publication establishes the note (create event = the note's own ID); later ones build on the single current head viacheckpoint_on_heads. A multi-head note refuses withExplicitMergeRequired— a save never joins concurrent heads silently. Event IDs are minted as a digest of note, author, parent heads, content, and session version.IdentityStore::author_key, the new accessor for the verifying half of the store's signing key). A refusal is logged, never fatal to the disconnect. Editor steps remain ephemeral — only this explicit publication crosses into the durable graph.Deliberately not in this slice
Tests
New in
collab.rs(all undercargo test -p id-web --lib collab):test_parse_note_doc_id— the wire form parses; filenames and malformed IDs do not.test_publish_note_checkpoint_creates_then_chains_on_the_head— first publish creates (note ID stable, one head), second publish chains on that head.test_publish_note_checkpoint_refuses_a_filename_session— no note, no checkpoint, nothing recorded.test_note_checkpoint_log_rebuilds_from_seeded_events— a fresh state seeded with the live log's events folds to the same heads and chains onto them (restart/sync at the wiring level).test_publish_note_checkpoint_refuses_to_join_concurrent_heads— a forked log (two heads) refuses publication withExplicitMergeRequiredand records nothing.Queue task 5826 (lane any-d). Slices 3–4 remain on #3819.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.