Expand description
Turning an agent’s diff into reviewable hunks (ADR-0007 §5).
ACP does not hand us range edits. It hands us whole-file before-and-after text
(ToolCallContent::Diff { old_text, new_text }), so the range edits ARCHITECTURE.md
§9.3 originally assumed have to be derived. That derivation is here.
The other half of the problem is anchoring. old_text is the file as the agent saw
it, which is not necessarily any revision of ours — the human has probably typed
since. Rather than reaching into undo history for the intervening transactions, we
synthesise them: diffing the agent’s base against the current buffer produces exactly
the ChangeSet describing “what changed underneath this proposal”, and ADR-0006’s
machinery then carries the hunks across it or marks them conflicted. One diff routine
serves both jobs.
Structs§
- Edit
Proposal - A set of edits to one file, awaiting review.
- Hunk
- One contiguous change the human accepts or rejects on its own.
Functions§
- changeset_
from_ hunks - The single change that applies
hunksto a document oflen_beforechars. - hunks_
from_ diff - Derive review hunks from a whole-file before/after pair.
- rebase_
hunks - Carry hunks authored against
base_textontocurrent_text.