Relax INV-1/INV-2 in 001-advance-turn spec to allow empty encounters
Prepares for 002-add-combatant by treating an empty combatant list as a valid aggregate state (activeIndex must be 0). AdvanceTurn behavior on non-empty encounters is unchanged. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -82,11 +82,20 @@ domain events.
|
|||||||
|
|
||||||
### Edge Cases
|
### Edge Cases
|
||||||
|
|
||||||
- Empty combatant list: AdvanceTurn MUST reject with an error.
|
- Empty combatant list: valid aggregate state, but AdvanceTurn MUST
|
||||||
|
return a DomainError (no state change, no events).
|
||||||
- Single combatant: every advance wraps and increments the round.
|
- Single combatant: every advance wraps and increments the round.
|
||||||
- Large round numbers: no overflow or special-case behavior; round
|
- Large round numbers: no overflow or special-case behavior; round
|
||||||
increments uniformly.
|
increments uniformly.
|
||||||
|
|
||||||
|
## Clarifications
|
||||||
|
|
||||||
|
### Session 2026-03-03
|
||||||
|
|
||||||
|
- Q: Should an encounter with zero combatants be a valid aggregate state? → A: Yes. Empty encounter is valid; AdvanceTurn returns DomainError.
|
||||||
|
- Q: What is activeIndex when combatants list is empty? → A: activeIndex MUST be 0.
|
||||||
|
- Q: Does this change any non-empty encounter behavior? → A: No. All existing acceptance scenarios and event contracts remain unchanged.
|
||||||
|
|
||||||
## Domain Model *(mandatory)*
|
## Domain Model *(mandatory)*
|
||||||
|
|
||||||
### Key Entities
|
### Key Entities
|
||||||
@@ -113,10 +122,13 @@ MUST be verified by tests.
|
|||||||
|
|
||||||
### Invariants
|
### Invariants
|
||||||
|
|
||||||
- **INV-1**: An encounter MUST have at least one combatant.
|
- **INV-1**: An encounter MAY have zero combatants (an empty
|
||||||
Operations on an empty encounter MUST fail.
|
encounter is a valid aggregate state). AdvanceTurn on an empty
|
||||||
- **INV-2**: activeIndex MUST always satisfy
|
encounter MUST return a DomainError with no state change and no
|
||||||
0 <= activeIndex < len(combatants).
|
events.
|
||||||
|
- **INV-2**: If combatants.length > 0, activeIndex MUST satisfy
|
||||||
|
0 <= activeIndex < combatants.length. If combatants.length == 0,
|
||||||
|
activeIndex MUST be 0.
|
||||||
- **INV-3**: roundNumber MUST be a positive integer (>= 1) and MUST
|
- **INV-3**: roundNumber MUST be a positive integer (>= 1) and MUST
|
||||||
only increase (never decrease or reset).
|
only increase (never decrease or reset).
|
||||||
- **INV-4**: AdvanceTurn MUST be a pure function of the current
|
- **INV-4**: AdvanceTurn MUST be a pure function of the current
|
||||||
|
|||||||
Reference in New Issue
Block a user