FIX [CONTENT] Prevent FS sync from overwriting admin-edited content 🧿 #19
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.
🧿 Prevent FS Sync from Overwriting Admin-Edited Notes
This PR hardens the Lab Notes sync pipeline so filesystem imports never silently overwrite admin-authored content, while still allowing explicit overrides when intended.
✨ What Changed
Ownership-aware sync
import) and admin UI (web) as distinct truth channelsSafe by default
source='web'), FS sync:current_revision_idorpublished_revision_idExplicit override
forceoption to sync:POST /admin/notes/sync?force=1Visibility
pointersSkippedProtectedpointersForcedslug,locale,reason)🔒 Guard Logic (Summary)
Pointer updates are allowed only if:
force === true, orimportOtherwise, admin-owned revisions are protected.
🧪 Tests
Added coverage to assert:
web) revisions are not overwritten by FS sync🧠 Why This Matters
This change prevents a subtle but high-impact failure mode where:
The result is a clear, intentional content model:
📌 No Schema Changes
This PR is backend-only and uses existing fields (
lab_note_revisions.source) to enforce correctness.co-authored-by: Lyric lyric@thehumanpatternlab.com
co-authored-by: Carmel carmel@thehumanpatternlab.com