# Session Summary: v13 Migration — DataModel + _id/duplicate Cleanup + template.json removal

## Done

### `duplicate()` → `deepClone()` (finding #10, 36 files)
`foundry.utils.duplicate()` → `foundry.utils.deepClone()` across the system. `deepClone` preserves Document prototypes where `duplicate` stripped them.

### `_id` → `id` on Documents (finding #11, finding #7, ~25 sites)
- 21 read accesses migrated during initial sweep
- Review sweep caught 3 more: `rdd-combat.js:148` (combatant._id), `rdd-combat.js:898` (esquive e._id), `rdd-tmr-dialog.js:261` (casetmr._id)
- Also fixed: `actor.js:1844` (selectedSort._id), `actor.js:2884` (herbeData._id), `base-actor.js:404` (conteneur c._id)
- Remaining `_id` references are on POJOs (`toObject()`/migration data) — correct.

### `_onClose` → `super._onClose()` (finding #9)
All dialog `_onClose` overrides now call `super._onClose()` for proper HandlebarsApplicationMixin cleanup.

### Actor DataModel Migration (3 phases)
- Phase 1: 5 DataModels in `module/models/` + helpers + `CONFIG.Actor.dataModels` registration
- Phase 2: `prepareActorData()` chain → DataModel `prepareDerivedData()` in each model
- Phase 3: template.json deletion, dead code cleanup

### `template.json` elimination (like `fvtt-hawkmoon-cyd`)
- `template.json` deleted. Foundry v13+ uses `documentTypes` in system.json.
- Added `documentTypes.Actor` (5 types) + `documentTypes.Item` (44 types) with `htmlFields`
- Fixed CI/CD files referencing template.json

## Still remaining (v14-blocking)
V1 Application/Dialog classes (24 `extends Dialog`, 6+ V1 sheets) cannot run in v14 — findings #1–#6.
