Repository navigation
fix(appearances): warn at import when a Lottie names a remote asset - #21300
Conversation
d39f8d9 to
792a7cf
Compare
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Check one thing before merge: the server copy of the remote-asset check matches the player's only on the 60 shared fixture cases, so a change to Suggestions
[DESIGN-REVIEWED] e50f283 Description read[DESCRIPTION-READ] dc9155fadcc4dcb67a94fed391ee537c5aa85f4af3788b496591ce56dcf194d4 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Check that the follow-up which shows import Suggestions
[UX-REVIEWED] e50f283 Description read[DESCRIPTION-READ] 442a6f351e60bc827a0376d6209acd85acec7c620ccfae688b8c81415c8353ac That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS Nothing reads the new warning: the dashboard's Not justified as shipped
What this change shipsInventory (4 items) — 2 justifiedIntent: the person importing a Lottie pack learns which clip the player will refuse for fetching a remote asset. FIX.
[FIRST-PRINCIPLES-REVIEWED] e50f283 Description read[DESCRIPTION-READ] e6100a9907ad382b80c07e790dfa26b8b343f2d6fd669e0f90f8435908a3336f That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Review detailsThe import warning can be silenced by one oversized integer in a clip. Advisory only: the player still refuses the clip. FINDING — src/kiro_crew/appearance_packs/lottie_safety.py:124 — CPython's 4,300-digit limit on int conversion makes [OPUS-REVIEWED] e50f283 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 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: |
The player refuses a clip whose assets or fonts it would fetch and draws the ghost, with the reason only in the console. POST /api/appearances/import now runs a port of referencesRemoteAsset over each referenced Lottie clip and names the file in the answer's warnings. A warning, never a refusal. A shared fixture runs the same cases through the TypeScript predicate and the Python one, so the two cannot drift. Closes #10271
math.isnan overflows on a JSON integer past the float range, which raised after the pack was already written. Integers now skip isnan, and the warning is judged before the write so a failing check installs nothing. Three past-float-range cases join the parity fixture.
792a7cf to
e50f283
Compare
|
Dispositions for the review of
|
Problem / Motivation
Goal: The person importing an appearance pack learns, in the import answer, which Lottie clip the player will refuse for naming a remote image or font.
PR #10108 made the player refuse a Lottie clip whose
assets[]orfonts.list[]it would fetch. The crew then wears the seeded ghost, and the reason goes only to the browser console. The import itself answers 200 with no hint, so the pack looks fine and then cannot be worn.Why it matters
Anyone importing a third-party Lottie pack with an external image or webfont hits a dead end with no explanation. The import answer is the one place the person who picked the file is reading.
Not a goal
warningsin the crew library import UI (CrewAvatarLibraryTab.tsx). That is also true of the existing sound warnings today. appearances import: warn when a Lottie names a remote asset the player will refuse #10271 asks for the import answer'swarningslist./api/apps/crew-companion/appearances/import). appearances import: warn when a Lottie names a remote asset the player will refuse #10271 namesPOST /api/appearances/import, besidebundle_reference_error. The app keeps its own library and import path, and the dashboard module does not reach into it.lottieSafety.tsstays the safety boundary. Nothing here fetches anything.What changed (motivation → approach → change)
Symptom: a refused clip imports clean. Cause: the import never applied the player's predicate. #10271 asks for that predicate at the Python import boundary, with a parity test against the TypeScript one.
src/kiro_crew/appearance_packs/lottie_safety.py: a line-for-line port ofwebsite/src/lib/appearancePacks/lottieSafety.ts::referencesRemoteAsset. It answers the way JavaScript does: a missing key is notnull, a boolean is never1or0, andfPathis read for JS truthiness ({}and[]are true). Integers skipmath.isnan, since a JSON integer past the float range overflows it. Clip text is parsed likeJSON.parse(noNaN/Infinity).src/kiro_crew/dashboard/appearances.py:bundle_remote_asset_warningsjudges each clip a slot references, once per file.import_packruns it afterbundle_reference_errorand BEFORE the write, then adds its lines to the answer'swarningsonly on success. A failing check therefore installs nothing.website/src/test/fixtures/lottieRemoteAssetCases.json(60 cases): the JSON-shaped caseslottieSafety.test.tsalready pins, pluse: true,e: 1.0,p: null,origin: false,fPath: [], and three integers past the float range. Both suites run every case.Warning text:
That bundle's idle.json names an image or font the player will not fetch, so a crew wearing this pack shows the ghost once that clip comes up.PackAvatarrecords a refusal against the whole pack, which is why it says the crew, not the slot.Why server-side rather than only in the client: #10271 asks for the warning in the import answer and for a Python predicate that agrees with the TypeScript one. The API answer is also what any caller of the route reads, not only this UI.
Backwards compatibility
Compatible: the import accepts and refuses exactly what it did; it only adds lines to the existing optional
warningslist.Removes nothing: the change adds a warning and a predicate; no key, path, validator or record is taken away.
Tests
test/test_appearance_packs_lottie_safety.py: every fixture case throughreferences_remote_assetand through the text entry point; text the player cannot parse (NaN,Infinity, BOM, unclosed nesting) is not called remote.website/src/test/lottieSafety.test.ts: every fixture case throughreferencesRemoteAsset.test/test_appearance_library.py::TestImportNamesALottieThePlayerWillRefuse: anhttps://image imports 200 with one warning namingidle.json; inline data URIs give nowarnings; an integerfPathpast the float range answers 200 with the warning; a failing check leaves no pack installed; only referenced clips are judged, once each.Run locally at the head:
pytest test/test_appearance_packs_lottie_safety.py test/test_appearance_library.py test/test_appearance_packs_transfer.py test/test_appearance_packs_sounds.py(445 passed),vitest run src/test/lottieSafety.test.ts(83 passed),tsc -p tsconfig.app.json, black, ruff, comment-history and feature-map gates. Mutation check: Python truthiness orbool == 1makes parity cases fail.Manual verification
N/A — unit coverage sufficient: the change is a pure function plus one list append on an existing route, both covered through the route.
Related Issues
Closes #10271
Pattern harvest
Rule candidate: review-prompt
Pattern: a Python port of a JavaScript predicate must not use Python truthiness,
bool == int, or float-only math (math.isnan) on unbounded JSON integers; pin it with a fixture both languages run.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.