WORK-080
ID:WORK-080Status:done

Refactor Realm and Faction Transforms to Use Shared Utilities

Priority:highComplexity:moderateSource:SPEC-028

Criteria completion

No incremental history — criteria tracking started on Apr 21.

Branches 2
History 4
  1. e900a90
    Created (done)by bjornolofandersson
  2. f262d7b
    Content editedby Claude
  3. 81038b9
    statusreadydone
    by Claude
  4. 9aff526
    Created (ready)by Claude
    Add work items WORK-076 through WORK-082 for SPEC-028

Summary

Realm and Faction share ~90% identical transform code (scene image extraction, description rendering, layout meta tags, content building, createComponentRenderable structure). Refactor both to use the shared utilities from WORK-076 and WORK-077, align their section structure to the standard 3-section pattern, and fix Faction's missing mediaSlots config.

Acceptance Criteria

  • Realm transform uses shared buildLayoutMetas() from WORK-076
  • Faction transform uses shared buildLayoutMetas() from WORK-076
  • Both transforms use shared extractMediaImage() from WORK-077 (replacing ~15-line inline unwrap loops)
  • Shared storytelling helpers extracted for any remaining duplicated patterns between Realm and Faction
  • Faction config declares mediaSlots: { scene: 'cover' } and corresponding sections entry for scene: 'media'
  • Both runes follow standard 3-section structure (meta, content with preamble, media)
  • Realm config sections aligned to standard pattern (preamble inside content)
  • All existing tests pass (update snapshots if structure changes)

Approach

  1. Apply shared utilities from WORK-076 and WORK-077 to both transforms
  2. Extract any remaining duplicated storytelling-specific logic into package helpers
  3. Fix Faction's missing mediaSlots and sections config
  4. Align section structure to standard pattern
  5. Update test snapshots

References

  • SPEC-028 (Standard 2 — Preamble Groups with Content)
  • SPEC-028 (Standard 3 — Config Must Match Schema Capabilities)
  • SPEC-028 (Standard 4 — Avoid Duplicated Transform Logic)
  • WORK-076 (shared layout meta utility)
  • WORK-077 (shared media unwrap utility)