fix(validation): relax the number of geometries in ClipOperation #2889
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.
This PR is to unblock some tests. Backend improvement will be worked on soon.
Greptile Overview
Updated On: 2025-10-13 19:04:51 UTC
Greptile Summary
This PR relaxes validation constraints for geometric operations by increasing the maximum allowed geometry count in a single structure from 100 to 5000. The change affects the
MAX_GEOMETRY_COUNTconstant inscene.pyand is intended to support more complex ClipOperations that contain numerous geometric components. This modification unblocks failing tests that were hitting the previous geometric complexity limit. The change is properly documented in the CHANGELOG.md under the "Changed" category, indicating it's a modification to existing validation behavior rather than a bug fix. The PR serves as a temporary workaround while backend performance improvements are being developed to handle complex geometries more efficiently.Changed Files
CHANGELOG.mdtidy3d/components/scene.pyConfidence score: 4/5
tidy3d/components/scene.pyto ensure the increased limit doesn't introduce performance issues in productionSequence Diagram
sequenceDiagram participant User participant Scene participant Validator participant Structure participant Medium participant GeometryGroup participant ClipOperation participant Logger User->>Scene: Create Scene with structures Scene->>Validator: Validate structures count alt Too many structures Validator->>Logger: Log warning about structures per medium alt Exceeds maximum Validator->>Scene: Raise SetupError end end Scene->>Validator: Validate number of geometries loop For each structure Validator->>Structure: Get geometry Structure->>GeometryGroup: Flatten groups if needed GeometryGroup->>ClipOperation: Count geometries alt Too many geometries Validator->>Scene: Raise SetupError end end Scene->>Scene: Create cached properties Scene->>Structure: Sort structures by priority Scene->>Scene: Build medium map User->>Scene: Call plot method Scene->>Scene: Get plot limits from bounds Scene->>Scene: Get structures for 2D box loop For each structure Scene->>Structure: Get geometry intersections Scene->>Medium: Get plotting parameters Scene->>Scene: Plot shape with medium end Scene->>Scene: Return matplotlib axesContext used (3)
dashboard- Update the CHANGELOG.md file when making changes that affect user-facing functionality or fix bugs. (source)dashboard- Use changelog categories correctly: "Fixed" for bug fixes, "Changed" for modifications to existing f... (source)dashboard- Add new constants to the existing constants.py file rather than defining them locally. Be careful wi... (source)