Skip to content

feat(cli): add bounded Python Extism adapter - #266

Merged
DamianReeves merged 6 commits into
mainfrom
DamianReeves/propose-extism-python
Oct 28, 2026
Merged

DamianReeves merged 6 commits into
mainfrom
DamianReeves/propose-extism-python

Conversation

@DamianReeves

@DamianReeves DamianReeves commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Add an explicit extism-wasm binding for the Python extension's legacy MEP 0.1 describe, compile and generate operations. Compile and generate require IR 3 or IR 4 and plain JSON. A multi-module request requires frontend.multiDocument=true; Python 0.4.1 is refused for that use without a digest exception.

The adapter reuses the shared Rust container and session checks with the bounded policy landed in morphir-rust#315 and morphir#1108. Pins cover the host, Node runtime, helper closure, descriptor and WASM. The helper runs immutable copies with denied guest network/environment/preopens, bounded resources, cancellation and observed process cleanup before transactional output publication.

Review the design, behavior contract and CLI guide. All 17 OpenSpec tasks are complete. Acceptance uses the published Python 0.4.2 bundle and independently installed PyPI packages morphir==0.1.0, morphir-python==0.1.0 and morphir-python-native==0.1.1, whose compiler reports 0.4.2. Both verified review findings are fixed in 4951183d34fddd7c8f04e0d3b3622fa1a5367c1e: late cancellation prevents the final publication rename with exit 130, and qualification creates its missing receipt directory. All 53 native CLI units and seven native/JS Extism checks pass. Full published-bundle acceptance also passes with the receipt directory absent and inputs held elsewhere. The full published-bundle receipt passes on final candidate 4951183d34fddd7c8f04e0d3b3622fa1a5367c1e using the repository-pinned runner. Pinned help/syntax/refusal and receipt-validator tests pass. Aggregate mise run check passes; CI is running on the final head. Full receipt evidence is retained in bead morphir-ukvn.5.98.4.

Validation on macOS arm64:

  • Published Python 0.4.2 bundle and PyPI compiler API: source native/JS, relocated native and unpacked npm; both IR versions; independent API comparison, generated-code execution, exact large integer and recompile checks.
  • Ten adapter real/fault tests and eight canonical shared policy tests using this adapter's locked Extism 1.30 engine; helper pin/limits/cancellation/cleanup tests; native and JS command tests.
  • Existing native/portable acceptance and 52 CLI unit tests; all-target MoonBit check; focused TypeScript check; repository lint, formatting and validation; strict OpenSpec and wide/narrow HTML review. The full Wasm and Wasm-GC CLI suites include the existing no-pin refusal and the explicit Extism unsupported-target result.

Only macOS arm64 receives candidate evidence here. Linux GNU and macOS x86_64 remain unqualified; Windows, musl, browser and MoonBit wasm/wasm-gc execution remain unsupported. No CI workflow or scarce-runner job is added.

Tracking: morphir-ukvn.5.98, related Python documentation intent morphir-ukvn.9 / add-documentation-site. Corrected Python release: morphir-python#50.

Tested-on: macOS 26.6.2 arm64; mise run test:cli-native-prerequisites, mise run test:cli-extism-python with published bundle/API, npm test --prefix apps/morphir -- wasm, npm test --prefix apps/morphir -- wasm-gc, mise run lint, mise run validate

Use an explicit verified bundle pin and the shared restricted host for
legacy MEP0.1 IR3/4 operations. Require advertised multi-document support;
Python0.4.1 receives no digest exception.

Tested-on: macOS 26.6.2 arm64; mise run test:cli-native-prerequisites, mise run test:cli-extism-python with local corrected candidate, mise run lint, mise run validate
Keep the existing unavailable-runtime error when no binding is selected.
Explicit Extism pins retain their structured unsupported-target result.

Record published Python0.4.2 qualification and the matching PyPI API pair.

Tested-on: macOS 26.6.2 arm64; npm test --prefix apps/morphir -- wasm, npm test --prefix apps/morphir -- wasm-gc, mise run test:cli-extism-python, mise run lint, mise run validate
@DamianReeves
DamianReeves marked this pull request as ready for review October 28, 2026 05:58
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T06:01:30.042720Z 9a7c980 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9a7c98080b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/morphir/extism.mbt Resolved
Check the cancellation file through input preparation and the final
publication rename, preserving exit130 for late cancellation. Create the
qualification receipt directory when bundle inputs live elsewhere.

Tested-on: macOS 26.6.2 arm64; 53 native CLI units, 7 native/JS Extism checks, full published-bundle qualification with the receipt directory absent, mise run lint, mise run validate
Use import syntax accepted by MoonBit 0.10.16.

Tested-on: macOS 26.6.2 arm64; pinned script unit tests, JSON help, syntax and old-bundle refusal; mise run lint, mise run lint:moonbit, mise run validate
@DamianReeves
DamianReeves added this pull request to the merge queue Oct 28, 2026
Merged via the queue into main with commit 556674e Oct 28, 2026
52 checks passed
@DamianReeves
DamianReeves deleted the DamianReeves/propose-extism-python branch October 29, 2026 06:10
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