Dev - #42
Merged
Merged
Dev#42
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Dense point clouds (>4096 points) are reduced to their outer rim (max-radius candidates per angular bin around the centroid) before the shapely minimum-bounding-circle call, and the redundant pd.isna scan on float arrays is gone. ~10-25x faster on jelly-roll cross-sections with sub-micrometre result drift. Co-authored-by: Cursor <cursoragent@cursor.com>
`SerializerMixin.deserialize` resolved class paths taken from the payload:
`_get_class` passed them to `importlib.import_module` + `getattr`, and the
`__enum__` branch then *called* the result with a payload-supplied argument. A
crafted `.ocd` file could therefore reach any importable callable, e.g.
{"__enum__": true, "class": "os.system", "value": "<cmd>"}
Class resolution is now gated by an allowlist of top-level packages, and the
resolved object must be a class of the expected kind — a SerializerMixin
subclass for objects, an Enum subclass for enums. Restricting the enum branch to
real enums is what makes that call safe: `SomeEnum(value)` is a member lookup.
Rejections raise the new `UnsafeClassPathError`, a `ValueError` subclass, so
callers already catching `ValueError` around `deserialize` are unaffected.
`allow_class_roots()` lets downstream packages register their own roots.
Verified against real data: every class path in all 19 cells in the OpenCell
reference database resolves under `steer_opencell_design` and is a
SerializerMixin or Enum subclass, and all 19 still deserialize and round-trip.
The gadget above is rejected without executing.
Bumped to 0.2.21. 13 new tests cover the gadgets, the type checks, malformed
paths, and a legitimate round trip as the positive control.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
msgpack_update
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.