Skip to content

fix: keep block order when printing the diff - #645

Merged
drtyrsa merged 1 commit into
mainfrom
fix/diff-render-block-order
Aug 14, 2026
Merged

fix: keep block order when printing the diff#645
drtyrsa merged 1 commit into
mainfrom
fix/diff-render-block-order

Conversation

@drtyrsa

@drtyrsa drtyrsa commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

The previous fix (#643) made the patch follow the config, but the diff is printed through a second pass that regroups the rows again. annet diff does not render the diff tree: gen_sort_diff() pushes it back through make_pre() and prints it with gen_pre_as_diff(), which walked the buckets rule by rule - all rows of one rulebook rule, then all rows of the next - exactly the walk _iterate_over_patch() did before #643. An acl whose rows are matched by a permit, a deny and a remark rule came out of the printer grouped by kind, no matter what the generator produced, while the patch built from the same diff was in the right order.

Fixes #638

The previous fix (#643) made the patch follow the config, but the diff is
printed through a second pass that regroups the rows again. `annet diff`
does not render the diff tree: gen_sort_diff() pushes it back through
make_pre() and prints it with gen_pre_as_diff(), which walked the buckets
rule by rule - all rows of one rulebook rule, then all rows of the next -
exactly the walk _iterate_over_patch() did before #643. An acl whose rows
are matched by a `permit`, a `deny` and a `remark` rule came out of the
printer grouped by kind, no matter what the generator produced, while the
patch built from the same diff was in the right order.

and taught the patch side to walk the groups in that order; the printer
never got the same treatment. Let it walk the same helper - renamed to
iterate_over_pre() and extended to yield the raw rule, which the printer
needs for %show_rules.

Fixes #638

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@drtyrsa
drtyrsa merged commit 20e278d into main Aug 14, 2026
13 checks passed
@drtyrsa
drtyrsa deleted the fix/diff-render-block-order branch August 14, 2026 16:44
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.

The order of lines in the access-list is incorrect if there is a custom rule.

2 participants