WORK-118
ID:WORK-118Status:done

Validate property and ref name uniqueness in createComponentRenderable

Priority:highComplexity:simpleMilestone:v1.0.0Source:ADR-008
changeset-release/main View source
Branches 2
changeset-release/main current done
main doneclaude/file-naming-convention-LJdwR done
History 6
  1. f2b3512
    Content editedby Claude
    Add {ID}-{slug}.md filename convention + migrate filenames subcommand
  2. 1676387
    Content editedby Claude
    Accept SPEC-037 and break into work items; fix plan validation issues
  3. f262d7b
    Content editedby Claude
    Backfill source attributes on all 123 work items
  4. c435d57
    Content editedby Claude
    Mark ADR-008 work items WORK-117 through WORK-122 as done
  5. dca6250
    Content editedby Claude
    Assign WORK-117 through WORK-122 to milestone v1.0.0
  6. ece282c
    Created (done)by Claude
    Add work items WORK-117 through WORK-122 for ADR-008 implementation

Summary

Add a static validation step to createComponentRenderable that checks for naming collisions between properties keys and refs keys. Since ADR-008 uses a flat namespace where both properties and refs become component props/slots, duplicate names would cause silent overwrites.

Acceptance Criteria

  • createComponentRenderable throws a descriptive error if any key appears in both properties and refs
  • Error message includes the rune name and the colliding key(s)
  • All existing runes pass validation (no current collisions)
  • Unit test for collision detection
  • Unit test confirming no false positives on valid runes

Approach

  1. In packages/runes/src/lib/component.ts, add a Set intersection check between Object.keys(properties) and Object.keys(refs) before building the renderable
  2. Throw with rune name and colliding keys if intersection is non-empty

Resolution

Completed: 2026-04-04

Branch: claude/adr-008-implementation-nBN9K

What was done

  • Added Set intersection validation in packages/runes/src/lib/component.ts
  • Fixed 3 pre-existing collisions: bento-cell icon (renamed property to iconSource), faction/realm name (removed from properties, kept as ref only)
  • 9 unit tests in packages/runes/test/component.test.ts

Notes

  • Validation runs before attribute decoration, catching collisions at build time
  • All 1969 existing tests pass after fixing the 3 collisions