Skip to content

schema(): Split draft context managers from schema state#1983

Merged
benflexcompute merged 6 commits intoBenY/CentralizedSchemafrom
BenY/draft-context-state-manager-split
Apr 10, 2026
Merged

schema(): Split draft context managers from schema state#1983
benflexcompute merged 6 commits intoBenY/CentralizedSchemafrom
BenY/draft-context-state-manager-split

Conversation

@benflexcompute
Copy link
Copy Markdown
Collaborator

@benflexcompute benflexcompute commented Apr 9, 2026

What changed

  • refactor CoordinateSystemManager into a thin client facade over schema-side CoordinateSystemState
  • refactor MirrorManager into a thin client facade over schema-side MirrorState
  • keep user-facing draft APIs and docstrings on the client managers
  • preserve the currently used internal compatibility surface needed by draft plumbing, translators, and tests
  • normalize manager errors to Flow360ValueError
  • update draft-context tests accordingly

Why

The simulation schema migration was about to drag full client draft managers into schema. That would blur the package boundary and make the migration PR harder to review.

This PR isolates the client-facing manager layer from the reusable state/core layer first, so the later migration PR can stay focused on mostly 1:1 model movement.

Impact

  • client still owns the user-facing draft manager API
  • schema owns the reusable coordinate-system and mirror state logic
  • migration PRs no longer need to carry manager implementation churn together with model moves

Validation

  • pytest tests/simulation/draft_context/test_coordinate_system_assignment.py
  • pytest tests/simulation/validation/test_coordinate_system_constraints.py
  • pytest tests/simulation/draft_context/test_mirror_action.py
  • pytest tests/simulation/params/test_simulation_params.py::test_transformation_matrix
  • pytest tests/simulation/translator/test_gai_coordinate_system_e2e.py
  • pytest tests/simulation/translator/test_mirrored_entity_translation.py
  • pytest tests/simulation/translator/test_surface_meshing_translator.py

Notes

Local pyproject.toml / poetry.lock path-dependency drift in the client worktree was intentionally left out of this PR.


Note

Medium Risk
Moderate refactor of draft-context coordinate system and mirror managers to delegate core behavior to schema-side state objects; regressions would impact entity transformations and mirrored-entity generation/serialization. Also bumps flow360-schema dependency, which can change runtime behavior beyond this repo.

Overview
Refactors draft-context managers to use schema state via composition. CoordinateSystemManager now wraps CoordinateSystemState and delegates graph validation, matrix composition, status (de)serialization, and entity assignment helpers while preserving a small internal compatibility surface (_coordinate_systems, _coordinate_system_parents, _entity_key_to_coordinate_system_id).

Mirroring logic is similarly moved behind MirrorState. MirrorManager drops its local derived-entity/build/serialization helpers in favor of MirrorState (and schema-exported _derive_mirrored_entities_from_actions/MIRROR_SUFFIX), adjusts MirrorPlane import, and keeps compatibility accessors for draft plumbing.

Behavioral/contract tweaks. Manager-raised errors are normalized to Flow360ValueError, draft-context tests are updated accordingly (plus a new invalid-input test for create_mirror_of), and flow360-schema is bumped to ~0.1.24 in pyproject.toml/poetry.lock.

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

@benflexcompute benflexcompute changed the title [codex] Split draft context managers from schema state schema(): Split draft context managers from schema state Apr 10, 2026
@benflexcompute benflexcompute marked this pull request as ready for review April 10, 2026 00:33
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

Coverage report (flow360)

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  flow360/component/simulation/draft_context
  coordinate_system_manager.py 119, 256, 282
  mirror.py 69, 88, 145
Project Total  

This report was generated by python-coverage-comment-action

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 1 potential issue.

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 f3e3607. Configure here.

@benflexcompute benflexcompute enabled auto-merge (squash) April 10, 2026 17:24
@benflexcompute benflexcompute merged commit 04e00af into BenY/CentralizedSchema Apr 10, 2026
18 checks passed
@benflexcompute benflexcompute deleted the BenY/draft-context-state-manager-split branch April 10, 2026 17:24
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.

2 participants