Skip to content

feat(build): build no_std components for wasm32-unknown-unknown, not wasip2 - #329

Merged
avrabe merged 1 commit into
mainfrom
feat/nostd-components-target-unknown
Aug 5, 2026
Merged

feat(build): build no_std components for wasm32-unknown-unknown, not wasip2#329
avrabe merged 1 commit into
mainfrom
feat/nostd-components-target-unknown

Conversation

@avrabe

@avrabe avrabe commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Why

target_env = "p2" is the wasip2 rust target, not "Component Model Preview 2". That target links wasi-libc, whose cabi_realloc goes through malloc → memory.growmeld fuse --memory shared --address-rebase rejects the component (gale#89, meld#299), blocking the single-address-space MCU lowering these components exist for.

A component doesn't need the wasip2 target to be a valid P2 component. Measured on falcon-rate — same source, only the target differs:

target component? wasi:* memory.grow size
wasm32-wasip2 0 1 4,674 B
wasm32-unknown-unknown 0 0 3,953 B

Closed-loop proof identical on both (0.193 s, |err| 0.0059 rad/s). gale provides gust:os/gust:hal, not WASI — nothing on this path should link wasi-libc.

What

Target is now per-component: NOSTD_COMPONENTS (today just rate) builds wasm32-unknown-unknown; everything still on std keeps wasip2, because std needs it. Components join the list as they're converted — jess's per-stage report (3 skips → 1 on the converted rate, both RA-tail helpers cleared) is the priority order.

Deliberately not in this PR

Consuming pulseengine/wit-bindgen's cabi-realloc-extern, so cabi_realloc delegates to gale's __cabi_arena_realloc — one embedder-owned arena per fused image instead of the per-component arena we carry today.

That turns out to be wit-bindgen 0.41 → 0.58 plus a crate restructure (wit-bindgen-rt is folded into wit-bindgen), i.e. a migration on the flight path rather than a dependency swap. Tracked separately so it gets its own review.

🤖 Generated with Claude Code

…wasip2

`target_env = "p2"` is the wasip2 RUST TARGET, not "Component Model Preview 2".
That target links wasi-libc, and wasi-libc's `cabi_realloc` goes through malloc
— which emits `memory.grow`, the thing that makes
`meld fuse --memory shared --address-rebase` reject a component (gale#89,
meld#299) and blocks the single-address-space MCU lowering these components
exist for.

A component does NOT need the wasip2 target to be a valid P2 component.
Measured on falcon-rate, same source, only the target differs:

    wasm32-wasip2            component, 0 wasi imports, memory.grow=1, 4674 B
    wasm32-unknown-unknown   component, 0 wasi imports, memory.grow=0, 3953 B

and the through-wasm closed-loop proof is identical on both (converges 0.193 s,
|err| 0.0059 rad/s). gale provides gust:os/gust:hal, not WASI, so nothing on
this path should link wasi-libc at all.

Make the target per-component rather than global: NOSTD_COMPONENTS lists the
converted ones (today just `rate`) and gets wasm32-unknown-unknown; everything
still on std keeps wasip2, because std needs it. Components join the list as
they are converted — jess's per-stage lowering report (3 skips -> 1 on the
converted rate, both RA-tail helpers cleared) is the priority order.

Follow-up, deliberately NOT bundled here: consuming pulseengine/wit-bindgen's
`cabi-realloc-extern` so `cabi_realloc` delegates to gale's
`__cabi_arena_realloc` — ONE embedder-owned arena per fused image instead of
the per-component arena relay currently carries. That is a wit-bindgen
0.41 -> 0.58 jump AND a crate restructure (wit-bindgen-rt is folded into
wit-bindgen upstream of 0.41), i.e. a migration on the flight path, not a
dependency swap. Tracked separately.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HvusAXYbHLyv3uTzfBcMbG
@avrabe
avrabe enabled auto-merge (squash) August 5, 2026 06:20
@avrabe
avrabe merged commit 0cd285a into main Aug 5, 2026
11 checks passed
@avrabe
avrabe deleted the feat/nostd-components-target-unknown branch August 5, 2026 07:05
avrabe added a commit that referenced this pull request Aug 5, 2026
…P06 (#331)

* verify(oci): record the v1.131 no-grow + annotations evidence; defer P06 to v1.132

Code-free. Records three follow-on defects found and fixed since v1.130, each
measured on the artifact rather than argued, against the requirement they
strengthen (SWREQ-FALCON-OCI-P01, already verified):

(v) NO-GROW (#327) — the v1.130 cabi_realloc fix satisfied the ABI with a
GROWING allocator, so the shipped component carried `memory.grow`: precisely
what makes `meld fuse --memory shared --address-rebase` reject a component
(gale#89, meld#299). The fix partly re-blocked the MCU lowering it exists to
serve. Replaced with a bounded static work-memory arena; memory.grow 1 -> 0.

(vi) ROOT CAUSE — TARGET (#329) — `target_env = "p2"` is the wasip2 RUST
TARGET, which links wasi-libc, whose cabi_realloc goes through malloc. A
component does not need that target to be a valid P2 component. no_std
components now build wasm32-unknown-unknown.

(vii) LISTING METADATA (#328) — wasm.directory renders standard OCI MANIFEST
ANNOTATIONS, not the embedded package-metadata. Our manifests carried none, so
falcon-mixer:1.130.0 listed as "No description available" despite complete crate
metadata. Also corrects an explicit claim in docs/OCI-DISTRIBUTION.md.

Scope move, explicit: SWREQ-FALCON-MATHF32-P06 (Cody-Waite argument reduction)
v1.131 -> v1.132. It is the hardest of the four proofs and is not ready; v1.131
is a fix release whose job is publishing the no-grow components and non-bare
listings. Deferring is a decision, not a silent slip.

rivet validate: PASS.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HvusAXYbHLyv3uTzfBcMbG

* chore: re-trigger CI to pick up the Verify-Filter scope

The gate reads `github.event.pull_request.body` from the EVENT PAYLOAD, not a
live fetch, so editing the PR body does not change what a re-run sees — only a
new pull_request event does. Empty commit to emit one.

Scoping this PR with `Verify-Filter: (has-tag "oci")`: the unscoped ~370-step
sweep timed out at 90 minutes TWICE on this two-file artifact change (263 PASS /
0 FAIL both times — out of clock, not out of correctness).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HvusAXYbHLyv3uTzfBcMbG

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
avrabe added a commit that referenced this pull request Aug 6, 2026
…ut components (#332)

Regression from #329. That PR switched no_std components to build
wasm32-unknown-unknown, but the flight-component job's toolchain only installs
wasm32-wasip2, so the release failed at:

    building rate (wasm32-unknown-unknown)... ERROR: no .wasm found

I verified #329 locally, where I had run `rustup target add
wasm32-unknown-unknown` — and did not check the environment that actually
matters. Same class as the wasip1-vs-wasip2 mistake: right property, wrong
environment.

Add both targets to the job.

WHAT THE GUARD DID AND DID NOT CATCH — the fail-loud from #323 worked: the build
aborted instead of falling through to a stale artifact, and the ghcr publish was
SKIPPED rather than shipping something wrong. Nothing bad was published; ghcr
still serves 1.129.0/1.130.0 only.

What it could not prevent: `create-release` runs BEFORE `flight-component`, so
the v1.131.0 GitHub release was already published (12 assets: binaries, SBOM,
sums) and is now missing its wasm components. It is incomplete, not incorrect —
consumers pulling components still resolve to 1.130.0. v1.131.0's notes will be
marked superseded and the complete release cut as v1.131.1 rather than moving a
published tag.


Claude-Session: https://claude.ai/code/session_01HvusAXYbHLyv3uTzfBcMbG

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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