5.9 KiB
5.9 KiB
Title
sprimo-tauri runtime shows TypeError: W.fromURL is not a function; sprite renderer fails to initialize.
Severity
P1
Environment
- OS: Windows
- App:
sprimo-taurifrontend/runtime path - Reported on: 2026-02-13
- Evidence screenshot:
issues/screenshots/issue2.png
Summary
At runtime, the Tauri UI loads but Pixi sprite rendering fails with:
TypeError: W.fromURL is not a function
This breaks sprite presentation and leaves the UI in an error state.
Reproduction Steps
- Build UI assets and start the Tauri app (
just build-tauri-ui,just run-tauri). - Open the Tauri window and wait for sprite pack initialization.
- Observe the debug panel error and missing pet rendering.
Expected Result
- Pixi atlas texture loads successfully from
atlas_data_url. - Pet sprite renders and animates.
- No renderer initialization error in UI.
Actual Result
- Renderer initialization fails with
TypeError: W.fromURL is not a function. - Sprite is not rendered.
Root Cause Analysis
frontend/tauri-ui/src/renderer/pixi_pet.tsusedBaseTexture.fromURL(...).- In the current Pixi package/runtime composition, that API path is unavailable at runtime
(minified symbol resolves to
W.fromURL, which is undefined). - Result: atlas load throws before a valid sprite texture can be applied.
- Follow-up finding: Tauri can run previously embedded frontend assets if Rust build is not re-triggered after UI-only changes, which can make old errors appear even after source fixes.
- After stale-build issue was resolved (
ui build: issue2-fix3visible), a second runtime defect became clear:event.listen not alloweddue missing Tauri capability permissions for event listen/unlisten.- sprite pack still rendered with magenta matte because tauri path lacked chroma-key conversion.
Fix Plan
- Replace
BaseTexture.fromURLusage with Pixi assets loader (@pixi/assets+Assets.load). - Ensure sprite texture is assigned immediately after renderer creation (first frame visible).
- Harden React lifecycle cleanup to avoid stale listeners/renderer leaks.
- Re-run tauri/runtime QA checks and keep issue at
Fix Implementeduntil strict gate evidence is complete.
Implementation Notes
Implemented:
frontend/tauri-ui/package.json
- Added
@pixi/assetsdependency.
frontend/tauri-ui/src/renderer/pixi_pet.ts
- Switched atlas loading to
Assets.load<Texture>(pack.atlas_data_url). - Reused
texture.baseTexturefor frame slicing. - Applied initial frame texture in constructor so sprite appears immediately.
- Added explicit renderer/sprite/ticker disposal path.
frontend/tauri-ui/src/main.tsx
- Added mount guards to prevent state updates after unmount.
- Added deterministic cleanup (
unlisten+ rendererdispose()).
crates/sprimo-tauri/build.rs
- Added
cargo:rerun-if-changeddirectives for tauri config and frontend UI paths so frontend/dist updates re-trigger asset embedding incargo run -p sprimo-tauri.
frontend/tauri-ui/src/renderer/pixi_pet.ts
- Replaced
Assets.loadpath with directImage+BaseTexture.from(image)loading to avoid any runtime*.fromURLdependency in atlas initialization.
frontend/tauri-ui/src/main.tsx
- Added visible UI build marker (
issue2-fix3) to detect stale embedded frontend artifacts.
crates/sprimo-tauri/capabilities/default.json
- Added default capability with:
core:defaultcore:event:allow-listencore:event:allow-unlisten
frontend/tauri-ui/src/renderer/pixi_pet.ts
- Added tauri-side chroma-key conversion for atlas data URL:
- draw atlas to canvas
- convert near-
#FF00FFpixels to alpha 0 - create Pixi base texture from converted canvas
Verification
Commands Run
cargo check -p sprimo-tauricargo check -p sprimo-runtime-corejust build-tauri-uijust run-tauri(smoke attempt; command is long-running and timed out under automation)just qa-validate
Visual Checklist
- Before screenshot(s):
issues/screenshots/issue2.png - After screenshot(s):
issues/screenshots/issue2-after-fix3-2026-02-13-094131.png
Runtime Contract Checklist
current_stateinvoke returns structured payloadload_active_sprite_packinvoke returns manifest/atlas payloadruntime:snapshotevent observed after runtime command changes
API Checklist
GET /v1/healthGET /v1/stateauth behaviorPOST /v1/commandPOST /v1/commands
Result
- Current Status:
Fix Implemented - Notes: build/check/qa validation passed; manual runtime visual verification still required.
Status History
2026-02-13 13:20- reporter -Reported- runtime screenshot captured withTypeError: W.fromURL is not a function.2026-02-13 13:35- codex -Triaged- localized failure to Pixi atlas loader path.2026-02-13 13:55- codex -In Progress- replaced loader API and hardened renderer lifecycle.2026-02-13 14:05- codex -Fix Implemented- patch completed, verification checklist queued.2026-02-13 14:20- codex -Fix Implemented- checks passed (cargo check, UI build, QA validation); smoke launch attempted.2026-02-13 14:35- codex -Fix Implemented- added build-script change tracking for frontend assets to prevent stale embedded UI.2026-02-13 14:55- codex -In Progress- removed all runtimefromURLusage from renderer atlas loading path.2026-02-13 15:05- codex -In Progress- added explicit UI build marker to detect stale executable/frontend embedding.2026-02-13 15:20- reporter -In Progress- providedissue2-after-fix3screenshot; stale-build issue resolved, permission + chroma-key defects observed.2026-02-13 15:35- codex -Fix Implemented- added tauri capability permission file and tauri-side chroma-key conversion.
Closure
- Current Status:
Fix Implemented - Close Date:
- Owner:
- Linked PR/commit: