CFE-3866: Allowed select_region to converge across passes (3.27)#6076
Merged
nickanderson merged 6 commits intocfengine:3.27.xfrom Apr 17, 2026
Merged
CFE-3866: Allowed select_region to converge across passes (3.27)#6076nickanderson merged 6 commits intocfengine:3.27.xfrom
nickanderson merged 6 commits intocfengine:3.27.xfrom
Conversation
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech> (cherry picked from commit 369df1a)
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech> (cherry picked from commit 9434229)
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech> (cherry picked from commit e6afbba)
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech> (cherry picked from commit 4c0a170)
This test validates that select_region can converge across multiple edit_line passes when the region is created in an earlier pass. The test creates a file with a [section] header in the first promise, then uses select_region to insert content within that section in the second promise. This demonstrates that select_region failures are retried across multiple passes until they succeed. Ticket: CFE-3866 Changelog: None (cherry picked from commit 0565051)
Modified edit_line operations to allow select_region to succeed across multiple convergence passes. Previously, if a promise inserted a section header in pass 1, promises using select_region for that section would fail with INTERRUPTED in the same run, preventing convergence. Changes: - Added EDIT_CONTEXT_IS_FINAL_PASS macro to files_edit.h for checking if we're on the final convergence pass - Extracted HandleSelectRegionFailure() to centralize error handling for SelectRegion failures across VerifyLineDeletions, VerifyColumnEdits, VerifyPatterns, and VerifyLineInsertions - On non-final passes: log verbose message and return NOOP to allow retry - On final pass: report error with detailed context - Log messages now show remaining passes (e.g., "pass 1/3, 2 more passes to try") This eliminates the need for workarounds in set_variable_values_ini() and similar functions that create sections and immediately edit them. Ticket: CFE-3866 Changelog: Title (cherry picked from commit 1a411a0)
b9b9e00 to
9ae3c7f
Compare
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.
Enable select_region to find regions created by earlier promises during
multi-pass convergence. Previously, if a promise inserted a section header
in pass 1, promises using select_region for that section would fail with
INTERRUPTED, preventing convergence.
This allows policies like set_variable_values_ini() to work without the
workarounds currently required in masterfiles.
Ticket: CFE-3866