# V2 Incremental Cooking

`V2/ue/Build/Cooking/v2-incremental-cooking.json` defines the V2 incremental
cook planner. It consumes changed source paths, dependency sidecar changes, the
previous cook state, and the content cooking dependency graph so cooks only
touch assets whose source or dependencies changed since the last cook.

The planner input set is:

- changed source files from source control or
  `$(ArchiveRoot)/Cooking/Incremental/changed-source-paths.txt`
- the previous cook state at
  `$(ArchiveRoot)/Cooking/Incremental/last-cook-state.json`
- current fingerprints from `$(ArchiveRoot)/Cooking/fingerprints.json`
- dependency sidecar files matching `*.v2deps.json`
- `$(ArchiveRoot)/Cooking/dependency-graph.json`

`plan-v2-incremental-cooking.py` maps each changed source to its domain group,
compares source, import-settings, and dependency hashes against the previous
cook state, then walks the reverse transitive closure of the dependency graph.
Every asset in that closure gets a profile-specific cook action. Unchanged
assets are emitted as cache hit records and are not recooked.

Global cook policy changes force a full recook. The full-recook trigger set
includes `V2/ue/Build/Build.xml`, the content cooking architecture manifest, and
each domain cooking manifest. Deleted sources are emitted into the stale output
manifest so the archive can prune old cooked artifacts before publishing.

Required gates:

- `incremental-cooking-plan-generated`
- `incremental-cooking-changed-source-detected`
- `incremental-cooking-dependent-invalidations`
- `incremental-cooking-unaffected-assets-skipped`
- `incremental-cooking-cache-reuse-recorded`

The primary cache reuse metric is `cook.incremental.cache_hit_count`. The CI
validator is:

```bash
python3 V2/ue/Tools/check-v2-incremental-cooking.py
```
