fix: stop older FableLoom peers erasing delivery plans and beat outlines (#6005) - #6120
Merged
Conversation
…nes (#6005) A FableLoom story synced from a peer running wire schema v3 or older lost its series delivery plan (overnight voicemails, inter-episode voicemails, the next-season teaser) and every episode's beat outline. Those peers cannot represent the fields, so their sanitizer drops them, and whole-record LWW then wrote the gap back over the upgraded install's copy. The receiver now restores both from the local record when a <=v3 sender omits them, keying the delivery-plan check on the key being absent rather than empty so a v4+ peer clearing a plan still propagates the clear. Both fields entered the wire schema at v4, so v4 and v5 senders keep their existing behavior. Also records the outline and delivery-plan fields in the v4 note in schemaVersions.js, which had shipped undocumented. Claude-Session: https://claude.ai/code/session_01VjkWVTfzKyRuAv3HEsspwN
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
A FableLoom story synced from a federated peer running an older wire schema silently lost data.
preserveLegacyVisualProductionretained render settings, protagonist bindings, and challenge mappings across a legacy whole-record LWW overwrite, but not the series delivery plan or the per-episode beat outline. A peer onfableLoomschema v3 or older cannot represent either field, so its sanitizer drops them and the merge wrote that gap back over the upgraded install's copy — erasing overnight/inter-episode voicemails, the next-season teaser, and every episode's outline plus its validation state.The receiver now restores both from the local record when a
<=v3sender omits them:preserveLegacyDeliveryPlanputsdeliveryOptions,interEpisodeVoicemails, andnextSeasonTeaserback, keying on the key being absent (hasOwnProperty) rather than empty, so a peer that understands the fields and clears them still propagates the clear.preserveLegacyStoryOutlinerestoreslocalEpisode.storyOutlinewhole when the remote episode carries none, and otherwise keeps today's per-sceneplotPointId/challengePhasemerge. This also lifts the outline branch out of the episode map, which was the densest nesting in the function.Scope notes (deviations from the filed plan, detailed in a comment on #6005)
Tracing when each field entered the wire schema changed two details of the proposed fix:
senderVersion < 4, not< 5. Both the delivery plan andepisode.storyOutlineshipped in the commit that bumpedfableLoomfrom 1 to 4, so a v4 peer round-trips them intact. Preserving at< 5would resurrect a plan or outline a v4 author deliberately deleted. The real loss window is v1–v3, and that is what closes here. The existing< 5handling ofplotPoints[].kind, outline-sceneplotPointId/challengePhase, andproductionStatusis unchanged.participationMode/audienceCommunicationMediumneed no preservation. They predate wire v1, so no sender version fails to represent them — every v1–v3 peer returns them intact. Adding preservation would instead discard a legitimate participation-mode change made on an older peer. That acceptance criterion is closed as not-a-bug.The v4 note in
server/lib/schemaVersions.jsnow records the outline and delivery-plan fields, which had shipped undocumented and cost this fix an archaeology pass.Test plan
cd server && npm test -- services/fableLoom/records.test.js— 54 passed.cd server && npm test -- services/fableLoom/ services/sharing/ lib/schemaVersions— 32 files / 854 tests passed.main's merge logic before the fix, green after.< 5cannot pass unnoticed.Closes #6005
https://claude.ai/code/session_01VjkWVTfzKyRuAv3HEsspwN