# Mod Hot Reload

This document covers `TODOS.phase-72.72.14.1.9`: development hot reload for
changed mod scripts and assets without restarting the game.

## Runtime Surface

- module: `V2Modding`
- policy: `FV2ModHotReloadPolicy`
- change: `FV2ModHotReloadChange`
- issue: `FV2ModHotReloadIssue`
- plan: `FV2ModHotReloadPlan`
- helper functions: `BuildDefaultModHotReloadPolicy`,
  `BuildModScriptHotReloadChange`, `BuildModAssetHotReloadChange`,
  `EvaluateModHotReload`, and `ExecuteModHotReloadPlan`
- subsystem forwarding: `UV2ModLoadingSubsystem::EvaluateDevelopmentHotReload`
- automation: `V2/ue/Source/V2Tests/Private/Modding/ModLoadingSystem.spec.cpp`
- contract: `V2/ue/Content/V2/Modding/ModHotReload_V2_Contract.json`

## Policy

`BuildDefaultModHotReloadPolicy` enables development-only reloads for scripts
and assets, requires sandbox approval, requires every changed item to advance
its revision, and caps each reload batch at 64 changes.

The evaluator blocks reloads when development hot reload is disabled, when the
session is not a development session, when sandbox approval is missing, when a
change targets another mod, when a changed script or asset id is unknown, when
an integrity hash is missing, or when a revision does not advance.

## Script And Asset Changes

`BuildModScriptHotReloadChange` creates a script change that reuses the existing
script runtime binding and validates through `EvaluateModScriptHotReload`.
Runtime, entrypoint, permission, sandbox, integrity, and stale-revision checks
remain centralized in the scripting integration path.

`BuildModAssetHotReloadChange` creates an asset change that reuses the manifest
asset metadata and validates through `EvaluateModAssetLoadRequest`. Asset kind,
mount root, load phase, size, integrity, sandbox, and engine asset registry
checks remain centralized in the asset loading path.

## No-Restart Execution

`EvaluateModHotReload` returns an accepted `FV2ModHotReloadPlan` only when all
changed scripts and assets are accepted. Accepted plans set
`bRequiresGameRestart` to `false`. `ExecuteModHotReloadPlan` marks accepted
asset mounts as mounted and registered with the engine asset system while
preserving `bRequiresGameRestart == false`, so development reloads can apply
without restarting the game.

## Verification

```bash
python3 V2/ue/Tools/check-v2-mod-hot-reload.py
python3 V2/ue/Tools/check-v2-mod-scripting-integration.py
python3 V2/ue/Tools/check-v2-mod-asset-loading.py
python3 V2/ue/Tools/check-v2-ci-workflow.py
python3 V2/tools/validate-v2-docs.py
python3 -m py_compile V2/ue/Tools/check-v2-mod-hot-reload.py V2/ue/Tools/check-v2-mod-load-order-management.py V2/ue/Tools/check-v2-ci-workflow.py
python3 -m json.tool V2/ue/Content/V2/Modding/ModHotReload_V2_Contract.json
```
