Skip to content

refactor(): Replace SelectorFactory mixin with dedicated Selector classes#1661

Merged
benflexcompute merged 3 commits intomainfrom
BenY/FluentAPIV2
Dec 17, 2025
Merged

refactor(): Replace SelectorFactory mixin with dedicated Selector classes#1661
benflexcompute merged 3 commits intomainfrom
BenY/FluentAPIV2

Conversation

@benflexcompute
Copy link
Collaborator

Unified the entity selector API by replacing the SelectorFactory mixin pattern on entity classes (Surface, Edge, GenericVolume, GeometryBodyGroup) with dedicated Selector classes (SurfaceSelector, EdgeSelector, VolumeSelector, BodyGroupSelector).

Key changes:

  • Removed SelectorFactory mixin inheritance from entity classes
  • Created four new Selector classes that inherit from EntitySelector
  • Each class has target_class locked as a frozen field (type-safe)
  • Exported selector factories to fl namespace (fl.SurfaceSelector, etc.)
  • Hid syntax parameter from fluent API (UI doesn't support regex)
  • Updated docstrings to clarify "pattern-based selector" concept

Benefits:

  • Clearer separation between entity access (draft.surfaces[...]) and selector definition (fl.SurfaceSelector(...))
  • Better type safety with frozen target_class field
  • More discoverable API without exposing entity classes
  • Prevents accidental entity construction
  • Enables reusable SimulationParams templates across geometries

This change maintains backward compatibility at the selector behavior level while improving the API ergonomics and design clarity.

All tests updated and passing:

  • test_entity_selector_fluent_api: 6 tests
  • test_entity_expansion_impl: 3 tests
  • test_entity_list: 5 tests
  • test_validators_params: 2 tests
  • test_entity_processing_service: 7 tests
  • test_selector_expansion_validators: 4 tests
  • test_draft_context_end_to_end_submit_roundtrip: 1 test
  • test_solver_translator: 8 tests

…sses

Unified the entity selector API by replacing the SelectorFactory mixin pattern
on entity classes (Surface, Edge, GenericVolume, GeometryBodyGroup) with
dedicated Selector classes (SurfaceSelector, EdgeSelector, VolumeSelector,
BodyGroupSelector).

Key changes:
- Removed SelectorFactory mixin inheritance from entity classes
- Created four new Selector classes that inherit from EntitySelector
- Each class has target_class locked as a frozen field (type-safe)
- Exported selector factories to fl namespace (fl.SurfaceSelector, etc.)
- Hid syntax parameter from fluent API (UI doesn't support regex)
- Updated docstrings to clarify "pattern-based selector" concept

Benefits:
- Clearer separation between entity access (draft.surfaces[...]) and
  selector definition (fl.SurfaceSelector(...))
- Better type safety with frozen target_class field
- More discoverable API without exposing entity classes
- Prevents accidental entity construction
- Enables reusable SimulationParams templates across geometries

This change maintains backward compatibility at the selector behavior level
while improving the API ergonomics and design clarity.

All tests updated and passing:
- test_entity_selector_fluent_api: 6 tests
- test_entity_expansion_impl: 3 tests
- test_entity_list: 5 tests
- test_validators_params: 2 tests
- test_entity_processing_service: 7 tests
- test_selector_expansion_validators: 4 tests
- test_draft_context_end_to_end_submit_roundtrip: 1 test
- test_solver_translator: 8 tests
@benflexcompute benflexcompute merged commit bdab85a into main Dec 17, 2025
20 checks passed
@benflexcompute benflexcompute deleted the BenY/FluentAPIV2 branch December 17, 2025 20:29
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