Skip to content

Relay migrated simulation schema services from flow360-schema#2000

Open
benflexcompute wants to merge 7 commits intomainfrom
codex/simulation-schema-migration-batch-1-client-main-v2
Open

Relay migrated simulation schema services from flow360-schema#2000
benflexcompute wants to merge 7 commits intomainfrom
codex/simulation-schema-migration-batch-1-client-main-v2

Conversation

@benflexcompute
Copy link
Copy Markdown
Collaborator

@benflexcompute benflexcompute commented Apr 17, 2026

What changed

  • converted more of flow360/component/simulation/ into thin relays over schema-owned implementations
  • removed duplicate client implementations for migrated schema-owned logic, including validation service entry points, schema service helpers, updater helpers, conversion helpers, utils, and services_utils
  • removed duplicate client tests that now belong to schema ownership in the paired schema PR

Why

The migration target is for the client to keep runtime-only responsibilities such as translator orchestration, web API code, BET wrappers, and unit-switching, while schema owns Pydantic behavior, validation, and deserialization.

This PR is the final replacement client migration batch re-rooted onto the true current main.

Impact

  • client-side duplication is reduced substantially in this batch
  • schema-owned tests now live with the code they validate
  • the remaining client work is more clearly limited to runtime orchestration and a smaller set of residual case-by-case migrations

Validation

  • python -m py_compile flow360/component/simulation/services.py flow360/component/simulation/services_utils.py flow360/component/simulation/conversion.py flow360/component/simulation/utils.py flow360/component/simulation/framework/updater.py flow360/component/simulation/framework/updater_functions.py flow360/component/simulation/framework/updater_utils.py
  • targeted schema-side test suites were run in the paired schema PR for the migrated behavior
  • targeted client smoke tests were run during the migration for relay boundaries, but a full client pytest run was not used for this batch because the local client environment still had an older installed flow360-schema package during development

Paired Schema PR

  • flexcompute/flex#11404

Remaining Work From Plan

  • audit and shrink legacy unit_system.py / exposed_units.py only after confirming real remaining consumers
  • keep translator, BET request wrappers, web API code, process-json generation, and unit-switching orchestration on the client side
  • continue the remaining case-by-case cleanup in client tests and any residual helper boundaries, especially the still-mixed portions of tests/simulation/params/test_validators_params.py and tests/simulation/services/test_selector_expansion_validators.py
  • leave draft/project/web/runtime workflow tests on the client side unless a specific case proves to be pure schema behavior

Follow-up

This PR supersedes #1998 and #1999 for review against main. The remaining items should be finished in a follow-up PR rather than expanding this one further.


Note

Medium Risk
Medium risk because core simulation validation/updater/conversion entrypoints are now delegated to the external flow360-schema package, so behavioral changes depend on that version bump and can affect many workflows despite minimal in-repo code changes.

Overview
This PR turns several flow360/component/simulation modules into thin relay layers over flow360_schema implementations, removing large blocks of duplicated client logic.

Key entrypoints like simulation validate_model, updater orchestration/helpers/utilities, unit conversion helpers, and various service/utils helpers now import and re-export schema-owned functions/constants instead of maintaining local copies, and the flow360-schema dependency is bumped to 25.10.2b1.

It also removes multiple client-side JSON fixtures/reference files that validated the duplicated behavior, with the expectation that these tests now live with the schema code.

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

@benflexcompute benflexcompute changed the title [codex] Relay migrated simulation schema services from flow360-schema Relay migrated simulation schema services from flow360-schema Apr 17, 2026
Add `# pylint: disable=unused-import` to relay-only files whose
re-exported symbols are consumed by compute pipeline scripts.
Remove genuinely unused `materialize_entities_and_selectors_in_place`
import from services.py.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@benflexcompute benflexcompute marked this pull request as ready for review April 17, 2026 19:20
Keep only relay exports consumed by external compute scripts
(_parse_root_item_type_from_simulation_json, apply_simulation_setting_to_entity_info,
get_default_params, merge_geometry_entity_info, update_simulation_json).
Remove 15 symbols with no internal or external callers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread flow360/component/simulation/services.py
Comment thread flow360/component/simulation/services.py
Comment thread flow360/component/simulation/services.py
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

There are 4 total unresolved issues (including 2 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 355d0ef. Configure here.

RestrictedUnitSystem,
compute_udf_dimensionalization_factor,
get_flow360_unit_system_liquid,
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing relay exports for previously available public symbols

Low Severity

The old conversion.py exported need_conversion, require, and get_from_dict_by_key_list which are no longer re-exported in the relay module. While current in-tree consumers don't appear to use these from this path, dropping public symbols from a module that external callers may depend on can break downstream code. If these are intentionally removed, the module's relay comment could note the deprecation; otherwise they belong in the re-export list.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 355d0ef. Configure here.

compare_values,
deprecation_reminder,
recursive_remove_key,
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Schema's deprecation_reminder may use wrong version

Medium Severity

The old deprecation_reminder compared against the client's flow360.version.__version__. Now it's imported from flow360_schema, which likely compares against the schema package's own version. Since user_code/core/types.py registers this with register_deprecation_check, deprecation checks for expressions could fire at the wrong time if the schema and client version strings diverge.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 355d0ef. 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