Repository navigation
fix(core): an undo of a colour grade applies in place in a sealed preview - #8457
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Edit accuracy: accurate 271 (base branch 271), smooth 74 of thoseThe gate passes. Quarantined, measured but not gated (0) |
terencecho
left a comment
There was a problem hiding this comment.
P2 — Record the duration probe’s preload write. packages/core/src/runtime/init.ts:2780 now sets el.preload = "metadata" directly in armLength. On a future video whose duration is still unknown and whose markup omits preload, that creates an attribute the restore planner treats as authored. A grade undo then returns refused and falls back to reloading the preview.
I reproduced this with the runtime seek fixture and a future clip without data-duration or preload. The probe passes when armLength calls setRuntimePreload(el, "metadata"). Please use that helper and add the future-clip case to the regression coverage. The other 302 focused tests passed.
— tai (automated review)
|
Fixed at
|
terencecho
left a comment
There was a problem hiding this comment.
The duration probe now marks the preload it adds, so grade undo on the far clip applies in place. All 78 focused runtime entry and restore tests passed. The new regression fails with the previous preload write. GitHub checks passed.
— tai (automated review)
488ce05
into
feat/player-sealed-by-default
What
In a sealed preview, undoing or redoing a colour grade on a video clip now puts the grade back on screen in place. Before, the frame refused the change and the preview had to reload, and the panel and picture lagged behind the file.
This PR makes two changes to what an undo may change in a sealed frame:
data-color-gradingto the restore allowlist.crossoriginandpreloadas attributes the undo would drop when the runtime itself added them to that element, as recorded by the runtime. The same attributes written in the film's own file are still dropped (and refused) as before.Builds on #8142 (its sealed CORS writer is where
crossoriginis recorded), so it merges after it.Why
An undo in a sealed preview sends each changed element's restored attributes into the frame (
restore-attributes). The frame sets only attributes on its allowlist (#8057), so a saved file can't get handler or URL attributes set in the frame.data-color-gradingwasn't on it, so every grade undo was refused (applied: false) and the parent fell back to a full reload. Unsealed, the same undo syncs the attribute onto the live element, and the runtime's grading observer redraws in place.With the grade allowed, a video clip's undo was still refused: the planner compares the element's attributes with the file's, and every video in a sealed frame carries a
crossorigin(added by the sealed CORS writer) and apreload(set by the media scheduler) that the file doesn't have. Both looked like attributes the undo would have to drop, and dropping is only allowed for a short safe list.How
restore-attributesacceptsdata-color-grading, and only through core's own grade parser. The value is parsed bynormalizeHfColorGradingand rebuilt withserializeHfColorGrading; the raw string is never copied through. A value the parser rejects is refused.applied: false, so the preview reloads as today). The LUT is the only part of a grade that makes the runtime load anything:lut.srcis resolved against the page and fetched.normalizeHfColorGrading):enabledfalsemeans no gradepresetintensityadjust,details,effectswheels,curves,hueCurvessecondariespalettelut{ src, intensity };srcis a pathsrcis fetched, so a newsrcis refusedcolorSpaceUnknown keys are dropped by the rebuild.
runtime/runtimeAttributes.tskeeps, per element, the attribute names the runtime added. The sealed CORS writer (write()) recordscrossoriginwhen it sets it and forgets it when it removes it, or when the film itself changes it. Every runtime write ofpreloadgoes throughsetRuntimePreload, which recordspreloadonly if the element had none. The planner leaves recorded attributes alone and treats everything else as before. There is no list of names: acrossoriginorpreloadthe file wrote is not recorded and still counts as dropped.Before
After
Test plan
fails without the fix: "is put back in place, rebuilt from the grade's own fields rather than copied" in packages/core/src/runtime/editing/restoreAttributes.test.ts
restoreAttributes.test.ts, three new rows: the grade is applied as its rebuilt form, never the raw string (with an unknownonloadkey that doesn't survive); a grade naming a LUT the clip doesn't use is refused and the DOM is untouched; a grade keeping the clip's own LUT applies. On main the first and third fail. Each guard is shown to bite: copying the raw value fails the rebuild row, and skipping the LUT check fails the refusal row.crossorigincame through the sealed CORS writer and whosepreloadcame from the runtime keeps both and the undo applies; the same attributes written in the file are still dropped (refused, DOM untouched); once the film changes the runtime'scrossoriginitself, it is no longer kept. Each fails with its piece removed: fix(player): a sealed player plays media from hosts without CORS and names a missing runtime #8142's writer without the record fails the first, and dropping the forget fails the third. 14 of 14, 3 runs in a row;sealedMediaCors,preloadMediaandmediatests green (293); coretscclean.