Conversation
The first-run demo bootstrap saved the welcome notebook and note with the default LOCAL_ONLY sync_status. When the same data dir backed both the WebDAV server and a sync engine (e.g. `python main.py` followed by `/sync/trigger`), the engine selected the welcome note for push and hit the WebDAV server with PUT note.json + page_1.ink. Any failure on that path surfaced as an opaque "WebDAV upload failed: 500 Internal Server Error" with no actionable reason. - Extract demo bootstrap into `seed_demo_data` and mark the seeded notebook + note as SYNCED so a sync engine sharing the data dir never picks them up for push. The fallback "Uncategorized" notebook is also marked SYNCED for the same reason. Title/content are unchanged on disk so the storage layout stays compatible. - Wrap `_serialize` in NoteMetaFile / InkFile so a serialization failure raises a DAVError carrying the offending field's reason via `context_info`, instead of crashing into a bare 500. WsgiDAV's ErrorPrinter surfaces that reason in the response body. - Wrap path generation and payload serialization in `_push_note` so the sync report carries a useful "serialization failed: …" reason instead of a raw traceback. - Add a focused test class exercising the welcome-note round-trip: self-sync no-op, fresh client pull marks SYNCED, fresh client push to an empty server, and a serialization-failure path. The title is read from the seeded demo so the test isn't pinned to a literal. https://claude.ai/code/session_01AydQTDSxkhVgZy2TVXuFDr
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.
Summary
This PR fixes a critical bug where seeded demo content (welcome note) on a fresh server would trigger 500 errors when a sync engine ran against the same data directory. It also improves error reporting for serialization failures throughout the sync pipeline.
Key Changes
Demo data seeding improvements:
seed_demo_data()function inserver.pySyncStatus.SYNCEDso sync engines don't attempt to re-push it to itselfensure_default_notebook()to also mark the fallback notebook asSYNCEDSerialization error handling:
_serialize()methods in bothNoteMetaResourceandInkPageResourcewith try-catch blocks_push_note()to catch failures during slug computation and payload serializationTest coverage:
live_server_with_demofixture for testing against a server with seeded demo contentTestDemoSeedclass to verify demo data is created with correct sync status and is idempotentTestWelcomeNoteSyncclass with three scenarios:TestPushSerializationFailuresto verify serialization errors surface useful error messagesImplementation Details
The root cause was that demo notes were created with default
SyncStatus.LOCAL_ONLY, causing sync engines to treat them as new local content requiring push. When pushing to the same server, this could fail with unhelpful 500 errors. By marking demo content asSYNCED, it's treated as already-synchronized and skipped during push operations.Serialization errors are now caught at multiple levels:
https://claude.ai/code/session_01AydQTDSxkhVgZy2TVXuFDr