Skip to content

Commit d9bda09

Browse files
rename: pick up typedwasm.ownership section name from typed-wasm#65 (#137)
## Summary - Producer-side update for the wasm custom-section rename `affinescript.ownership` → `typedwasm.ownership`. - Bumps `typed-wasm-verify` rev pin to typed-wasm#65 (the source-of-truth PR). - Updates 5 in-source doc-comments that referenced the old name. The section name itself flows in via `typed_wasm_verify::OWNERSHIP_SECTION_NAME` — no string-literal hardcoding in ephapax — so the rev bump is what flips the actual emitted bytes. ## ⚠️ Re-bump obligation The rev pin currently points at typed-wasm#65's branch HEAD (`a1935c16`). **RE-BUMP to the post-merge SHA on `origin/main` before this PR merges** — otherwise the dangling-ref risk grows if typed-wasm's branch is auto-deleted after merge. ## Sibling PRs (coordinated hard-flip) - **typed-wasm#65** (must merge first): the `OWNERSHIP_SECTION_NAME` constant + verifier crate. - **affinescript** PR (sibling producer): emitters, parsers, JS loader, TEA bridges, CLI strings, docs. - **ephapax** (this PR): rev pin + 5 comment sites. ## What changed - `Cargo.toml` — bump `typed-wasm-verify` rev + inline note about re-bump. - `Cargo.lock` — `indexmap` 2.13.0 → 2.14.0 (required by `wasmparser` 0.250.0 that the bumped `typed-wasm-verify` pulls in). - `src/ephapax-wasm/src/lib.rs` — 4 doc-comment references. - `src/ephapax-cli/src/main.rs` — 1 doc-comment reference. ## Test plan - [x] `cargo test -p ephapax-wasm` → **79/79 passing** against the new `typed-wasm-verify` rev — proves the integration end-to-end with the renamed constant. - [x] `rg 'affinescript\.ownership'` (excl `CHANGELOG.md`) → 0 hits. ## Why now Estate disentangling: AffineScript and Ephapax must be independent languages. Ephapax was previously embedding the AffineScript brand in every wasm module it emitted (via the section name pulled from `typed-wasm-verify`). Now both producers consume a producer-neutral name from a shared crate. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 3d2e8bd commit d9bda09

9 files changed

Lines changed: 377 additions & 34 deletions

File tree

.github/workflows/rust-ci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,40 @@ permissions:
1515
jobs:
1616
rust-ci:
1717
uses: hyperpolymath/standards/.github/workflows/rust-ci-reusable.yml@4fdf4314b4ab54269adbaff10e30e483b5e86845
18+
19+
no-default-features:
20+
name: Cargo build + test (ephapax-cli, --no-default-features)
21+
runs-on: ubuntu-latest
22+
if: hashFiles('Cargo.toml') != ''
23+
24+
# Proves ephapax can be built and tested with zero git dep on the
25+
# sibling `hyperpolymath/typed-wasm` repo. Enforces the estate
26+
# architectural rule that typed-wasm must be removable from either
27+
# language with no impact. See `src/ephapax-wasm/src/ownership.rs`
28+
# for the in-tree codec that makes this possible.
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
32+
33+
- name: Install Rust toolchain
34+
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # stable
35+
36+
- name: Cache cargo registry and build
37+
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2
38+
with:
39+
key: no-default-features
40+
41+
- name: Cargo build -p ephapax-cli --no-default-features
42+
run: cargo build -p ephapax-cli --no-default-features
43+
44+
- name: Cargo test -p ephapax-cli --no-default-features
45+
run: cargo test -p ephapax-cli --no-default-features
46+
47+
- name: Write summary
48+
if: always()
49+
run: |
50+
echo "## --no-default-features build" >> "$GITHUB_STEP_SUMMARY"
51+
echo "" >> "$GITHUB_STEP_SUMMARY"
52+
echo "Proves the typed-wasm-verify feature is genuinely optional:" >> "$GITHUB_STEP_SUMMARY"
53+
echo "ephapax-cli builds + tests with zero git dep on the" >> "$GITHUB_STEP_SUMMARY"
54+
echo "hyperpolymath/typed-wasm repo." >> "$GITHUB_STEP_SUMMARY"

Cargo.lock

Lines changed: 32 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@ ephapax-lsp = { path = "src/ephapax-lsp" }
5151
ephapax-package = { path = "src/ephapax-package" }
5252
ephapax-vram-cache = { path = "src/ephapax-vram-cache" }
5353

54-
# Sibling-repo crates
55-
typed-wasm-verify = { git = "https://github.com/hyperpolymath/typed-wasm", rev = "67006edddef34e86be2afd97f23d0dfb1191b228" }
54+
# Sibling-repo crates.
55+
# NOTE: rev pin currently points at typed-wasm#65 branch HEAD for the
56+
# `typedwasm.ownership` section rename. RE-BUMP to the post-merge SHA
57+
# on `origin/main` before this PR merges.
58+
typed-wasm-verify = { git = "https://github.com/hyperpolymath/typed-wasm", rev = "a1935c16176567e0470de2feedf9c37a87dc0158" }
5659

5760
# External dependencies
5861
serde = { version = "1.0", features = ["derive"] }

src/ephapax-cli/Cargo.toml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,28 @@ ephapax-wasm.workspace = true
2626
ephapax-interp.workspace = true
2727
ephapax-repl.workspace = true
2828
ephapax-package.workspace = true
29-
typed-wasm-verify.workspace = true
29+
# `typed-wasm-verify` is optional: it powers `ephapax compile
30+
# --verify-ownership`, which is a post-codegen L7+L10 verifier. With
31+
# the feature OFF the CLI builds + runs without any reference to the
32+
# typed-wasm repo; emitted wasm still carries the `typedwasm.ownership`
33+
# section (codec lives in ephapax-wasm/src/ownership.rs), but the
34+
# `--verify-ownership` flag becomes a no-op (warns and continues).
35+
typed-wasm-verify = { workspace = true, optional = true }
3036
smol_str.workspace = true
3137
clap.workspace = true
3238
colored.workspace = true
3339
ariadne.workspace = true
3440
serde_json.workspace = true
3541

42+
[features]
43+
default = ["typed-wasm-verify"]
44+
# Enabling this feature pulls in `typed-wasm-verify` (a git dep on
45+
# hyperpolymath/typed-wasm) and activates the post-codegen verifier
46+
# behind `ephapax compile --verify-ownership`. Disabling it removes
47+
# all references to typed-wasm and makes ephapax fully buildable
48+
# without any sibling-repo network access.
49+
"typed-wasm-verify" = ["dep:typed-wasm-verify"]
50+
3651
[dev-dependencies]
3752
wasmtime.workspace = true
3853
proptest = { workspace = true }

src/ephapax-cli/src/main.rs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ enum Commands {
104104
mode: String,
105105

106106
/// Run the typed-wasm L7+L10 verifier on the emitted module.
107-
/// Reads the `affinescript.ownership` custom section and
107+
/// Reads the `typedwasm.ownership` custom section and
108108
/// reports any aliasing / linearity violations. Non-zero exit
109109
/// if any are found.
110110
#[arg(long)]
@@ -567,9 +567,23 @@ fn finish_compile(
567567

568568
// Run the typed-wasm L7+L10 verifier on the emitted module if
569569
// requested. Fails the build with a non-zero exit if any
570-
// ownership violation is found.
570+
// ownership violation is found. Gated by the `typed-wasm-verify`
571+
// feature: when off, --verify-ownership warns and continues.
571572
if verify_ownership {
572-
report_ownership_verification(&wasm_bytes, verbose)?;
573+
#[cfg(feature = "typed-wasm-verify")]
574+
{
575+
report_ownership_verification(&wasm_bytes, verbose)?;
576+
}
577+
#[cfg(not(feature = "typed-wasm-verify"))]
578+
{
579+
eprintln!(
580+
"{} --verify-ownership requested but this build was \
581+
compiled without the `typed-wasm-verify` feature; \
582+
skipping verification (emitted wasm still carries the \
583+
typedwasm.ownership section).",
584+
"warning:".yellow().bold()
585+
);
586+
}
573587
}
574588

575589
// Write output
@@ -611,6 +625,11 @@ fn finish_compile(
611625
/// has no ownership section, which both verifiers treat as fully
612626
/// unconstrained). Returns `Err` with a user-facing message if any
613627
/// violation is found — the caller surfaces this as a non-zero exit.
628+
///
629+
/// Gated by `feature = "typed-wasm-verify"`. With the feature off, the
630+
/// call site at `compile_file` skips this function entirely and emits
631+
/// a stderr warning instead.
632+
#[cfg(feature = "typed-wasm-verify")]
614633
fn report_ownership_verification(wasm_bytes: &[u8], verbose: bool) -> Result<(), String> {
615634
use typed_wasm_verify::{verify_from_module, VerifyError};
616635

src/ephapax-cli/tests/cli_verify_ownership.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,21 @@
88
// in `typed-wasm-verify`; this test exists to prove the CLI plumbing
99
// works — flag parsing → post-compile verification call → exit code
1010
// → user-facing output.
11+
//
12+
// The two positive-assertion tests are gated by the
13+
// `typed-wasm-verify` feature: with the feature OFF, the CLI prints a
14+
// warning and skips verification, so the "verification: clean" line
15+
// the tests look for is absent (by design). The third test —
16+
// `compile_without_verify_flag_does_not_run_verifier` — works
17+
// regardless because it asserts an *absence* of verifier output.
1118

1219
use std::process::Command;
1320

1421
fn ephapax_bin() -> String {
1522
env!("CARGO_BIN_EXE_ephapax").to_string()
1623
}
1724

25+
#[cfg(feature = "typed-wasm-verify")]
1826
#[test]
1927
fn verify_ownership_clean_module() {
2028
let src = tempfile::NamedTempFile::with_suffix(".eph").expect("tempfile");
@@ -48,6 +56,7 @@ fn verify_ownership_clean_module() {
4856
);
4957
}
5058

59+
#[cfg(feature = "typed-wasm-verify")]
5160
#[test]
5261
fn verify_ownership_linear_program() {
5362
// A program that takes a linear String param and consumes it

src/ephapax-wasm/Cargo.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,18 @@ categories.workspace = true
1717
ephapax-syntax = { workspace = true }
1818
ephapax-ir = { workspace = true }
1919
smol_str = { workspace = true }
20-
typed-wasm-verify = { workspace = true }
2120
wasm-encoder = { workspace = true }
2221
gimli = { version = "0.31", features = ["write"] }
2322
object = "0.36"
2423
serde = { version = "1", features = ["derive"] }
2524
serde_json = "1"
2625

26+
# NOTE: this crate intentionally does NOT depend on `typed-wasm-verify`.
27+
# Ephapax owns its own copy of the `typedwasm.ownership` section codec
28+
# in `src/ownership.rs`. Ownership annotations are ephapax's own
29+
# discipline (linear types); `typed-wasm-verify` is an optional
30+
# post-codegen verifier consumed only by `ephapax-cli` behind a
31+
# feature flag. See `src/ownership.rs` header for the full rationale.
32+
2733
[dev-dependencies]
2834
wasmparser = "0.221"

0 commit comments

Comments
 (0)