Scene document: accept the Stories fields from version 6 again

Early Stories builds wrote stories, storyThumb and storyTags in version 6
projects, so those projects load again; the fields stay refused before
version 6. The version 6 round trip is tested again.
This commit is contained in:
Sameh Khamis committed 2026-11-16 14:00:30 -08:00
1 parent 807e872731
commit 095e4161d8
4 files changed
+14 -10

No files matched your search

+2 -1
View File
@@ -97,7 +97,8 @@ export function validateSceneDocument(project) {
'shots',
...(version >= 4 ? ['anchors'] : []),
...(version >= 5 ? ['dataPacks'] : []),
...(version >= 7 ? ['stories', 'storyThumb', 'storyTags'] : []),
// Early Stories builds wrote these in version 6 projects.
...(version >= 6 ? ['stories', 'storyThumb', 'storyTags'] : []),
]);
uniqueId(scene, path, sceneIds);
optional(scene, 'title', path, (v, p) => string(v, p, 4096));
+5 -3
View File
@@ -2788,7 +2788,8 @@ test('story thumbnail and tags survive a reload and an export/import round trip'
try {
first.director.setSceneStoryThumb('scene-1', THUMB);
first.director.setSceneStoryTags('scene-1', ['Storms']);
saved = JSON.stringify(savedProject());
// Draft builds wrote the same optional Stories fields in version 6.
saved = JSON.stringify({ ...savedProject(), version: 6 });
} finally {
first.restore();
}
@@ -2818,19 +2819,20 @@ test('story thumbnail and tags survive a reload and an export/import round trip'
}
});
test('Stories fields are refused before document version 7, like other new fields', () => {
test('Stories fields are refused before document version 6, like other new fields', () => {
for (const [field, value] of [
['stories', true],
['storyThumb', THUMB],
['storyTags', ['Storms']],
]) {
const project = { ...structuredClone(PROJECT_FIXTURE), version: 6 };
const project = { ...structuredClone(PROJECT_FIXTURE), version: 5 };
project.scenes[0][field] = value;
assert.throws(
() => validateSceneDocument(project),
new RegExp(`scenes\\[0\\]\\.${field}`),
field,
);
validateSceneDocument({ ...project, version: 6 });
validateSceneDocument({ ...project, version: 7 });
}
});