Skip to content

fix(appearances): warn at import when a Lottie names a remote asset - #21300

Merged
chenmingwei23 merged 2 commits into
mainfrom
fix/10271-remote-asset-parity-warning
Oct 17, 2026
Merged

chenmingwei23 merged 2 commits into
mainfrom
fix/10271-remote-asset-parity-warning

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

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[] or fonts.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

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 of website/src/lib/appearancePacks/lottieSafety.ts::referencesRemoteAsset. It answers the way JavaScript does: a missing key is not null, a boolean is never 1 or 0, and fPath is read for JS truthiness ({} and [] are true). Integers skip math.isnan, since a JSON integer past the float range overflows it. Clip text is parsed like JSON.parse (no NaN/Infinity).
  • src/kiro_crew/dashboard/appearances.py: bundle_remote_asset_warnings judges each clip a slot references, once per file. import_pack runs it after bundle_reference_error and BEFORE the write, then adds its lines to the answer's warnings only on success. A failing check therefore installs nothing.
  • Parity: website/src/test/fixtures/lottieRemoteAssetCases.json (60 cases): the JSON-shaped cases lottieSafety.test.ts already pins, plus e: 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. PackAvatar records 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 warnings list.

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 through references_remote_asset and 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 through referencesRemoteAsset.
  • test/test_appearance_library.py::TestImportNamesALottieThePlayerWillRefuse: an https:// image imports 200 with one warning naming idle.json; inline data URIs give no warnings; an integer fPath past 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 or bool == 1 makes 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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributed under the project's Apache-2.0 license.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of e50f2839b16a09b861e863f37e96243979576409 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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 lottieSafety.ts needs a new case there too.

Suggestions

  • Add a pointer in the header of lottieSafety.ts to lottie_safety.py and the shared fixture. Without it, someone changing the TypeScript check won't know there's a Python copy to keep in step, and the import warning starts giving the wrong answer.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of e50f2839b16a09b861e863f37e96243979576409 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: PASS

Check that the follow-up which shows import warnings in CrewAvatarLibraryTab.tsx replaces "the ghost" with words a user knows.

Suggestions

  • In the bundle_remote_asset_warnings string, change "shows the ghost once that clip comes up" to "falls back to the default avatar when that clip plays". "Ghost" is internal shorthand for the seeded placeholder, and the follow-up UI will show this text as it is.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — 🟡 CONCERNS

Premise-level review of e50f2839b16a09b861e863f37e96243979576409 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

Nothing reads the new warning: the dashboard's importBundle type drops warnings, so the person picking the file in the UI never sees it.

Not justified as shipped

  • Item 1 — zero consumers: the Goal says the importer "learns, in the import answer", but website/src/api/client/agents.ts:517 types that answer as {ok, id, error} only. I grepped \["warnings"\]|\.warnings across src/kiro_crew and website/src: the appearance import's warnings has 0 readers. Its two writers are transfer.py:556 and the new appearances.py:443.
    Subtraction: hold back lottie_safety.py, bundle_remote_asset_warnings and the 1,039-line parity fixture until a reader exists. As shipped, a 128-line JS-semantics port and its parity fixture must be kept in sync forever, and in-product no one reads the result.
    Clears when: a counted reader of the appearance-import warnings exists (UI, CLI or a named API caller), or appearances import: warn when a Lottie names a remote asset the player will refuse #10271 names a caller that reads the route's JSON directly.

What this change ships

Inventory (4 items) — 2 justified

Intent: the person importing a Lottie pack learns which clip the player will refuse for fetching a remote asset. FIX.

  1. Import answer lists a warning naming each referenced Lottie clip with a remote image or font — zero consumers: no UI or CLI reads appearance warnings
  2. Python port of the player's remote-asset check (lottie_safety.py) — rides along with item 1; it has no reader of its own
  3. Shared 60-case fixture run by both the Python and TypeScript suites — justified
  4. Check runs before the pack is written, so a failing check installs nothing — justified

[FIRST-PRINCIPLES-REVIEWED] e50f283

Description read

[DESCRIPTION-READ] e6100a9907ad382b80c07e790dfa26b8b343f2d6fd669e0f90f8435908a3336f

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed e50f2839b16a09b861e863f37e96243979576409 — this comment is updated in place on each push.

Review details

The 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 json.loads(text, parse_constant=_refuse_constant) raise ValueError. Any Lottie field with a 5,000-digit integer literal (e.g. "fr": 1000…0) is enough. The except (RecursionError, ValueError): return False then reports a clip with an https:// asset as not remote. Meanwhile JSON.parse in LottieRenderer.tsx reads that literal as Infinity, so referencesRemoteAsset refuses the clip. Result: import_pack returns ok with no warning, and the crew shows the ghost. → Fix: json.loads(text, parse_constant=_refuse_constant, parse_int=float), which matches JavaScript's double semantics, and add a fixture case with more than 4,300 digits.

[OPUS-REVIEWED] e50f283

Verdict parsed from the review's SHA-scoped output markers for commit e50f2839b16a09b861e863f37e96243979576409.

False positive or not applicable? A repository writer can comment:
/ai-review override fable e50f2839b16a09b861e863f37e96243979576409: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of e50f2839b16a09b861e863f37e96243979576409 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] e50f283

False positive or not applicable? A repository writer can comment:
/ai-review override gpt e50f2839b16a09b861e863f37e96243979576409: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 16, 2026
Zejiang Guo added 2 commits October 16, 2026 16:56
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.
@iamwhatever
iamwhatever force-pushed the fix/10271-remote-asset-parity-warning branch from 792a7cf to e50f283 Compare October 16, 2026 16:57
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 16, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Dispositions for the review of 792a7cfa28 (new head e50f2839b1, rebased on current main)

  • GPT 6.1 F1 (lottie_safety.py:48, huge integer fPath crashes after save) — fixed. Real and in scope. Integers now skip math.isnan (only floats use it). The warning is also judged before the write, so a failing check installs nothing. New tests: three past-float-range cases in the parity fixture (both languages agree they are remote), test_an_integer_past_the_float_range_warns_rather_than_failing, and test_the_warning_is_judged_before_the_pack_is_written. Both new route tests fail on the old code.
  • Design Review (companion import route gets no warning) — out of scope, stated. appearances import: warn when a Lottie names a remote asset the player will refuse #10271 names POST /api/appearances/import, beside bundle_reference_error. The Crew Companion app keeps its own library and import path. The description's "Not a goal" now says this.
  • First Principles item 1 (no UI reads warnings) — answered. appearances import: warn when a Lottie names a remote asset the player will refuse #10271 asks for the import answer's existing warnings list, and its acceptance is the API answer plus a parity test. Rendering it in the UI is listed under "Not a goal".
  • First Principles item 2 (port duplicates the TS predicate) — kept. appearances import: warn when a Lottie names a remote asset the player will refuse #10271 asks for the Python predicate at the import boundary and a parity test against the TypeScript one. The shared fixture is that test.
  • PR Hygiene — fixed. The description was rebuilt from the template. pr-description-check.sh passes locally.
  • Backend Tests (Windows) (1) — flaky, unrelated. test/test_mcp_rebuild_reconsumption.py::TestScopeOwnedIsExcluded::test_a_scope_owned_server_gets_no_record failed only because xdist worker gw2 crashed. This PR touches no MCP code. The new push reruns it.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 16, 2026
@chenmingwei23
chenmingwei23 merged commit 8ddb58b into main Oct 17, 2026
104 of 111 checks passed
@chenmingwei23
chenmingwei23 deleted the fix/10271-remote-asset-parity-warning branch October 17, 2026 05:37
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

appearances import: warn when a Lottie names a remote asset the player will refuse

2 participants