Skip to content

Engine-aware migrator for the unified prefab/scene format #572

@apotema

Description

@apotema

Part of #560 (RFC: unify scenes and prefabs).

Problem

The RFC calls the migration "mechanical — a jq-style script or one-shot editor pass." It isn't purely mechanical: the "components" -> "overrides" rename must be applied inside entity-bearing component fields (Room.movement_nodes) but not elsewhere — and knowing which component fields are entity-bearing requires the engine's comptime knowledge (entity_writer.zig's isNestedEntityArray / hasNestedEntityFields). A blind jq script will either miss embedded refs or over-rename.

Scope

  • A migrator with engine access that, per file: wraps content in "root", renames entities -> children, drops assets, and renames components -> overrides only on reference entries — including refs buried in entity-bearing component fields, resolved via the same comptime detection the loader uses.
  • Idempotent; safe to re-run.
  • Sibling to RFC §unification: loader accepts unified prefab/scene format #561 — depends on the loader's legacy-synonym support so migrated and unmigrated files coexist during rollout.

Acceptance

  • Running it on flying-platform-labelle produces files that load identically (entity tree + component values byte-equivalent post-spawn) to the pre-migration originals.
  • stair_room.jsonc (embedded refs in Room.movement_nodes + a children ref) migrates correctly in both places.

Refs: #560, #561.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions