Repository navigation
fix(mochi): draw Lottie through core's fenced player - #11172
Conversation
UX Review (Fable 5) — ✅ PASSUX-level review of UX-Verdict: PASS Verify the four shipped ghost presets still animate in a live dashboard — the swap's only pixel risk, pinned by tests but never eyeballed. The diff adds or changes no user-visible control, string, or state: Mochi's vendored renderer becomes a re-export of core's player with identical output options ( [UX-REVIEWED] 97db919 |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify the four ghost presets still draw in a live Mochi widget — every test mocks Suggestions
[DESIGN-REVIEWED] 97db919 |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS One residual to weigh: the "loaded but painted nothing" DOM-outcome breadcrumb has no core equivalent, so a Mochi clip that loads yet draws blank is silent again. Every other dropped Mochi diagnostic is evidenced in the description (light player ships no expression machinery; Inventory (9 items) — 9 justifiedIntent: close #10249 — the one
[FIRST-PRINCIPLES-REVIEWED] 97db919 |
Opus 4.8 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Mochi's vendored `LottieRenderer.tsx` was the one `loadAnimation` call site in the tree without the remote-asset fence: a clip naming a remote image or font went straight to the player, which resolves those by requesting them from the dashboard's own authenticated origin. Mochi draws bundled presets today, so nothing crossed that gap yet, but a Mochi that accepts an imported pack would have. The file is now a one-line re-export of `components/appearancePacks/LottieRenderer.tsx`, the same shape as the vendored `SpriteRenderer` shim, so the other vendored files' import path stays byte-identical to upstream. One player, one fence. `lottiePlayerBoundary.test.ts` pins the convention the Design Review on #10108 asked for: the core renderer is the only production module that value-imports `lottie-web`, and it imports the light build. It replaces `mochiLottieLightPlayer.test.ts`, whose scope was `src/apps` only. The Mochi renderer pins now read the component through Mochi's own import path and hold it to the fence, and show every shipped ghost preset still clears the two checks core adds (document shape, asset references). Closes #10249
…the Mochi parse pin Mochi's copy of the player emptied its container before every build: `destroy()` removes only what the instance knows about, and one torn down before its SVG finished building (React's development double-mount gives every clip a load/destroy/load cycle) can leave an orphan node the next build then draws beside. Core's player had no equivalent, so the move in the previous commit would have dropped a behaviour, not a diagnostic. The guard now lives in core, pinned by a test that records the container's child count at each `loadAnimation` across a clip swap. `MochiPetWidget.coverage.test.tsx` read the old `[mochi]` parse breadcrumb; it now expects core's.
cd9cbbb to
97db919
Compare
iamwhatever
left a comment
There was a problem hiding this comment.
Approved after a full read of the diff on the current head: the change matches the linked issue and body, every load-bearing claim was spot-checked against main, tests pin the behaviour, all review lanes are clean and nothing is left undisposed on this head.
* fix(mochi): draw Lottie through core's fenced player Mochi's vendored `LottieRenderer.tsx` was the one `loadAnimation` call site in the tree without the remote-asset fence: a clip naming a remote image or font went straight to the player, which resolves those by requesting them from the dashboard's own authenticated origin. Mochi draws bundled presets today, so nothing crossed that gap yet, but a Mochi that accepts an imported pack would have. The file is now a one-line re-export of `components/appearancePacks/LottieRenderer.tsx`, the same shape as the vendored `SpriteRenderer` shim, so the other vendored files' import path stays byte-identical to upstream. One player, one fence. `lottiePlayerBoundary.test.ts` pins the convention the Design Review on kirodotdev#10108 asked for: the core renderer is the only production module that value-imports `lottie-web`, and it imports the light build. It replaces `mochiLottieLightPlayer.test.ts`, whose scope was `src/apps` only. The Mochi renderer pins now read the component through Mochi's own import path and hold it to the fence, and show every shipped ghost preset still clears the two checks core adds (document shape, asset references). Closes kirodotdev#10249 * fix(appearance-packs): empty the container before building; retarget the Mochi parse pin Mochi's copy of the player emptied its container before every build: `destroy()` removes only what the instance knows about, and one torn down before its SVG finished building (React's development double-mount gives every clip a load/destroy/load cycle) can leave an orphan node the next build then draws beside. Core's player had no equivalent, so the move in the previous commit would have dropped a behaviour, not a diagnostic. The guard now lives in core, pinned by a test that records the container's child count at each `loadAnimation` across a clip swap. `MochiPetWidget.coverage.test.tsx` read the old `[mochi]` parse breadcrumb; it now expects core's.
What
Mochi's vendored
website/src/apps/mochi/src/renderer/LottieRenderer.tsxis now a one-line re-export of core's fenced player,website/src/components/appearancePacks/LottieRenderer.tsx— the same shape as the vendoredSpriteRenderershim.git grep loadAnimation website/srcnow finds one production call site: the core renderer.A new structural test,
website/src/test/lottiePlayerBoundary.test.ts, pins the convention the Design Review on #10108 asked for: the core renderer is the only production module undersrc/that value-importslottie-web, and what it imports is the light build. It replacesmochiLottieLightPlayer.test.ts, whose scan coveredsrc/appsonly.Why
PR #10108 moved Crew Companion's Lottie player into core and fenced it:
referencesRemoteAssetrefuses a clip that names a remote image or font beforeloadAnimation, becauselottie-webresolves those by requesting them from the dashboard's own authenticated origin. Mochi's copy of the player had the light import but not the fence, so it was the oneloadAnimationin the tree an attacker-authored clip could reach unrefused. Mochi renders bundled presets today, so nothing crossed that gap yet — but the moment Mochi accepts an imported pack it would have, and the fence has to already be standing. One player means one fence to keep.How
apps/mochi/src/renderer/LottieRenderer.tsx: 266 lines → oneexport { LottieRenderer } from '../../../../components/appearancePacks/LottieRenderer'.PetWidget.tsxandGalleryPanel.tsxkeep importing./LottieRendererbyte-identical to upstream, as the vendoring rule requires (apps/mochi/README.md, updated to name both shims). Neither caller passesonReady/onError, so core's effect-dependency contract on those callbacks costs Mochi nothing.apps/mochi/test/mochiLottieRenderer.test.tsx: rewritten to read the component through Mochi's import path and hold it to the fence — a remote image and a remote font are each refused with noloadAnimationcall; a clean clip still loadsrenderer: 'svg', loop: true, autoplay: true(what Mochi's callers rely on); the shim resolves to the very same function core exports; and each of the four shipped ghost presets clears the two checks core adds that the old copy never ran (isValidLottieshape,referencesRemoteAsset), so the switch cannot have blanked the built-in ghost.test/lottiePlayerBoundary.test.ts: scans every production.ts/.tsxundersrc/(tests exempt,import type … from 'lottie-web'exempt), asserts the only value importer is the core renderer, that its only lottie specifier islottie-web/build/player/lottie_light, and a non-vacuity floor (>100 files scanned, the renderer among them).docs/system-specs/modules/learn-cron-dashboard.md: the appearance-library paragraph now names both shims and the new boundary test.components/appearancePacks/LottieRenderer.tsx(second commit): carries over the one behaviour Mochi's copy had that core lacked —container.replaceChildren()before building.destroy()removes only what the instance knows about; one torn down before its SVG finished building (React's development double-mount gives every clip a load/destroy/load cycle) can leave an orphan node, and the next build then draws beside stale children. Pinned by a new test that records the container's child count at eachloadAnimationcall across a clip swap after a "leaked" node ([0, 0]); red with the guard removed. Flagged by the First Principles lane on the first head — the first body's "diagnostics only" dropped-list was wrong about this hunk.test/MochiPetWidget.coverage.test.tsx(second commit): the parse-failure pin now expects core's[appearance-pack] lottie JSON parse failedbreadcrumb — the one test outside the Mochi Lottie suite that read the old[mochi]prefix (Frontend Tests (4) on the first head).Dropped with the copy: Mochi's
stripExpressions/countEffectsconsole warnings and its "loaded but painted nothing" breadcrumb. These were diagnostics, not behaviour — the light player ships no expression machinery (grep -c initiateExpression lottie_light.js→ 0), so a stringxis ignored whether or not it is deleted first, andmochiLottieAssets.test.tscontinues to pin that the shipped clips carry no expressions and no effects. Core's own parse/shape/fence refusals log under[appearance-pack]. Also new for Mochi clips: core'sisValidLottieshape check runs before the fence; all four shipped presets pass it (pinned).Tests
Run by path from
website/:Red on base / mutation-verified:
is core's player, both remote-asset refusals, boundaryno production module outside the core renderer).referencesRemoteAssetin core: both Mochi refusal tests red.lottie-web: boundaryimports the light player, and only the light playerred.replaceChildren()from core:hands the player an empty container…red.tsc --noEmitandeslinton the changed files: clean.Other
No user-visible UI change: the shipped presets pass the fence and render through the same light player with the same options, so
no-screenshotsapplies.iamwhateveris co-assigned on the issue as the deferred-finding author; no branch or PR of theirs covered it at preflight.Pattern harvest
Rule candidate:
lottiePlayerBoundary.test.tsPattern: when a sanitising wrapper moves into core, pin with a source-text scan that the wrapped dependency is value-imported by exactly one production module — a second importer is a second copy of the fence to keep.
Closes #10249