v1.2.2 — Asset-path validation: no more broken icons, portraits & backgrounds
Hardening release — closes a rule-8 gap across the whole authoring surface.
The bug
A caller-supplied asset path (an item icon, an actor portrait/token, a scene background, an audio track, a journal image, a card face, a user avatar) was written to the Foundry document verbatim, with no check that it actually resolves. A guessed or typo'd path shipped as a broken 404 — isPlaceholderIcon only caught blank / icons/svg/ placeholders, never a non-blank path that 404s. Only add-item was guarded; every other asset-write site was not.
The fix
New shared guard — src/page/img-resolve.ts:
imgResolves(path)— HEAD-checks the path on the Foundry static server (trusts remotehttp/dataURLs; fails open on a network error so a transient hiccup never strips a good path).badAssetWarning(...)— one consistent warning string everywhere.GENERIC_ICONfor the no-kind-context substitution sites.
Applied at every caller-supplied asset write (13 sites, was 1):
- Substitute a real icon + warn (icon/portrait/token):
add-item,create-item/update-item,update-actor-item,set-actor-art(portrait + token),update-actor,set-user-avatar. - Drop to Foundry's default pin + warn:
create-scene-notes/update-noteicons. - Keep path + warn loudly (content-defining, no sensible substitute):
create-scene/update-scenebackground + thumb,create-playlisttracks,create-journalimage pages,add-journal-image,create-cardsfaces.
Each page handler returns its warnings; each tool wrapper surfaces them. Non-blocking throughout (soft-validation: warn, never block). Valid inputs write byte-identically — the new check only fires on a 404.
Confirmed no-ops: update-playlist writes no asset path; create-quest-journal has no image src; author-npc / create-actor-from-compendium already auto-resolve real art.
Gate
biome + typecheck + 992 unit tests (+11) + knip + build all green. Live integration (RELEASE.md steps 2–3) not run this cycle — valid-input live-write behavior is unchanged; the new validation only affects 404 inputs the integration suite does not exercise.