Skip to content

C8a: decompose wasm.py into wasm/ package#120

Merged
aallan merged 1 commit into
mainfrom
fix/c8a-decompose-wasm
Feb 27, 2026
Merged

C8a: decompose wasm.py into wasm/ package#120
aallan merged 1 commit into
mainfrom
fix/c8a-decompose-wasm

Conversation

@aallan

@aallan aallan commented Feb 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Decomposes the 2,344-line wasm.py monolith into a vera/wasm/ package with 7 submodules
  • Uses the same mixin-based pattern as the checker/ package (Decompose checker.py into checker/ submodules #99, v0.0.40)
  • 5 mixin classes (InferenceMixin, OperatorsMixin, CallsMixin, ClosuresMixin, DataMixin) composed into WasmContext via multiple inheritance
  • Shared types and helpers in helpers.py to avoid circular imports
  • Public API unchanged: 4 symbols re-exported from __init__.py
  • No test modifications -- all 951 tests pass, mypy clean, all 14 examples pass
  • Largest file: 527 lines (down from 2,344)

Closes #100

Test plan

  • All 951 tests pass (pytest tests/ -q)
  • mypy clean (mypy vera/)
  • All 14 examples pass (python scripts/check_examples.py)
  • Spec code blocks parse (python scripts/check_spec_examples.py)
  • README code blocks parse (python scripts/check_readme_examples.py)
  • Version sync verified (python scripts/check_version_sync.py)
  • Pre-commit hooks pass

🤖 Generated with Claude Code

Split the 2,344-line wasm.py monolith into a vera/wasm/ package with
7 submodules using the same mixin-based pattern as the checker/ package.

Package layout:
  __init__.py    (6 lines)   — re-exports 4 public API symbols
  helpers.py   (211 lines)   — WasmSlotEnv, StringPool, module-level helpers
  context.py   (369 lines)   — composed WasmContext class + dispatcher
  inference.py (527 lines)   — InferenceMixin: type inference + utilities
  operators.py (430 lines)   — OperatorsMixin: binary/unary ops, control flow
  calls.py     (223 lines)   — CallsMixin: function calls, effect handlers
  closures.py  (248 lines)   — ClosuresMixin: closures, free-var analysis
  data.py      (460 lines)   — DataMixin: constructors, match, arrays

No test changes. All 951 tests pass, mypy clean, all 14 examples pass.

Co-Authored-By: Claude <noreply@anthropic.invalid>
@aallan aallan merged commit b6634ee into main Feb 27, 2026
10 checks passed
@aallan aallan deleted the fix/c8a-decompose-wasm branch February 27, 2026 22:23
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.

Decompose wasm.py into wasm/ submodules

1 participant