Skip to main content

Module proposal

Module proposal 

Source
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§

EditProposal
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 hunks to a document of len_before chars.
hunks_from_diff
Derive review hunks from a whole-file before/after pair.
rebase_hunks
Carry hunks authored against base_text onto current_text.