3d22f272d3
Tallying filtered the whole deployed-instance set inside the site loop, making the aggregate O(sites x instances) — the one per-entity loop in an otherwise batched pass. Group once into a lookup and index per site. Also: ResolveArtifactState's missing-hash branch is a defensive default, not the race the comment described (the same site list feeds the hash computation), and the staleness batch omits an instance undeployed mid-batch as well as one that never had a snapshot. Claude-Session: https://claude.ai/code/session_01Y5ef34iUUMjmwnMpL9xgmB