Skip to content

Feat/ephapax toolchain closure#311

Closed
hyperpolymath wants to merge 11 commits into
mainfrom
feat/ephapax-toolchain-closure
Closed

Feat/ephapax toolchain closure#311
hyperpolymath wants to merge 11 commits into
mainfrom
feat/ephapax-toolchain-closure

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

Closes #

Type of change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (would change existing behaviour)
  • 🕳️ Soundness fix (fixes a checker/proof false-negative)
  • 📖 Documentation
  • 🧹 Refactor / tech debt (behaviour-preserving)
  • ⚡ Performance
  • 🔧 Build / CI / tooling

How has this been verified?

Checklist

  • My commits are signed (git commit -S).
  • I ran the project's own checks/tests locally and they pass.
  • New files carry the correct SPDX-License-Identifier (code/config MPL-2.0,
    prose CC-BY-SA-4.0); I did not relicense existing files.
  • Docs are updated, and no public claim now overstates what the code does.
  • I have not introduced a soundness hole (or I have flagged where I might have).

Notes for reviewers

hyperpolymath and others added 11 commits June 16, 2026 00:37
… TOML)

The estate attribution linter injects `// Owner:` lines, but `//` is not a valid TOML comment delimiter (confirmed: TOMLDecodeError at col 1) and breaks cargo manifest parsing on a fresh checkout of main. Convert to `#` — delimiter only; Owner string and SPDX headers unchanged. Same class of fix as the Coq `(* *)` header correction in #295.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A multi-arg user function is DEFINED with a flat wasm signature (one ValType per param), but saturated calls `f(a, b, c)` fell through to the curried closure path, which `Call`ed the flat function with too few arguments on the stack — producing structurally invalid modules. The `run(win2, ch2, model)` recursion in the `@tail_recursive` hypatia bridge.eph emitted `call $run` with 1 arg for a 3-param function ("expected i32 but nothing on stack", func 22 / offset 0x423).

Recognise a known user fn applied to its FULL arity and emit a flat direct `Call` with every arg pushed in order (the path multi-arg externs already take). Partial applications and first-class function values still take the curried closure path. Handle the nullary `f()` -> App(f, ()) placeholder for both user fns and externs.

bridge.eph now passes `wasm-tools validate`; 89 ephapax-wasm + 13 wasm_e2e + phase_j tests unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds a structural-validation gate around emitted wasm: (1) the wasm_e2e `compile()` helper now asserts `wasmparser::validate` so EVERY e2e program is checked, not only the subset run() instantiates; (2) a `just validate-wasm` recipe compiles the known-good top-level fixtures and runs `wasm-tools validate` on each (hypatia-port/ excluded by top-level glob until #43, now fixed).

Also fixes the linter-injected `// Owner:` lines in Justfile:2 and contractile.just:6 (Just comments are `#`; `//` made `just` fail to parse the whole file) and the stray un-echoed `// Owner:` in the tour recipe body. Delimiter-only; Owner text unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ephapax owns an in-tree mirror of the typedwasm.ownership codec and does not depend on typed-wasm-verify in the codegen crate; every existing test round-trips one codec against itself, so the two could silently drift. This test crosses the real seam: ephapax-built payloads are decoded by typed-wasm's parser and vice-versa (byte-level, exhaustive over kinds + param counts), asserts the section-name constants match, and extracts the section from a real ephapax-emitted module to decode with typed-wasm. Byte-based; no new deps. Gated on the typed-wasm-verify feature.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
finish_compile and compile_sexpr_file now run `wasmparser::validate` before writing the .wasm to disk, so `ephapax compile` can never emit a structurally invalid module (promotes wasmparser to a normal dep). Distinct from --verify-ownership (semantic L7/L10); this is the unconditional structural floor.

Folds the now-fixed bridge.eph into `just validate-wasm` and asserts full wasmparser::validate in the phase_j bridge test (was a documented NOTE exclusion). Adds a `wasm-validate` CI job running `just validate-wasm` (CARGO_INCREMENTAL=0 to dodge the known rustc-incremental ICE).

Full ephapax-cli suite green (16 test files); validate-wasm passes all 6 fixtures incl. bridge.eph.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Ground-truth: the four real open L1 admits (region_shrink, region_liveness [false as stated], step_pop, preservation_l1) all collapse to ONE calculus-design decision — strengthening T_Var_*/T_Loc_L1 with `In r (free_regions T) -> In r R`. Per CLAUDE.md's anti-pattern detector ("strengthened lemma signatures" = stop-and-escalate) and DO #4, this is an owner decision, not a patch. Records the options (A leaf-rule / B multiset / C defer), the false-statement counterexample, and the off-limits legacy theorem.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…r foundation)

New leaf crate ephapax-query: a hand-rolled salsa-style red/green engine that WRAPS (never reimplements) parse_module / type_check_module / compile_module. Revision-bumped inputs + per-query Memo{changed_at, verified_at} give demand-driven recompute-skip; PartialEq backdating means an edit that re-parses to an equal Module skips typecheck + codegen downstream.

Wired into the CLI run path (run_file drives parse+typecheck through a QueryDb) so the crate is not left unwired; the incremental payoff lands when a long-lived QueryDb is held by the LSP/REPL (documented integration point). General dependency-DAG tracking (multi-module imports), Arc-not-clone returns, and a vram-cache QueryStore backing are documented extension points, not built here.

4 engine tests (skip-on-no-edit, no-invalidate-on-identical-write, recompute-on-change, downstream-skip) + full 16-file ephapax-cli suite green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
New crate ephapax-meta exposing two reflective capabilities as thin wrappers over existing machinery (no second AST encoding / evaluator / codegen): Metainterpreter (ReflectiveInterp): quote=expr_to_sexpr / eval_quoted=decode_expr+Interpreter::eval / splice — 6*7 quoted-then-evaluated yields 42. Metacompiler (WasmStager): compile_stage=Codegen::compile_program+wasmparser::validate / run_stage=wasmtime — staged 6*7 compiles to a valid module and runs without trapping.

Substructural discipline: quoting copies syntax (cannot duplicate a linear value); reify_value hard-refuses is_linear values and closures. Makes ephapax_ir::{expr_to_sexpr, decode_expr} public (the canonical AST-as-data codec) so quoting reuses it rather than adding a second encoding.

Surface quote/eval/stage syntax is a documented follow-up (it would ripple new ExprKind variants through every crate); reading a typed return value out of a staged module is a documented next step. 6 ephapax-meta tests green; ephapax-ir + full workspace unaffected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…sor suite

The ten coprocessor classes (Audio/Crypto/Maths/Physics/GPU/Vector/Tensor/Quantum/IO/FPGA) already exist in Axiom.jl; this adds a THIN ephapax boundary that DISPATCHES to them with no kernels ported (boundary kept clean). stdlib/Coproc.eph: typed surface — Capability sum type, cap_tag wire map, linear CoprocBuf handle (upload -> dispatch* -> download|release). Type-checks under `ephapax check` — the first stdlib module authored in parseable v2 grammar. tools/coproc/ephapax_coproc.zig: the single shared C-ABI seam (eph_coproc_*) mirroring how Axiom links Zig; stub build with TODO(axiom) forwarder points; 2 zig tests pass.

Proven end-to-end: with `-L libephapax_coproc.so`, dispatch(_,_,20,22)=42; without it ephapax's [ffi:stub]->0 fallback fires. Plus tools/coproc/README.adoc and a lock-in test (coproc_surface.rs).

Documents the v2 grammar / codegen gaps found while building this (docs/v2-grammar-and-codegen-gaps-2026-06-16.adoc): no T! linear type annotations, construct_expr only valid in match-arm tails, the stdlib stranded in pre-v2 syntax, no I64 literal, and the wasm-FFI codegen invalid-module bug (next_import_idx=100) — now caught by the structural self-validation floor.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…e real fork

Implementing the owner-approved leaf-rule strengthening (path 3) to a coqc-verified intermediate DISPROVED it: region_shrink_preserves_typing_l1_gen_m is FALSE at type-erasing eliminators. Counterexample EDrop (EVar j), j:TString rr at R=[rr] types but does not survive shrinking rr (inner EVar j untypable). Root cause: a closure/eliminator depends on a region without exposing it in its RESULT type; the ~In r (free_regions T) Tofte-Talpin premise constrains only the result type, which eliminators erase. Sharpens the decision to (A') adopt effect typing / forbid bare-TFun lambdas [TFunEff live line] vs (B') context-region-freedom predicate vs (C') keep admits. formal/ reverted to clean green-with-1-axiom; no attempt code remains.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…build target + honest wiring status

Axiom.jl was the DESIGN MODEL (capability classes + linear buffers + thin FFI seam, full coverage), not a dependency. Remove all 'forward to / surface / import / co-own Axiom' framing from Coproc.eph, the Zig shim (TODO(axiom)->TODO(backend), drop Julia C-embedding), and the README; the seam dispatches to a native backend ephapax chooses. Code unchanged (it was always a generic FFI boundary); only the narrative was wrong.

Wire the one piece that is wireable now: `just build-coproc`/`test-coproc` build the seam. Document honestly (README + gaps G6) that the TYPED Coproc API is NOT yet consumable: `import Coproc; Coproc.upload(…)` neither parses (qualified Coproc.Tensor) nor resolves (import exposes no members) — the keystone gap that strands the entire stdlib. Seam is reachable today only via raw __ffi (the 42-vs-0 proof).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@hyperpolymath
hyperpolymath enabled auto-merge (rebase) June 23, 2026 16:43
@hyperpolymath
hyperpolymath disabled auto-merge June 24, 2026 08:23

Copy link
Copy Markdown
Owner Author

Closing as superseded by main — there is nothing left to merge, and merging would regress.

A tip-to-tip comparison against current main shows:

  • All feature work already landed. Every substantive file is byte-identical to main: ephapax-query, ephapax-meta, stdlib/Coproc.eph, the Zig FFI seam, ephapax-wasm, and the CLI. This branch forked from 3a5aced; main absorbed the same work and moved ~8 days ahead.
  • Merging would revert the licence normalisation (commit 83f72f2): this branch still carries MPL-2.0 on prose files where main now correctly has CC-BY-SA-4.0.
  • Merging would delete/regress newer L1 proof work — it removes 7 formal/ files present on main (Counterexample_RegionShrink.v, L1ChoreoExperiment.v, RegionEnvL1.v, plus the L1 refoundation / eliminator-fork / choreography / route-C docs) and rolls Semantics_L1.v back ~784 lines.

The branch correctly never patched Semantics.v (it only added the ESCALATION-4.8 doc, which is also already on main), so there's nothing to rescue here. Closing.


Generated by Claude Code

@hyperpolymath
hyperpolymath deleted the feat/ephapax-toolchain-closure branch June 24, 2026 10:47
hyperpolymath added a commit that referenced this pull request Jun 24, 2026
…ndoff (#319)

## Summary

Housekeeping pass to bring the living docs current with this session's
**non-proof** infrastructure work, and to version-control the
outstanding Hypatia triage. **No `.v` files touched; no proof-state
change.**

## Changes

- **`CHANGELOG.md`** — new `### Governance, CI & security-scan
infrastructure (2026-06-24)` entry under `[Unreleased]`: govdocs (#314),
`standards` pin remediation (#315, now `d135b05…` via #316), the Hypatia
gate getting unblocked and surfacing **37 pre-existing findings** (5
critical / 7 high / 25 medium), and the closure of stale PRs #310/#311.
- **`docs/governance/HYPATIA-HANDOFF.md`** (new) — a tracked record of
the **OPEN** Hypatia triage: how it surfaced, why the engine can't run
in the remote sandbox (Hex registry blocked by egress policy),
reproduction steps, disposition rules (incl. the `CLAUDE.md` fences),
and the drafted `standards` visibility patch. Honestly framed as **not
yet fixed**.
- **`.machine_readable/6a2/STATE.a2ml`** — bumped `updated:`; appended a
clearly-delimited `INFRA (…non-proof track)` clause to `last_action`.
The Phase-D proof narrative is left intact.
- **`docs/wikis/Home.md`** — linked the new governance docs
(`GOVERNANCE.adoc` / `MAINTAINERS.adoc` / `CODEOWNERS`).

## Deliberately NOT touched

`STATUS.adoc`, `ROADMAP.adoc`, `formal/PROOF-STATUS.a2ml`,
`formal/PRESERVATION-DESIGN.md`, `formal/PRESERVATION-HANDOFF.md`,
`CLAUDE.md`, `0-AI-MANIFEST.a2ml` — these are proof-cadence-owned /
fenced; adding CI/governance content would muddle the proof narrative,
and they carry no incorrect information without it. Happy to add infra
notes there too if you'd prefer.

## Honesty notes

- The 37 findings are **pre-existing repo debt**, surfaced (not caused)
by fixing the broken pin; they are **not fixed** here — triage is handed
off.
- The `standards` visibility patch is **drafted, not applied**.
- `#316/#317/#318` (further pin bump, licence pass, push-email workflow)
landed on `main` *after* my #315 and are **not** attributed to this
session — only referenced where factually relevant.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---
_Generated by [Claude
Code](https://claude.ai/code/session_019g8rX8vRZ2HemGKagi6a71)_

Co-authored-by: Claude <noreply@anthropic.com>
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