hrw4u: Fix section placement for hookless rules in u4wrh#12956
Open
zwoop wants to merge 1 commit intoapache:masterfrom
Open
hrw4u: Fix section placement for hookless rules in u4wrh#12956zwoop wants to merge 1 commit intoapache:masterfrom
zwoop wants to merge 1 commit intoapache:masterfrom
Conversation
Old header_rewrite rules without an explicit hook condition default to REMAP. When u4wrh converted these, the section opened inside the if-block instead of wrapping it. Also emit comments inline inside if-blocks instead of deferring them to after the section closes, and remove the now-unused deferred comment machinery. In the forward direction, indent block-level comments at the statement level. Co-Authored-By: Keele Clendenin
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes u4wrh conversion for legacy header_rewrite rules that omit an explicit hook by ensuring the section wraps the generated if-block (rather than being opened inside it), and adjusts comment emission/indentation to be inline and statement-aligned.
Changes:
- Relocate pre-section
ifblocks so the section header wraps them for hookless legacy rules. - Emit comments inline within
ifblocks and remove deferred-comment buffering. - Update/generate golden test fixtures for the new formatting and add an exception entry for the legacy no-hook case.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/hrw4u/src/hrw_visitor.py | Fixes section placement by relocating pre-section if output; inlines comment emission and removes deferred-comment machinery. |
| tools/hrw4u/src/visitor.py | Indents comment output at the current statement indentation level. |
| tools/hrw4u/tests/data/examples/all-nonsense.output.txt | Updates golden output to reflect new in-block comment indentation. |
| tools/hrw4u/tests/data/conds/no-hook.input.txt | Adds a legacy hookless u4wrh input fixture to reproduce the section-wrapping bug. |
| tools/hrw4u/tests/data/conds/no-hook.output.txt | Adds corresponding expected header_rewrite output fixture. |
| tools/hrw4u/tests/data/conds/exceptions.txt | Records the legacy no-hook case as an exception with rationale. |
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.
Old header_rewrite rules without an explicit hook condition default to REMAP. When u4wrh converted these, the section opened inside the if-block instead of wrapping it. Also emit comments inline inside if-blocks instead of deferring them to after the section closes, and remove the now-unused deferred comment machinery. In the forward direction, indent block-level comments at the statement level.
Co-Authored-By: Keele Clendenin