Skip to content

Commit e288cb6

Browse files
committed
update porting plan
1 parent d5fc59c commit e288cb6

1 file changed

Lines changed: 41 additions & 2 deletions

File tree

PORTING_PLAN.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ rich polygon, mesh, sketch, vertex, toolpath, or CSG types.
103103
- triangulation orchestration
104104
- smoothing, quality, manifold, and connectivity utilities
105105
- CNC/toolpath-facing types
106-
- import/export glue for STL, OBJ, PLY, DXF, Gerber, SVG, glTF, AMF, and WASM
106+
- import/export glue for STL, OBJ, PLY, DXF, Gerber, SVG, glTF, and AMF
107+
- WASM bindings and platform support as a compilation target, not as an input
108+
or output file format
107109
- metadata propagation rules
108110

109111
`csgrs` may re-export or alias lower-level point/vector/matrix types for user
@@ -1161,7 +1163,12 @@ Toolpath code depends heavily on topology and offsets:
11611163

11621164
### WASM tests
11631165

1164-
WASM bindings must preserve the Rust API contract:
1166+
WASM is a supported compilation target and JS binding surface, not a geometry
1167+
file format. `csgrs` should never treat `.wasm` as an import/export format for
1168+
models; the only produced WASM artifact is the compiled library/bindings.
1169+
1170+
WASM bindings must preserve the Rust API contract while respecting browser and
1171+
wasm32 platform constraints:
11651172

11661173
- constructor parity between Rust and JS-facing APIs
11671174
- boolean parity for small fixtures
@@ -1173,6 +1180,34 @@ WASM bindings must preserve the Rust API contract:
11731180
- feature-gated functions unavailable when their features are off
11741181
- wasm-pack build smoke tests
11751182
- browser-side snapshot tests for representative APIs where practical
1183+
- limited stack depth:
1184+
- avoid recursive BSP, polygon splitting, contour traversal, and repair paths
1185+
that can overflow the smaller wasm stack on adversarial inputs
1186+
- add deep-tree and deeply nested geometry tests under wasm32
1187+
- prefer iterative work queues or explicit recursion limits at JS-callable
1188+
boundaries
1189+
- bounded linear memory growth:
1190+
- reject or report oversized typed arrays before allocation where practical
1191+
- test large-but-valid meshes, sketches, and imports for predictable memory
1192+
behavior
1193+
- ensure caches, triangulation scratch buffers, and boolean temporaries are
1194+
dropped or reusable after JS-visible operations
1195+
- panic and error behavior:
1196+
- no public WASM API should depend on unwinding across the JS boundary
1197+
- convert invalid inputs, unsupported features, and allocation-size guards into
1198+
stable JS errors
1199+
- fuzz JS-facing typed-array parsers for wrong lengths, NaN, infinities,
1200+
negative indices, huge indices, and detached/empty arrays
1201+
- platform feature constraints:
1202+
- no filesystem assumptions in browser builds
1203+
- no thread/rayon assumptions unless wasm threads are explicitly enabled
1204+
- deterministic output despite platform differences in timers, JS number
1205+
conversion, and optional SIMD/thread support
1206+
- file-format boundary:
1207+
- STL/OBJ/PLY/DXF/SVG/Gerber/glTF/AMF parsing and writing may be exposed to
1208+
JS as ordinary library functions where features permit
1209+
- compiled WASM itself is not a model interchange format and should not appear
1210+
in IO format lists, import/export matrices, or geometry fixture manifests
11761211

11771212
### Caches and acceleration structure tests
11781213

@@ -1702,6 +1737,8 @@ Show-off examples:
17021737
how to handle it.
17031738
- Metadata behavior remains entirely owned by `csgrs`.
17041739
- IO formats should not leak lower-stack internals into public file APIs.
1740+
- WASM is a supported platform target and binding layer, not a consumed or
1741+
produced geometry file format.
17051742
- Avoid moving a type downward just because it contains coordinates.
17061743
- Avoid making `hyperlimit` responsible for CSG concepts such as polygon
17071744
splitting policy or manifold repair.
@@ -1737,6 +1774,8 @@ This gives an early robustness win without forcing a broad public API rewrite.
17371774
- Do not move `Mesh<S>` or `Sketch<S>` into the lower stack.
17381775
- Do not make `hyperlimit` a mesh-processing crate.
17391776
- Do not make `hyperlattice` aware of file formats or CSG operations.
1777+
- Do not list WASM as a geometry file format; it is only a compilation target
1778+
and binding artifact for the library.
17401779
- Do not expose backend generics everywhere until the ergonomics are proven.
17411780
- Do not remove `nalgebra` interop until replacement ergonomics are clearly
17421781
better for existing users.

0 commit comments

Comments
 (0)