Files
OpenMAIC/packages
8c22e27a29 fix(generation): tolerate non-array mediaGenerations in generated outlines (#1469)
* fix(generation): tolerate non-array mediaGenerations in generated outlines

LLM-generated outline JSON can carry mediaGenerations as a string or
object instead of an array. Every downstream consumer (media
orchestrator, video manifest, scene generator) requires an array, and
uniquifyMediaElementIds called .map() after only a falsy check, so one
malformed outline aborted course generation with
"outline.mediaGenerations.map is not a function".

- sanitize at parse time: drop non-array mediaGenerations from each
  enriched outline (outline-generator)
- harden uniquifyMediaElementIds: treat non-array values as absent,
  strip them, and open the early-return guard on field presence so
  all-malformed outlines still get sanitized
- add unit tests covering array, string, object, number, and missing
  shapes

* chore(generation): bump package version to 0.3.8

Required by the package version bump check: the PR changes the
publishable @openmaic/generation package sources.

* test(generation): use correct SceneOutline fixture fields in outline media tests

The first commit of this branch accidentally staged an earlier draft of
the test file (sceneType instead of type, stale id regex). Re-stage the
final version that passes tsc and the full suite locally.

---------

Co-authored-by: PassCode023 <269712126+PassCode023@users.noreply.github.com>
Co-authored-by: wyuc <wang-yc24@mails.tsinghua.edu.cn>
2026-09-17 23:29:05 +08:00
..