Resolves stale intents left by crashed cross-shard operation coordinators.
On startup (or on-demand), scans all shards for intent records with
status :executing. For each stale intent:
- Checks if the intent is old enough to be considered stale (>10s)
- Reads current state of involved keys
- Compares value hashes with
:erlang.phash2/1 - If hash matches: data unchanged, safe to clean up the intent
- If hash doesn't match: someone wrote new data, clean up intent (don't re-execute)
- If key doesn't exist: already completed or expired, clean up intent
Intent records are self-describing: they contain the command type, involved keys, and expected value hashes.
Summary
Functions
Scans all shards for stale intents and cleans them up.