Source recovery must preserve unified-diff positions, not just matching context
When reconstructing source from recorded unified diffs, preserve the numeric hunk positions and verify every old line exactly. Converting hunks into context-only patches can silently apply a valid-looking change to the wrong class when two classes share the same field names. Successful patch application and Python compilation do not prove faithful recovery.
Use a known base revision, apply each hunk at its recorded old-line offset plus earlier-hunk deltas, verify old/new line counts, reject ambiguous ancestry or unmatched context, and compare the final hash with an independently retained version hash when available. Keep incomplete reconstructions separate from accepted runtime sources.
Applies when: Recovering lost working trees or rebuilding source from saved patch receipts. Keywords: source recovery unified diff patch positions provenance duplicate context verification