fix: extend patch validation loops to num_patches_max#1599
Draft
SVS87 wants to merge 2 commits into
Draft
Conversation
The alteration rights, smoothing, and primitive variable validation loops were bounded by num_patches, making the inactive-patch else branches unreachable. Changed all three loop bounds to num_patches_max to match the geometry loop, so inactive patch slots are validated across all four passes. Fixes MFlowCode#1482
sbryngelson
reviewed
Jun 23, 2026
sbryngelson
left a comment
Member
There was a problem hiding this comment.
Traced this and it looks correct and complete. With the bound change, all four validation passes — geometry (already at num_patches_max), alteration rights, smoothing, and flow variables — now iterate over inactive slots too, and each routes them to its inactive/unsupported branch: s_check_inactive_patch_alteration_rights (L102), s_check_unsupported_patch_smoothing via the else at L113-114, and s_check_inactive_patch_primitive_variables (L123). patch_icpp is sized num_patches_max, so the widened loops are in-bounds, and for valid cases the inactive slots hold defaults so the new checks are output-neutral (consistent with the 578-test pass). LGTM.
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.
Description
The alteration rights, smoothing, and primitive variable validation loops were bounded by num_patches, making the inactive-patch else branches unreachable. Changed all three loop bounds to num_patches_max to match the geometry loop, so inactive patch slots are validated across all four passes.
Closes #1482
Type of change (delete unused ones)
Testing
Ran ./mfc.sh test -j 4 locally on Ubuntu/WSL with GNU compiler and MPI. 578 tests passed, 0 failed. The fix is output-neutral for valid cases — the newly-reached inactive-patch checks only abort on misconfigured inputs that no passing test exercises.
AI code reviews
Reviews are not retriggered automatically. To request a review, comment on the PR:
@claude full review— Claude full review (also triggers on PR open/reopen/ready)claude-full-review— Claude full review via label