Skip to content

Commit c5db0c9

Browse files
hyperpolymathclaude
andcommitted
docs: record typed-wasm-verify Rust port (C1-C5) in repo-level docs
The Rust verifier crate at `crates/typed-wasm-verify/` landed across PRs #19 (C1) → #23 (C5) on 2026-05-15 but the repo-level documentation didn't catch up. This commit fixes that. Changes ------- * CHANGELOG.md `[Unreleased] → Added`: one entry summarising the crate, plus a sub-bullet per phase (C1-C5) with PR refs. * CHANGELOG.md `[Unreleased] → Changed`: note that the repo is now polyglot Idris2 + Zig + Rust (root Cargo workspace). * LEVEL-STATUS.md: new "Post-codegen verifier (Rust)" section after the Idris2 proof inventory, explaining the verifier's place in the three-layer story (spec proofs / source checker / post-codegen) and documenting coverage (L7 + L10 only for now). Lists current consumers (ephapax-wasm + ephapax-cli). * ROADMAP.adoc: v0.4 (ecosystem) gets a [x] bullet for the Rust crate; v1.0 gets two new entries — [x] for the post-codegen verifier itself (partial v1.0 deliverable, separate from `.twasm` parsing), [ ] for the cross-compat parity proof against affinescript's OCaml reference (deferred as "C5.1"). * 0-AI-MANIFEST.a2ml: new `verify_rust` entry in `[canonical_locations]` so AI agents reading the manifest can find the crate. No code changes — this is pure-docs cleanup. The crate itself, its tests, and consumer integrations are already on `main`. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 67006ed commit c5db0c9

4 files changed

Lines changed: 56 additions & 7 deletions

File tree

0-AI-MANIFEST.a2ml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@ id = "typed-wasm-root-manifest"
1515
level = 0
1616

1717
[canonical_locations]
18-
state = ".machine_readable/6a2/STATE.a2ml"
19-
meta = ".machine_readable/6a2/META.a2ml"
20-
ecosystem = ".machine_readable/6a2/ECOSYSTEM.a2ml"
21-
grammar = "spec/grammar.ebnf"
22-
abi_proofs = "src/abi/"
23-
zig_ffi = "ffi/zig/"
24-
examples = "examples/"
18+
state = ".machine_readable/6a2/STATE.a2ml"
19+
meta = ".machine_readable/6a2/META.a2ml"
20+
ecosystem = ".machine_readable/6a2/ECOSYSTEM.a2ml"
21+
grammar = "spec/grammar.ebnf"
22+
abi_proofs = "src/abi/"
23+
zig_ffi = "ffi/zig/"
24+
verify_rust = "crates/typed-wasm-verify/"
25+
examples = "examples/"
2526

2627
[echidna_invocation]
2728
# All ECHIDNA calls go through the echidna-llm-mcp BoJ cartridge. Never call ECHIDNA directly.

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
## [Unreleased]
1212

1313
### Added
14+
- **typed-wasm-verify** Rust crate (`crates/typed-wasm-verify/`) — post-codegen verifier for L7 (aliasing) + L10 (linearity) on emitted wasm modules. Rust port of `hyperpolymath/affinescript:lib/{tw_verify,tw_interface}.ml`. 50/50 tests pass (40 unit + 10 cross-compat integration). Replaces the ReScript verifier path which is on its way out.
15+
- C1 (#19) — Scaffold: crate skeleton, public types (`OwnershipKind`, `OwnershipError`, `CrossError`, `FuncInterface`, `VerifyError`), `OWNERSHIP_SECTION_NAME` constant, stubbed entry points.
16+
- C2 (#20) — `affinescript.ownership` custom-section codec (parse + encode), 11 unit tests covering wire-format round-trip and OCaml-parity leniency.
17+
- C3 (#21) — Per-path `(min, max)` use-range analysis with a control-flow frame stack over wasmparser's operator stream. `verify_function` + `verify_from_module` implement the intra-fn L7+L10 rules. 9 algorithmic + 9 end-to-end tests.
18+
- C4 (#22) — Cross-module boundary verifier (`extract_exports`, `verify_cross_module`). 3 + 8 tests. Reuses C3's frame stack via a `CallOf(import_idx)` counter.
19+
- C5 (#23) — Cross-compat integration suite (`tests/cross_compat.rs`), 10 fixtures modelling realistic affinescript-shaped modules. Each fixture documents the conceptual AffineScript source and the expected OCaml verdict — divergence on either side is a parity bug.
1420
- ECHIDNA prover oracle JS harness (tests/echidna/echidna-harness.mjs) — random .twasm generator, 4 property tests, optional ECHIDNA submission
1521
- arXiv-ready LaTeX paper (docs/arxiv/typed-wasm.tex) — ACM sigplan format, 851 lines
1622
- BibTeX bibliography (docs/arxiv/typed-wasm.bib) — 15 references
1723
- TypedQLiser plugin exists at typedqliser/src/plugins/wasm.rs (541 lines, 9 tests)
24+
25+
### Changed
26+
- Repo is now polyglot Idris2 + Zig + Rust (added a Cargo workspace at the root, `crates/typed-wasm-verify/` is its first member). ReScript files in `src/parser/*.res` remain in tree as the v1.1 surface parser, but the post-codegen verifier no longer depends on them.

LEVEL-STATUS.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,39 @@ toolchain remains future work.
101101
| Tropical.idr | 0 | 0 | 0 | In package (A1, 2026-04-18) |
102102
| Epistemic.idr | 0 | 0 | 0 | In package (A1, 2026-04-18) |
103103
| Echo.idr | 0 | 0 | 0 | In package (A0, 2026-04-18) |
104+
105+
## Post-codegen verifier (Rust)
106+
107+
The Idris2 proofs above establish that **the type discipline is sound**
108+
L1-L10 (and L13-L16) are mechanically verified at the spec level. They
109+
say nothing about whether a particular wasm module out of a particular
110+
codegen actually obeys the discipline.
111+
112+
`crates/typed-wasm-verify/` (added 2026-05-15) closes that loop on the
113+
**post-codegen** side. Given a wasm module plus an
114+
`affinescript.ownership` custom section, the crate runs a per-path
115+
`(min, max)` use-range analysis over every function body and reports
116+
L7 (aliasing) + L10 (linearity) violations. It's a second line of
117+
defence: the source-level checker enforces the rules during compilation;
118+
this crate re-checks them on the emitted IR to catch codegen bugs.
119+
120+
| Layer | What it proves | Where |
121+
|-------|----------------|-------|
122+
| Idris2 proofs | Type discipline is sound (spec-level) | `src/abi/TypedWasm/ABI/*.idr` |
123+
| Source checker | Source program respects discipline | `hyperpolymath/affinescript:lib/codegen.ml` (QTT pass), upcoming `.twasm` parser/checker |
124+
| **Post-codegen verifier** | **Emitted wasm respects discipline** | **`crates/typed-wasm-verify/` (Rust)** + `hyperpolymath/affinescript:lib/{tw_verify,tw_interface}.ml` (OCaml, reference impl) |
125+
126+
The Rust crate is a faithful port of the OCaml reference; the OCaml
127+
files remain the spec of record until the cross-compat suite at
128+
`crates/typed-wasm-verify/tests/cross_compat.rs` is supplemented with
129+
real affinescript-emitted fixtures (deferred work, "C5.1").
130+
131+
**Coverage:** L7 (ExclBorrow) + L10 (Linear) only.
132+
L1-L6, L13-L16 enforcement on emitted wasm is future work.
133+
134+
**Consumers** (live as of 2026-05-15):
135+
136+
- `hyperpolymath/ephapax:src/ephapax-wasm/` — emits the
137+
`affinescript.ownership` section on every compile
138+
- `hyperpolymath/ephapax:src/ephapax-cli/` — exposes the verifier via
139+
`ephapax compile --verify-ownership`

ROADMAP.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ Known audit constraints:
6262
* [x] TypedQLiser plugin (WASM as a "query target") — typedqliser/src/plugins/wasm.rs (541 lines)
6363
* [ ] VCL-total sibling integration (same levels, different domain)
6464
* [ ] GraalVM/Truffle target (multi-language shared state type safety)
65+
* [x] `typed-wasm-verify` Rust crate (`crates/typed-wasm-verify/`) — post-codegen L7+L10 verifier. Consumed by `hyperpolymath/ephapax` as of 2026-05-15 (`compile --verify-ownership`); `hyperpolymath/affinescript` migration from its in-tree OCaml verifier deferred to v1.0.
6566

6667
== v1.0.0 -- Stable Release
6768

@@ -71,6 +72,8 @@ Known audit constraints:
7172
* [ ] CI/CD with proof validation
7273
* [ ] De-template release/build/container surfaces
7374
* [ ] Real benchmark and aspect-test evidence
75+
* [x] Post-codegen verifier in Rust (`crates/typed-wasm-verify/`) — partial v1.0 deliverable, the verifier side of the pipeline. Parser/checker for `.twasm` source remains the open work.
76+
* [ ] Cross-compat parity proof against `hyperpolymath/affinescript:lib/{tw_verify,tw_interface}.ml` — real OCaml-emitted .wasm fixtures alongside the existing synthetic ones (deferred to "C5.1").
7477

7578
== Language Identity & Linguist Classification
7679

0 commit comments

Comments
 (0)