Skip to content

Spell validation: duplicate detection and tradition compatibility #254

@Jasrags

Description

@Jasrags

Problem

The spell validation has significant gaps compared to complex forms (which have full duplicate/catalog/limit checks):

  1. No duplicate spell detection: A character can select the same spell multiple times. Complex forms have CF_DUPLICATE but spells have no equivalent.
  2. No tradition/aspect compatibility check: An aspected sorcerer could select conjuring spells, or an aspected conjurer could select manipulation spells. The validator doesn't cross-reference selected spells against the character's tradition or aspect.
  3. No ritual validation: If rituals are supported in the data model, they are not validated.

Acceptance Criteria

  • Server-side validator rejects duplicate spell selections (new SPELL_DUPLICATE error code)
  • Server-side validator checks spell categories against tradition/aspect restrictions
  • Spell catalog validation (spell ID exists in ruleset) — equivalent to CF_NOT_FOUND
  • Tests for duplicate, invalid, and tradition-incompatible spell selections

Priority

P1 — Critical — Spells are a core mechanic for 4 of 6 magical paths.

Files

  • lib/rules/validation/character-validator.ts (extend magicValidator or new validator)
  • Spell catalog data in core-rulebook.json

Metadata

Metadata

Assignees

Labels

creationcriticalUrgent - security vulnerability or blocking issueenhancementNew feature or requestvalidationValidation rules and error checking

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions