Fix stale substates after background task state expiry
HA
17h ago+493+493+012345678901234567890123456789-52-52-01234567890123456789
Summary
When a state tree is recreated after expiry, mark the new states dirty so the next delta sends their default frontend values. Track recreation in the memory, disk, and Redis state managers while leaving states loaded from Redis clean. Avoid retaining tracked state references in the memory manager's long-lived expiration task.
Add regression coverage for delayed background updates after child and component state expiry, disk state recreation, Redis persisted and missing states, and unchanged Redis reloads.
Closes #7478
Validation
uv run pytest tests/units/istate -q --maxfail=5(225 passed)uv run pytest tests/integration/test_memory_state_manager_expiration.py -q(6 passed)- Targeted pre-commit hooks, including Ruff, Pyright, and ty (passed)