Skip to content

fix: narrow Wall velocity validation errors#1984

Open
benflexcompute wants to merge 1 commit intomainfrom
BenY/wall-velocity-validation-hotfix
Open

fix: narrow Wall velocity validation errors#1984
benflexcompute wants to merge 1 commit intomainfrom
BenY/wall-velocity-validation-hotfix

Conversation

@benflexcompute
Copy link
Copy Markdown
Collaborator

@benflexcompute benflexcompute commented Apr 10, 2026

Summary

  • fix WallRotation.angular_velocity so its field metadata is treated as a description instead of a default value
  • route Wall.velocity dict inputs through the tagged wall-velocity models before the tuple branch is attempted
  • add a regression test for missing WallRotation.angular_velocity

Why

Missing WallRotation.angular_velocity currently produces noisy validation output:

  • the field description string is parsed as a unit expression because it was accidentally used as the default value
  • Wall.velocity is a union with VelocityVectorType, so dict inputs also leak tuple/validator branch errors that are irrelevant once type_name already points to WallRotation

Validation

  • python -m py_compile flow360/component/simulation/models/surface_models.py tests/simulation/params/test_rotation.py
  • HOME=/tmp MPLCONFIGDIR=/tmp/matplotlib /disk2/ben/SchemaMigration/Flow360/.venv/bin/python3 -m pytest -c tests/pytest.ini -rA tests/simulation/params/test_rotation.py -k 'wall_angular_velocity or missing_angular_velocity'

Note

Low Risk
Low risk: changes only Pydantic field metadata and pre-validation for Wall.velocity, primarily affecting error reporting and dict parsing rather than solver translation logic.

Overview
Fixes WallRotation.angular_velocity so its Field string is treated as a description (not a default), restoring correct “Field required” behavior when missing.

Adds a velocity pre-validator on Wall that routes dict inputs with type_name through a TypeAdapter for tagged wall-velocity models, preventing noisy union/tuple-branch validation errors. Includes a regression test asserting the narrowed validation output for missing angular_velocity.

Reviewed by Cursor Bugbot for commit 849b04b. Bugbot is set up for automated code reviews on this repo. Configure here.

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.

1 participant