feat(trace): line ranges that point into the pushed code

Merged
JI
1d ago
+193-14

Implements milestone 2 of spec issue-3639 "Line ranges that point into the pushed code" (docs/specs/issue-3639-line-ranges.md), R-001 to R-005.

The line ranges of each file in the session evidence are now positions in the file at the pushed commit. Each range says if its lines are AI or human. The ranges cover the lines of the session that are still in the pushed code, so they agree with the net AI and human counts. Lines that another session of the same commit wrote get no range. A commit that joined the session adds human ranges only for the lines of its replacing hunks. A file that the pushed commit no longer holds has no ranges. A file with no blame keeps the AI ranges at edit time, with no attribution, as before. When a later commit replaces lines of a session, the session is sent again with ranges in the newer pushed commit.

The Trace README gets a "Line ranges" row, and the e2e suite gets a check for it.

Depends on #3664. Do not merge until a release includes #3664 (D-005). This PR holds the commit of #3664 too, because it targets main. Part of #3639.

AI disclosure: this change was written with the assistance of Claude Code.

šŸ¤– Generated with Claude Code