fix(): Fix coordinate transformation writes to frozen BETDisk fields#1979
Merged
benflexcompute merged 1 commit intoApr 9, 2026
Conversation
angranl-flex
approved these changes
Apr 9, 2026
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.
Summary
Fix coordinate-system translation so it no longer rewrites frozen
list/tuplefields when traversing nested simulation models.Root Cause
_apply_transformations_to_model()rebuilt and reassigned every sequence field unconditionally:BETDisk.mach_numberswere reconstructed even though no transformation appliedlist[Flow360BaseModel]fields such astwists,chords, andsectional_polarsalso hit the same outersetattrThat caused translation to fail with errors like
Cannot modify immutable/frozen fields: mach_numbers.What Changed
_transform_sequence_item()behavior unchanged_apply_transformations_to_model()to only rebuild and reassign the outer sequence when an item is actually replacedFlow360BaseModelitems in place without rewriting the outer containerBETDisk + CoordinateSystemStatussetupValidation
Passed locally:
python3 -m py_compile flow360/component/simulation/translator/utils.py tests/simulation/translator/test_translation_utils.pytest_apply_coordinate_system_transformations_skips_frozen_non_entity_sequences()Local environment blocker:
python3 -m pytest tests/simulation/translator/test_translation_utils.py -qpytest_asyncioplugin is incompatible with the installedpytestversion (ImportError: cannot import name 'FixtureDef' from 'pytest')Follow-up
The same issue exists on
release-candidate/25.9and should be forward-ported in a separate follow-up PR.Note
Medium Risk
Changes recursive coordinate-system transformation traversal to stop reassigning
list/tuplefields unless an element is actually replaced, which could affect how nested models are mutated during translation. Risk is moderate because it touches shared preprocessing logic, but the behavioral change is narrowly scoped and covered by a regression test.Overview
Fixes coordinate-system preprocessing so
_apply_transformations_to_model()no longer rebuilds andsetattrs everylist/tuplefield unconditionally; it now only reassigns the outer sequence when at least one element was transformed.Adds a regression test using a minimal
BETDisksetup to verify entity coordinate translation occurs while frozen/non-entity sequences (e.g.mach_numbers,twists,chords) are not rewritten.Reviewed by Cursor Bugbot for commit 67bb07c. Bugbot is set up for automated code reviews on this repo. Configure here.