Skip to content

Commit aa0b982

Browse files
committed
Bump wasm-cxx-shim to v0.4.0-alpha.1, drop wasm-uu ray_cast cfg-gates
The shim's v0.4.0-alpha.1 release moves its tested manifold pin to upstream main HEAD (`5f95a3ac`), the same commit our host build pins. That means the wasm-uu lane now sees the same C API surface as host — including ray_cast, which we cfg-gated off in 0.1.7 / 3.4.106 because the previous shim (v0.3.0) defaulted to the v3.4.1 pin and didn't have it. The gates can drop now. The shim is alpha because it carries a single vendored diff of upstream manifold#1690 (the PR that adds `MANIFOLD_NO_IOSTREAM` natively). When #1690 merges, the shim re-cuts as non-alpha v0.4.0 and the carry-patch goes away. The alpha pin SHA is encoded in the tag itself (`v0.4.0-alpha.1+5f95a3ac`) for explicit lockstep. Changes: - `crates/manifold-csg-sys/build.rs`: WASM_CXX_SHIM_TAG → `v0.4.0-alpha.1+5f95a3ac`. - Drop the `#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]` gates introduced in 0.1.7 / 3.4.106: - sys: `ManifoldRayHitVec`, `ManifoldRayHit`, `manifold_ray_hit_vec_size`, `manifold_alloc_ray_hit_vec`, `manifold_destruct_ray_hit_vec`, `manifold_delete_ray_hit_vec`, `manifold_ray_cast`, `manifold_ray_hit_vec_length`, `manifold_ray_hit_vec_get` - safe: `pub mod ray`, `pub use ray::RayHit`, `Manifold::ray_cast` - tests: `ray_cast_through_cube`, `ray_cast_miss`, `ray_cast_hit_has_normal` - `wasm32-uu/CMakeLists.txt`: comment updated. - `CLAUDE.md`: "Pin / shim follow-ups" updated to note ray_cast is no longer gated. - `.claude/skills/deep-review/SKILL.md`: matching update in section 10. - `docs/plans/wasm-unknown-unknown.md`: shim version bumped. Versions for the next release: manifold-csg-sys 3.4.106 → 3.4.107 manifold-csg 0.1.7 → 0.1.8 manifold3d-sys / manifold3d facades follow lockstep `=` pins. Verified: - 214 host integration tests pass (3 ray_cast tests run on host as always) - wasm-uu CI-equivalent build clean: cargo build --target wasm32-unknown-unknown -p manifold-csg --no-default-features --features unstable-wasm-uu --tests --examples - Produced wasm has zero unexpected imports (`wasm-objdump -x -j Import` reports "Section not found") — confirms ray_cast now resolves against the helper-built manifold archive - 12 playground Node tests pass against the new build - cargo fmt + cargo clippy clean Followup: when shim's non-alpha v0.4.0 ships (after #1690 merges), bump the pin off `-alpha.1`. No code changes expected — just a tag swap.
1 parent 362a82e commit aa0b982

15 files changed

Lines changed: 25 additions & 48 deletions

File tree

.claude/skills/deep-review/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ This crate tracks manifold3d upstream. Verify:
195195
- Pinned version in `build.rs` — what version are we on? What's latest? What changed?
196196
- ABI compatibility — have any C API function signatures changed in newer manifold3d releases?
197197
- Deprecated functions — are we binding any C API functions that upstream has deprecated?
198-
- **wasm32-unknown-unknown cfg-gates may need revisiting.** Grep for `target_os = "unknown"` across the workspace. Each gated FFI declaration / safe wrapper / test is gated because that C API surface postdates the shim's tested manifold pin. When the shim's tested pin moves to (or past) our host pin, those gates can be removed. Currently gated: `manifold_ray_*` (ray casting). The OBJ I/O gates are gated for a different reason (iostream patches strip them) and stay regardless.
198+
- **wasm32-unknown-unknown cfg-gates may need revisiting.** Grep for `target_os = "unknown"` across the workspace. Each gated FFI declaration / safe wrapper / test is gated because that C API surface postdates the shim's tested manifold pin. When the shim's tested pin moves to (or past) our host pin, those gates can be removed. The OBJ I/O gates (`manifold_*_obj`) are gated for a different reason (iostream patches strip them) and stay regardless.
199199
- New capabilities — has upstream added significant new C API surface (new types, new operations) that we're missing?
200200
- Build system changes — has manifold3d changed its CMake structure, added/removed FetchContent deps, changed library names?
201201
- Known upstream bugs — check manifold3d issues for bugs affecting functions we bind (especially boolean operations, MeshGL64, CrossSection offset)

.claude/skills/update-upstream/SKILL.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ git checkout -b update-upstream-<ref>
3434
- Otherwise, query upstream master HEAD: `gh api repos/elalish/manifold/git/refs/heads/master --jq '.object.sha'`
3535
- Show the user: current pin (from `MANIFOLD_VERSION` in `crates/manifold-csg-sys/build.rs`), the target, and a one-line commit summary of what's between them: `gh api repos/elalish/manifold/compare/<current>...<target> --jq '{ahead_by: .ahead_by, commits: [.commits[] | {sha: .sha[0:8], message: (.commit.message | split("\n")[0])}]}'`
3636
- Confirm before proceeding.
37+
- **Check shim coverage.** Before committing to the target, verify `wasm-cxx-shim` supports it. Look at the latest shim release's `MANIFOLD_GIT_TAG` default (in the helper at `cmake/WasmCxxShimManifold.cmake`, or in the release notes). If the target SHA is past the shim's tested pin, flag it: either pick a target the shim already supports, or be ready to cfg-gate any new C API on `not(all(target_arch = "wasm32", target_os = "unknown"))` (the wasm-uu lane will fall back to the shim's tested pin via `wasm_cxx_shim_add_manifold()`'s default). Mismatch without gating produces wasm-uu link failures — see CLAUDE.md "Versioning" section.
3738

3839
### 3. Update the pin
3940

CLAUDE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ The sys crate clones manifold3d (pinned to a specific commit on master, post-v3.
2121
- **`manifold-csg-sys`** uses version `{major}.{minor}.{patch}` where major.minor tracks the upstream manifold3d version and patch >= 100 is our release number. For example, `3.4.100` tracks manifold3d v3.4.1, and `3.4.101` would be our next release against the same upstream. Patch bumps (e.g., `3.4.101``3.4.102`) must be semver-compatible: no removed or changed function signatures, only additions.
2222
- **`manifold-csg`** uses standard semver (`0.1.0`, etc.) independent of the upstream version. Its `Cargo.toml` pins the sys crate version it depends on.
2323
- When bumping the manifold3d pin in `build.rs`, the sys crate version must be updated to match (e.g., manifold3d v3.5.0 -> sys crate `3.5.100`).
24+
- **Before bumping `MANIFOLD_VERSION`, check that `wasm-cxx-shim` supports the new pin.** The shim's helper (`wasm_cxx_shim_add_manifold()`) ships carry-patches generated against a specific manifold commit; pins past that point may not patch cleanly, and FFI declarations for any C API added in the gap will produce wasm-uu link failures. Two paths if the shim hasn't caught up: (1) wait for a shim release that pins past your target SHA, or (2) cfg-gate the new FFI surface on `not(all(target_arch = "wasm32", target_os = "unknown"))` so the wasm-uu lane stays on the shim's tested pin. The "Pin / shim follow-ups" section below covers the post-bump cleanups for path (2).
2425
- The sys crate pins upstream to a specific commit SHA rather than a tag. This is necessary because upstream doesn't follow strict semver — minor releases can include breaking changes. Pinning to a commit gives us the same reproducibility as a tag, while allowing us to pick up post-release fixes and carry-patches between releases.
2526
- **Version bumps**: feature PRs may (and usually should) include their own version bump so the merge is ready to publish. The `/publish` skill will bump at publish time only if no PR has done so since the last release. Note that `cargo-semver-checks` CI requires a bump whenever the PR changes the public API in a way the current version doesn't allow (e.g., a breaking change requires a minor bump pre-1.0).
2627
- **Facade crates** (`manifold3d`, `manifold3d-sys`) always ship in lockstep with their canonical counterparts (`manifold-csg`, `manifold-csg-sys`) via `=` version pins. Bumping the canonical means bumping the facade.
@@ -48,7 +49,7 @@ The sys crate clones manifold3d (pinned to a specific commit on master, post-v3.
4849

4950
Things to revisit whenever the manifold pin moves OR `wasm-cxx-shim` cuts a new release:
5051

51-
- **Re-evaluate wasm32-unknown-unknown cfg-gates.** Any FFI declaration / safe wrapper / test gated on `not(all(target_arch = "wasm32", target_os = "unknown"))` exists because that surface postdates the shim's tested manifold pin. When the shim's tested pin moves up to (or past) our host pin, those gates can be dropped and the surface unified across targets. Current gated surface: `manifold_ray_*` (ray casting), `manifold_*_obj` (OBJ I/O — gated for a different reason: iostream patches strip it). Grep for `target_os = "unknown"` to enumerate.
52+
- **Re-evaluate wasm32-unknown-unknown cfg-gates.** Any FFI declaration / safe wrapper / test gated on `not(all(target_arch = "wasm32", target_os = "unknown"))` exists because that surface postdates the shim's tested manifold pin. When the shim's tested pin moves up to (or past) our host pin, those gates can be dropped and the surface unified across targets. Current gated surface: `manifold_*_obj` (OBJ I/O — gated for a different reason: iostream patches strip it; this stays regardless). Ray casting is **no longer gated** as of shim v0.4.0-alpha.1, whose tested pin matches our host pin. Grep for `target_os = "unknown"` to enumerate.
5253
- **Re-evaluate carry-patches.** For each patch in `crates/manifold-csg-sys/patches/` (if any), check whether it's merged upstream and included in the new pin; if so, delete it.
5354

5455
## Carry-patches

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ members = [
1010
resolver = "2"
1111

1212
[workspace.package]
13-
version = "0.1.7"
13+
version = "0.1.8"
1414
edition = "2024"
1515
license = "Apache-2.0 OR MIT"
1616
repository = "https://github.com/zmerlynn/manifold-csg"

crates/manifold-csg-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "manifold-csg-sys"
33
description = "Raw FFI bindings to the manifold3d C API for constructive solid geometry"
4-
version = "3.4.106"
4+
version = "3.4.107"
55
edition.workspace = true
66
license.workspace = true
77
repository.workspace = true

crates/manifold-csg-sys/build.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,11 @@ fn main() {
404404
// build.rs instead of a cmake file).
405405

406406
const WASM_CXX_SHIM_GIT: &str = "https://github.com/zmerlynn/wasm-cxx-shim.git";
407-
const WASM_CXX_SHIM_TAG: &str = "v0.3.0";
407+
// v0.4.0-alpha.1 pins manifold to the same commit as our host build
408+
// (`5f95a3ac`), so the wasm-uu lane sees the same C API surface (including
409+
// ray_cast). Will move to non-alpha v0.4.0 once upstream manifold#1690
410+
// (the iostream gating PR the alpha vendors as a carry-patch) merges.
411+
const WASM_CXX_SHIM_TAG: &str = "v0.4.0-alpha.1+5f95a3ac";
408412

409413
fn build_wasm_unknown_unknown() {
410414
println!("cargo:rerun-if-changed=build.rs");

crates/manifold-csg-sys/src/lib.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ pub struct ManifoldSimplePolygon {
4949
}
5050

5151
/// Opaque handle to a manifold3d `RayHitVec` (vector of ray hit results).
52-
///
53-
/// Unavailable on `wasm32-unknown-unknown` — that lane builds against the
54-
/// shim's tested manifold pin (v3.4.1), which predates ray casting.
55-
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
5652
#[repr(C)]
5753
#[derive(Debug)]
5854
pub struct ManifoldRayHitVec {
@@ -163,10 +159,6 @@ pub struct ManifoldProperties {
163159
}
164160

165161
/// Result of a ray-manifold intersection test.
166-
///
167-
/// Unavailable on `wasm32-unknown-unknown` — see [`ManifoldRayHitVec`] for
168-
/// the rationale.
169-
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
170162
#[repr(C)]
171163
#[derive(Debug, Clone, Copy)]
172164
pub struct ManifoldRayHit {
@@ -276,7 +268,6 @@ unsafe extern "C" {
276268
pub fn manifold_box_size() -> usize;
277269
pub fn manifold_rect_size() -> usize;
278270
pub fn manifold_triangulation_size() -> usize;
279-
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
280271
pub fn manifold_ray_hit_vec_size() -> usize;
281272

282273
// ── Allocation ─────────────────────────────────────────────────────
@@ -292,7 +283,6 @@ unsafe extern "C" {
292283
pub fn manifold_alloc_box() -> *mut ManifoldBox;
293284
pub fn manifold_alloc_rect() -> *mut ManifoldRect;
294285
pub fn manifold_alloc_triangulation() -> *mut ManifoldTriangulation;
295-
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
296286
pub fn manifold_alloc_ray_hit_vec() -> *mut ManifoldRayHitVec;
297287

298288
// ── Destruction (destruct only, does not free) ─────────────────────
@@ -308,7 +298,6 @@ unsafe extern "C" {
308298
pub fn manifold_destruct_box(b: *mut ManifoldBox);
309299
pub fn manifold_destruct_rect(b: *mut ManifoldRect);
310300
pub fn manifold_destruct_triangulation(m: *mut ManifoldTriangulation);
311-
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
312301
pub fn manifold_destruct_ray_hit_vec(v: *mut ManifoldRayHitVec);
313302

314303
// ── Deletion (destruct + free) ─────────────────────────────────────
@@ -324,7 +313,6 @@ unsafe extern "C" {
324313
pub fn manifold_delete_box(b: *mut ManifoldBox);
325314
pub fn manifold_delete_rect(b: *mut ManifoldRect);
326315
pub fn manifold_delete_triangulation(m: *mut ManifoldTriangulation);
327-
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
328316
pub fn manifold_delete_ray_hit_vec(v: *mut ManifoldRayHitVec);
329317

330318
// ── Polygons ───────────────────────────────────────────────────────
@@ -1072,12 +1060,8 @@ unsafe extern "C" {
10721060
) -> *mut ManifoldManifold;
10731061

10741062
// ── Ray casting ─────────────────────────────────────────────────────
1075-
//
1076-
// Postdates the manifold v3.4.1 pin the wasm32-uu lane builds against,
1077-
// so the whole ray-cast surface is cfg-elided on that target.
10781063

10791064
/// Cast a ray from `origin` to `end` against a manifold, returning all hits.
1080-
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
10811065
pub fn manifold_ray_cast(
10821066
mem: *mut ManifoldRayHitVec,
10831067
m: *const ManifoldManifold,
@@ -1090,11 +1074,9 @@ unsafe extern "C" {
10901074
) -> *mut ManifoldRayHitVec;
10911075

10921076
/// Number of hits in a ray hit vector.
1093-
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
10941077
pub fn manifold_ray_hit_vec_length(v: *const ManifoldRayHitVec) -> usize;
10951078

10961079
/// Get a hit by index from a ray hit vector.
1097-
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
10981080
pub fn manifold_ray_hit_vec_get(v: *const ManifoldRayHitVec, idx: usize) -> ManifoldRayHit;
10991081

11001082
// ── Bounding box ────────────────────────────────────────────────────

crates/manifold-csg-sys/wasm32-uu/CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,12 @@ add_compile_options(
6666
)
6767

6868
# FetchContent + patches + manifold/Clipper2 options + base compile flags.
69-
# Uses the helper's tested-pin defaults (manifold v3.4.1, Clipper2 matching
70-
# SHA). The host build pins newer SHAs to pick up post-3.4.1 fixes; FFI
71-
# declarations and safe wrappers for any C API surface that postdates v3.4.1
72-
# (e.g., manifold_ray_cast) are cfg-gated off on this target so the wasm
73-
# produced here has no unresolved imports against the helper's pin.
69+
# Uses the helper's tested-pin default. As of shim v0.4.0-alpha.1 the
70+
# helper's default pin matches our host pin (`5f95a3ac`), so the wasm-uu
71+
# lane sees the same C API surface as the host build (including ray_cast).
72+
# When the host pin moves past the helper's tested pin again, either
73+
# override via `MANIFOLD_GIT_TAG` here or cfg-gate the new surface on
74+
# this target — see the "Pin / shim follow-ups" section in CLAUDE.md.
7475
wasm_cxx_shim_add_manifold()
7576

7677
# Force the manifold + Clipper2 archives to build by default. Without

crates/manifold-csg/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ nalgebra = ["dep:nalgebra"]
1919
unstable-wasm-uu = ["manifold-csg-sys/unstable-wasm-uu"]
2020

2121
[dependencies]
22-
manifold-csg-sys = { path = "../manifold-csg-sys", version = "3.4.106", default-features = false }
22+
manifold-csg-sys = { path = "../manifold-csg-sys", version = "3.4.107", default-features = false }
2323
thiserror = "2"
2424
log = "0.4"
2525
nalgebra = { version = "0.34", optional = true }

crates/manifold-csg/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ pub mod bounding_box;
2323
pub mod cross_section;
2424
pub mod manifold;
2525
pub mod mesh;
26-
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
2726
pub mod ray;
2827
pub mod rect;
2928
pub mod triangulation;
@@ -38,7 +37,6 @@ pub use manifold::{
3837
};
3938
pub use manifold_csg_sys::ManifoldOpType as OpType;
4039
pub use mesh::{MeshGL, MeshGL64};
41-
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
4240
pub use ray::RayHit;
4341
pub use rect::Rect;
4442
pub use triangulation::triangulate_polygons;

0 commit comments

Comments
 (0)