The old buildZoneLabels wrapped the main-SVG fetch and every detail-SVG
fetch in a single try/catch. As soon as one source threw — for example
a 404 on a detail asset in a misconfigured deployment — the loop bailed
out and the labels Map stayed populated only with whatever the loop had
already set. That left every observation zone whose boneId belonged to
a failed source falling back to the raw, opaque "point-mpbyo7zq" string
in the rendered PDF.
The refactor:
- Loads every source independently in parallel.
- Wraps each load+parse in its own try/catch.
- Logs a console.warn on failure so the issue is observable in dev.
- Skips empty bone.fr values so the lookup never returns "" (which the
`??` fallback would treat as a value).
Exports buildZoneLabels so it can be unit-tested directly. The new
suite (4 cases) loads the real Horse + Horse_head SVG fixtures with a
mocked fetch and asserts:
- detail-popup boneIds resolve to their FR labels,
- main-SVG boneIds resolve to their FR labels,
- main labels survive a 404 on the detail asset,
- unknown species returns an empty map.
Co-Authored-By: Claude <noreply@anthropic.com>