Skip to content

MILAB-6145: !!!EXPERIMENTAL DON'T MERGE!!! import :pframes-rs SDK lib#29

Draft
blackcat wants to merge 10 commits into
mainfrom
MILAB-6145-webassembly-tengo
Draft

MILAB-6145: !!!EXPERIMENTAL DON'T MERGE!!! import :pframes-rs SDK lib#29
blackcat wants to merge 10 commits into
mainfrom
MILAB-6145-webassembly-tengo

Conversation

@blackcat

@blackcat blackcat commented May 11, 2026

Copy link
Copy Markdown

Summary

Demonstrates how a block consumes the new @platforma-sdk/workflow-tengo:pframes-rs SDK lib end-to-end.

  1. Bundling. Importing :pframes-rs from the workflow pulls the upstream @milaboratories/pframes-rs-wasip2 wasm bytes into the compiled main.plj.gz via the SDK lib's build-time tag.
  2. Call site. wf.body invokes pframesRs.importWasm() to materialize the wasm component handle. Returns undefined today (runtime wiring is on plan/tengo-wasm-call and is a separate milestone); once the wasm-call runtime ships, only the SDK wrapper changes — this block stays as-is. The handle will expose .frame / .table / .axes namespaces mapping onto the milaboratories:pframes/spec WIT exports.

Bundling impact

Template Imports :pframes-rs? Pack size Wasm in template.wasm?
main.plj.gz yes 1.18 MB @milaboratories/pframes-rs-wasip2:main v1.1.34 (1,725,128 bytes)
rarefaction-calculation.plj.gz no 73 KB

Blockers

  • CI will fail on this branch until milaboratory/platforma#1615 is merged and the new @platforma-sdk/workflow-tengo is published. That PR ships the :pframes-rs lib this branch imports.
  • Once published, bump the catalog version in pnpm-workspace.yaml so :pframes-rs resolves.

Once the wasm-call runtime SDK lands, this block will be the canonical "real wasm in a real block" smoke test.

Test plan

  • Local end-to-end build using pnpm.overrides against locally-packed SDK (overrides removed before commit). Wasm bytes confirmed embedded in main.plj.gz; sibling template confirmed wasm-free.
  • Updated SDK wrapper has importWasm() runtime-safe — if false { assets.importWasm(...) } keeps the literal visible to tengo-builder's regex while returning undefined at render time, so the call site doesn't crash today.
  • CI green (after platforma SDK publish + catalog bump).

Refs

Opts the block into the WASM bundling pipeline by importing the SDK's
new :pframes-rs lib. The upstream @milaboratories/pframes-rs-wasip2
wasm bytes flow transitively into main.plj.gz at compile time.

Depends on @platforma-sdk/workflow-tengo publishing the :pframes-rs
lib (milaboratory/platforma#1615). CI will be red on this branch
until that SDK release ships.

Runtime use of the wasm component is a follow-up — this PR only opts
in to the bundling.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request imports the @platforma-sdk/workflow-tengo:pframes-rs library into the workflow's main template and includes a corresponding changeset. These changes integrate WASM bytes into the build pipeline to enable end-to-end testing of the bundling process. I have no feedback to provide as there were no review comments.

Demonstrates how a block consumes the SDK's :pframes-rs wrapper.
Returns undefined today; once the wasm runtime SDK ships
(plan/tengo-wasm-call), only the wrapper internals change — this
block keeps the same call site.

The handle will eventually expose `.frame`, `.table`, `.axes`
namespaces mapping onto the wasip2 WIT exports (see
core/pframes-rs/packages/wasip2/wit/world.wit).
Replace the placeholder pframesRs.importWasm() with a real WIT call —
pframesRs.frame.buildQuery({ version: "v1", column: "abundance" }) —
matching the pattern from plan/tengo-wasm-call.

Today the SDK wrapper returns "runtime not yet wired" because the wasm
call host builtin (plapi.loadWasm) hasn't shipped yet; the block logs
and continues so rendering still completes. Once that runtime lands,
only the SDK wrapper changes and the call below starts returning a
real SpecQueryJoinEntry — this block stays as-is.
@blackcat blackcat changed the title MILAB-6145: import :pframes-rs SDK lib MILAB-6145: !!!EXPERIMENTAL DON'T MERGE!!! import :pframes-rs SDK lib May 14, 2026
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.

2 participants