Skip to content

batch: Reject claimed runs after large source gaps#178

Merged
halfline merged 3 commits into
mainfrom
fix/reject-leading-context-corruption
Jul 11, 2026
Merged

batch: Reject claimed runs after large source gaps#178
halfline merged 3 commits into
mainfrom
fix/reject-leading-context-corruption

Conversation

@halfline

Copy link
Copy Markdown
Owner

Batch merge validation checks surrounding mapped lines before restoring a
claimed run that is absent from the target version.

Repeated target text can make a distant mapped line look like a valid leading
anchor. Users can otherwise restore claimed content into an unrelated method
instead of receiving a version mismatch.

This pull request addresses that problem by rejecting bracketed runs that
follow a significant unmapped source gap. It adds focused merge-layer
coverage and aligns the include-from command regression expectation with the
full rejected interval.

The merge layer and include-from command now reject this false-anchor shape
while preserving the target unchanged.

Tests: uv run pytest tests/batch/test_merge_validation.py tests/commands/test_include_from.py

halfline added 3 commits July 11, 2026 01:30
Batch merge validation checks surrounding mapped lines before restoring a
claimed run that is absent from the target version.

Repeated target text can make a distant mapped line look like a valid
leading anchor. Users can otherwise restore claimed content into an
unrelated method instead of receiving a version mismatch.

This commit begins preventing false merge anchors by rejecting bracketed
runs that follow a significant unmapped source gap.

Subsequent commits will cover the structural rule and align command-level
failure reporting with the rejected interval.
Merge validation rejects bracketed claimed runs when a large unmapped
source region separates the run from its preceding mapped line.

The structural rule lacks a focused example where repeated method content
could make an unrelated target line appear to be a trustworthy anchor.

This commit continues guarding against false merge anchors by exercising
the leading-gap rejection directly through the batch merge interface.

The final commit will align the command-level regression expectation with
the full interval rejected by that rule.
The include-from command reports the line selection that cannot be restored
when merge validation finds incompatible target content.

The leading-gap check rejects the complete requested interval rather than
the narrower claimed run previously identified by the command regression
test.

This commit completes the false-anchor correction by expecting the command
to report the full rejected selection while preserving the target
unchanged.

The merge layer and include-from command now have regression coverage for
claimed runs that follow large unmapped source regions.
@halfline halfline merged commit ef3a62f into main Jul 11, 2026
4 checks passed
@halfline halfline deleted the fix/reject-leading-context-corruption branch July 11, 2026 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant