Skip to content

RFC tables: document the include (top-level) + ref (entity) keys (from #594/#596 Gemini findings) #608

@apotema

Description

@apotema

Gemini flagged that the flatten RFC key tables omit include and ref (on merged #594 @109 and closed #596 @117). Investigated the actual semantics in the engine so the tables can be filled correctly:

include — scene-file inclusion (TOP-LEVEL key)

  • Shape: "include": ["path/a.jsonc", "path/b.jsonc"] — top-level array of scene-file paths.
  • Behavior: scene_loader.loadSceneFile recursively loads each + merges its entities; guarded by MAX_DEPTH (error.IncludeDepthExceeded). Scene composition. (labelle-engine/src/jsonc/scene_loader.zig:502-533, game.zig:243,1380.)
  • Nuance: top-level "include" is live; meta.include is reserved by the RFC but currently unused (scene_loader.zig:358). Document both states.
  • → Add to the top-level keys table (the RFC: flatten the root: wrapper out of unified-format files (engine#592 phase 2) #594 RFC-FLATTEN-ROOT.md table).

ref — entity references (two-pass @ref, #495)

  • "ref": "<name>" — a structural key on an entity (and on a prefab's root object, where it sits at top level) that registers a referenceable name. Real example: prefabs/storage/eos_with_water.jsonc"ref": "storage" on the root, "ref": "item" on a child.
  • "@<name>" — consumer side: a component-field VALUE prefixed @ pointing at a named entity (e.g. WithItem { item_id: "@item" }).
  • Resolution: two-pass (src/jsonc/ref_resolver.zig) — pass 1 registers names + records deferred @ref fields; pass 2 patches each with the resolved entity id (walks the RefContext parent chain). ref_arrays handle arrays of refs (children).
  • → Document under ENTITIES, not the top-level scene table. (Gemini's RFC: flatten the root: wrapper out of unified-format files (engine#592 phase 2) #594 note placing it top-level is slightly off — ref only appears top-level in prefab files because a prefab's root IS an entity.) This belongs in the parked RFC: flatten unified-format wrappers + bundle shape (v2.0 phase 3) #596 revision.

Action

  1. Patch merged RFC-FLATTEN-ROOT.md (RFC: flatten the root: wrapper out of unified-format files (engine#592 phase 2) #594): add include to the top-level key table (with the meta.include-reserved note).
  2. In the RFC: flatten unified-format wrappers + bundle shape (v2.0 phase 3) #596 revision (RFC-FLATTEN-WRAPPERS-AND-BUNDLES.md, parked for the Step-3/4 + bundle-meta contradictions): add ref to the entities/structural-keys table.

Refs: #594 (merged), #596 (closed, branch rfc/flatten-wrappers-and-bundles kept).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No 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