feat: implement animal lifecycle events (Step 6.3)

Add 5 animal lifecycle event handlers with TDD:
- HatchRecorded: Creates hatchling animals at brood/event location
- AnimalOutcome: Records death/harvest/sold with yields, status updates
- AnimalPromoted: Sets identified flag, nickname, optionally updates sex/repro_status
- AnimalMerged: Merges animal records, creates aliases, removes merged from live roster
- AnimalStatusCorrected: Admin-only status correction with required reason

All events include:
- Projection handlers in animal_registry.py and intervals.py
- Event-animal linking in event_animals.py
- Service methods with validation in animal.py
- 51 unit tests covering event creation, projections, and validation
- E2E test #7 (harvest with yields) per spec §21.7

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-29 19:20:33 +00:00
parent da95e85452
commit 1153f6c5b6
7 changed files with 2728 additions and 9 deletions

14
PLAN.md
View File

@@ -235,13 +235,13 @@ Check off items as completed. Each phase builds on the previous.
- [x] **Commit checkpoint** (282d3d0)
### Step 6.3: Animal Lifecycle Events
- [ ] Implement HatchRecorded (creates hatchlings)
- [ ] Implement AnimalOutcome (death/harvest/sold with yields)
- [ ] Implement AnimalPromoted (identified=true, nickname)
- [ ] Implement AnimalMerged (status=merged_into, aliases)
- [ ] Implement AnimalStatusCorrected (admin-only with reason)
- [ ] Write tests for each event type
- [ ] Write test: E2E test #7 (harvest with yields)
- [x] Implement HatchRecorded (creates hatchlings)
- [x] Implement AnimalOutcome (death/harvest/sold with yields)
- [x] Implement AnimalPromoted (identified=true, nickname)
- [x] Implement AnimalMerged (status=merged_into, aliases)
- [x] Implement AnimalStatusCorrected (admin-only with reason)
- [x] Write tests for each event type
- [x] Write test: E2E test #7 (harvest with yields)
- [ ] **Commit checkpoint**
---