[Snappy] Proximity spacing additional validator#1949
[Snappy] Proximity spacing additional validator#1949piotrkluba wants to merge 8 commits intorelease-candidate/25.8from
Conversation
flow360/component/simulation/meshing_param/snappy/snappy_params.py
Outdated
Show resolved
Hide resolved
flow360/component/simulation/meshing_param/snappy/snappy_params.py
Outdated
Show resolved
Hide resolved
| if isinstance(refinement, BodyRefinement): | ||
| if refinement.min_spacing is None and refinement.proximity_spacing: | ||
| if refinement.proximity_spacing > self.defaults.min_spacing: | ||
| log.warning( |
There was a problem hiding this comment.
use add_validation_warning()
There was a problem hiding this comment.
Changing the user input in the validator is something I try to avoid, I cannot say exactly what is wrong with it but it feels strange to make SimulationParams mutable during the validation process.
I guess we cannot make this an error and ask user to fix it b.c. it breaks compatibility. Let's keep this as is for now and we will see how this holds up.
There was a problem hiding this comment.
Tbh, we coul eaisly make this an error. Snappy does not have any real users really and its a small change so we can make this an error if you wiss
There was a problem hiding this comment.
Made it an error
flow360/component/simulation/meshing_param/snappy/snappy_mesh_refinements.py
Show resolved
Hide resolved
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Note
Medium Risk
Tightens validation by turning an auto-correcting warning into hard
ValueErrors, which can break existing configs that previously passed and were silently clamped. Changes are localized to snappy meshing parameter validation with low runtime risk but potential user-facing validation failures.Overview
Enforces stricter
proximity_spacingvalidation for Snappy refinements.SnappyEntityRefinementnow raises aValueErrorwhenproximity_spacing > min_spacinginstead of logging a warning and mutating the value.Adds default-aware validation for
BodyRefinement. Whenmin_spacingis omitted,SurfaceMeshingParamsnow rejectsBodyRefinement.proximity_spacingvalues that exceeddefaults.min_spacing, and new tests cover both failing and passing cases for these scenarios.Written by Cursor Bugbot for commit a4a4adf. This will update automatically on new commits. Configure here.