feat: log first receipt of a brand-new doc id - #22
Draft
petergaultney wants to merge 1 commit into
Draft
Conversation
SyncKv already knows when the store held no snapshot for a key at load - that is the moment a doc id first exists on this server. Surface it as SyncKv::created() and log one line in build_doc with the doc id, the authenticated user, and the routing channel. Motivation: fleet debugging of files that reappear after deletion. The republished doc arrives under a brand-new id, and today nothing server-side records who introduced an id or when; client-side logs require access to every user's machine. With this line, 'who created the doc now living at this path' becomes a server-log grep by doc id. Caveat: 'created' means new to this server's storage, so a storage reset re-logs existing docs as new on next load.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🍋: drafted by an AI assistant working with @petergaultney
While debugging deleted files that reappear across a ~40-user fleet, the recurring dead end was attribution: a resurrected file arrives under a brand-new doc id, and nothing server-side records who introduced an id or when - client logs would require access to every user's machine. This PR adds one log line at the moment a doc id first exists on the server, carrying the doc id, the authenticated user, and the routing channel.
Technical details follow.
Change
SyncKv::newalready distinguishes "store returned a snapshot" from "store had nothing for this key" - the latter is exactly first receipt. Surface it asSyncKv::created(), and inbuild_docemit:useris the same value the existing "Loading doc" line andDocumentUpdatedEventalready carry.Caveats
Testing
cargo checkclean (one pre-existing dead-code warning elsewhere in y-sweet-core, untouched).