Skip to content

feat(frontend): parsed .twasm emits the typedwasm.ownership carrier + ADR-0006 (Rust front-end canonical)#197

Merged
hyperpolymath merged 1 commit into
mainfrom
feat/127-rust-frontend
Jul 6, 2026
Merged

feat(frontend): parsed .twasm emits the typedwasm.ownership carrier + ADR-0006 (Rust front-end canonical)#197
hyperpolymath merged 1 commit into
mainfrom
feat/127-rust-frontend

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

First construction increment on the independence path (owner-ratified 2026-07-07).

The defect this closes

The parsed path emitted no ownership carrier at all: Parser.ownership was initialised empty and never pushed to, so verify_from_module passed vacuously on every parsed .twasm source — the 6/6 example round-trip was weaker than it looked. L7/L10 discipline declared in source (own, &mut, &) simply vanished before the wire.

Changes

  • Parser records ownership: parse_param_type returns the kind a qualifier denotes (own→Linear, &mut→ExclBorrow, &→SharedBorrow; bare region<T>/scalars stay Unrestricted); parse_function records a Module::ownership entry for any disciplined signature.
  • Ret kinds reach the wire: Module::ownership tuples gain a ret_kind slot (the wire format always had one; emit() hardcoded Unrestricted) — spawn_particle -> own region<Particle> now lands as a Linear return.
  • tests/example03.rs: placeholder → 3 real tests. Parser kinds asserted for every example-03 function; emitted wasm carries the decodable carrier and verifies; a double-free mutant of despawn_particle is rejected (the carrier has teeth).
  • ADR-0006: the in-tree Rust parser is the canonical .twasm front-end; supersedes ADR-0004 §2's "no Rust parser" pin; the AffineScript front-end (src/parser/*.affine) is demoted to reference implementation; the JSON-IR seam is repurposed as the external-producer seam. ADR-0004 §1/§3 stand.
  • Stale "Phase 1 / D1: codegen coverage — all 10 levels across all 6 .twasm examples #127 / no in-process parser" comments and the README coverage matrix refreshed to match reality.

Verification

cargo test --workspace: 142 tests, 0 failures — including the six-example parse→emit→verify corpus now carrying real (non-vacuous) ownership sections.

🤖 Generated with Claude Code

…p carrier + ADR-0006 (Rust front-end canonical)

The parsed path emitted NO ownership carrier: Parser.ownership was
initialised empty and never pushed, so L7/L10 verified vacuously on
every parsed .twasm source (the 6/6 corpus was weaker than it looked).

- parse_param_type now returns the ownership kind a qualifier denotes
  (own -> Linear, &mut -> ExclBorrow, & -> SharedBorrow; bare region<T>
  and scalars stay Unrestricted) and parse_function records a
  Module::ownership entry for any function whose signature asks for
  discipline.
- Module::ownership tuples gain a ret_kind slot (the wire format always
  had one; emit() hardcoded Unrestricted) so 'own' returns like
  spawn_particle's land on the wire.
- tests/example03.rs: placeholder replaced with 3 real tests — parser
  records the expected kinds for every example-03 function, the emitted
  wasm carries the decodable carrier and verifies, and a double-free
  mutant of despawn_particle is REJECTED (the carrier has teeth).
- ADR-0006: the Rust front-end is the canonical .twasm parser (owner
  direction 2026-07-07 — independence as a compile target); supersedes
  ADR-0004 section-2's 'no Rust parser' pin; AffineScript front-end
  demoted to reference; JSON-IR seam repurposed as the external-producer
  seam.
- Stale '#127 / no in-process parser' comments + README matrix refreshed.

Workspace: 142 tests, 0 failures.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@hyperpolymath
hyperpolymath enabled auto-merge (squash) July 6, 2026 23:21
@hyperpolymath
hyperpolymath merged commit 229a4d8 into main Jul 6, 2026
14 checks passed
@hyperpolymath
hyperpolymath deleted the feat/127-rust-frontend branch July 6, 2026 23:21
@sonarqubecloud

sonarqubecloud Bot commented Jul 6, 2026

Copy link
Copy Markdown

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