CFE-3988: Fixed insert_lines ignoring include_end_delimiter when locating the region - #6265
Open
nickanderson wants to merge 1 commit into
Open
CFE-3988: Fixed insert_lines ignoring include_end_delimiter when locating the region#6265nickanderson wants to merge 1 commit into
nickanderson wants to merge 1 commit into
Conversation
…egion SelectRegion() hands back the delimiter lines themselves, and the insertion path treats the region as the half-open range [begin_ptr, end_ptr), so the end delimiter was never part of the region it searched. Promising a line after the last line of a region built with include_end_delimiter => "true" therefore inserted above the end delimiter rather than below it. Line deletion already translates include_end_delimiter into that bound in DeletePromisedLinesMatching(); insertion now does the same. The bound only moves when include_end_delimiter is set, and that attribute previously had no effect at all on insert_lines, so the default of inserting before an excluded end delimiter is unchanged. Acceptance test 31_tickets/CFE-3988/2 covers that default and 31_tickets/CFE-3988/1 is no longer a soft failure. Ticket: CFE-3988 Changelog: Title Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SelectRegion()returns the delimiter lines themselves, and the insertion path treats the region as the half-open range[begin_ptr, end_ptr)— so the end delimiter was never inside the region it searched. Inserting after the last line of a region built withinclude_end_delimiter => "true"landed above the end delimiter instead of below it.DeletePromisedLinesMatching()already translatesinclude_end_delimiterinto that bound; insertion now does the same.The bound only moves when
include_end_delimiteris set, and that attribute previously had no effect at all oninsert_lines— all ~90 existing tests using it are under07_delete_lines, none under06_insert_lines. So nothing could have depended on the old behavior.Tests
31_tickets/CFE-3988/1— the ticket's reproducer, no longertest_soft_fail31_tickets/CFE-3988/2— new, pins the unchangedinclude_end_delimiter => "false"defaultVerification (local starter_pack VM)
10_files, incl.15_immutable_edit_line): 24/2415_control/01_common/classic_evaluation_custom_promise_types.cffails, but it fails identically with the fix reverted — its fixturetop_down/dummy_promise_type.pyis absent from the repo. Pre-existing and unrelated.Ticket: https://northerntech.atlassian.net/browse/CFE-3988
Backports to 3.27.x and 3.24.x to follow, matching CFE-3987.