ProgramDiffApplyResult
Models & Types · AiDotNet.Evolution.Programs
The program produced by applying a set of edit blocks, plus every block that did not apply.
For Beginners
This is the result of carrying out a model’s edit instructions. It gives you the
edited program, a count of how many instructions actually took effect, and a list of the ones that did not.
UnifiedDiff is a human-readable summary of what changed, in the familiar format used by version
control tools, which is handy both for logging and for showing the model what its edit really did.
How It Works
ModifiedSource always holds a usable program: blocks that matched were applied and blocks that
did not were left out, so a caller that only wants best effort can use it directly. A caller that wants
correctness checks IsSuccess, which is false when any block failed, when nothing applied,
or when the result came back byte identical to the original while
RejectWhenNoBlockApplied is set. That last check is what
stops an evolution run from spending evaluator budget on a child that is a copy of its parent, which the
reference implementation does routinely because it never notices that zero blocks applied.
Properties
| Property | Summary |
|---|---|
IReadOnlyList<ProgramDiffFailure> Failures { get; } |
Gets every block that could not be applied, with a typed reason. |
bool IsSuccess { get; } |
Gets whether every block applied and the program actually changed. |
bool IsUnchanged { get; } |
Gets whether the applied edits left the program byte identical to the original. |
int AppliedCount { get; } |
Gets the number of blocks that matched and were applied. |
string ModifiedSource { get; } |
Gets the program text after every block that matched was applied. |
string OriginalSource { get; } |
Gets the program text the blocks were applied to. |
string UnifiedDiff { get; } |
Renders the change as a unified diff with three lines of context. |