Skip to content

CFE-3988: Fixed insert_lines ignoring include_end_delimiter when locating the region - #6265

Open
nickanderson wants to merge 1 commit into
cfengine:masterfrom
nickanderson:CFE-3988/master
Open

CFE-3988: Fixed insert_lines ignoring include_end_delimiter when locating the region#6265
nickanderson wants to merge 1 commit into
cfengine:masterfrom
nickanderson:CFE-3988/master

Conversation

@nickanderson

@nickanderson nickanderson commented Aug 4, 2026

Copy link
Copy Markdown
Member

The insertion path treats the selected region as the half-open range [begin_ptr, end_ptr), so the end delimiter was never inside it. Inserting after the last line of a region built with include_end_delimiter => "true" landed above the delimiter instead of below it. Insertion now moves the bound the way DeletePromisedLinesMatching() already does.

Nothing could have depended on the old behavior: include_end_delimiter had no effect at all on insert_lines, and all ~90 existing tests using it are under 07_delete_lines.

Tests

  • 31_tickets/CFE-3988/1 — the ticket's reproducer, no longer test_soft_fail
  • 31_tickets/CFE-3988/2 — new, pins the unchanged include_end_delimiter => "false" default

Verified in a local starter_pack VM: acceptance 1648 passed / 0 regressions / soft failures 44 → 43, unsafe 10_files 24/24, unit 70/70. With the fix reverted, case 1 fails and case 2 still passes.

Ticket: https://northerntech.atlassian.net/browse/CFE-3988

Backports to 3.27.x and 3.24.x to follow, matching CFE-3987.

@nickanderson
nickanderson requested a review from larsewi August 5, 2026 02:49
…egion

The insertion path treats the selected region as the half-open range
[begin_ptr, end_ptr), so the end delimiter was never inside it. Inserting
after the last line of a region built with include_end_delimiter => "true"
landed above the end delimiter instead of below it. Insertion now moves the
bound the way DeletePromisedLinesMatching() already does.

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>
@nickanderson

Copy link
Copy Markdown
Member Author

@cf-bottom jenkins please

@cf-bottom

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants