perf: resolve stat-mismatched files during index build to reduce hash_scope
When the git index stats don't match the filesystem (common in CI,
containers, and fresh checkouts), all tracked files were classified as
"modified" and deferred to per-package hashing during hash_scope. This
caused thousands of unnecessary SHA1 file hashes on the critical path.
Fix: content-hash stat-mismatched files during the parallel index build
(which overlaps with package graph construction) instead of deferring to
hash_scope. If the computed hash matches the index entry, classify the
file as clean. This moves I/O from the critical path to a background
thread.
Also resolve racy-git entries (mtime >= index timestamp) the same way
instead of conservatively marking them as modified.
Measured on this repo (~30 packages, clean working tree):
- hash_scope: 370ms → 93ms (-75%)
- scm_task_await: 400ms → 159ms (-60%)
- Total TTFT: 1690ms → 1010ms (-40%)
Add tracing spans to task hashing pipeline for ongoing perf monitoring.
https://claude.ai/code/session_01HXQRNfNhJQu26zPuR1VppH