Skip to content

Commit a01edf3

Browse files
hyperpolymathclaude
andcommitted
chore(layout): unblock full ipkg build by gating Layout.* + dir rename
Three pre-existing infrastructure bugs diagnosed and addressed: 1. Directory case-mismatch: `layout/` renamed to `Layout/` so the filesystem path matches the `Layout.*` module names declared inside each file. On case-sensitive Linux the original `layout/` could not be resolved for `import Layout.Types`. 2. Lowercase import typo: `TypedWasm/ABI/Layout.idr` had `import layout.Types` (lowercase) — corrected to `import Layout.Types`. 3. Layout.Types parser + Refl-reduction issues: investigated `varInjective` parser error and the cascade of issues behind it (mutual recursion not declared between `WasmHeapType`/`WasmValType`, missing `public export` visibility, missing `Decidable.Equality` / `Data.List` imports, nested-`with` pattern-unification failures in the `DecEq` instance, Refl-impossible proofs that require layout values to reduce at unification time but do not under this Idris2 0.8 build). These are non-trivial to fix and are documented as future work in PROOF-NEEDS.md. Until #3 is resolved, the four `Layout.*` modules are commented out of `typed-wasm.ipkg` and the `import TypedWasm.ABI.Layout` line in `TypedWasm.ABI.Proofs` is gated. This unblocks the full ipkg build for the typed-wasm core (TypedWasm.ABI.* — the primary purpose of this repo). The aggregate-library Layout contracts remain in the tree for restoration once Layout.Types is fixed per the remediation plan in PROOF-NEEDS.md. Verified: `idris2 --build typed-wasm.ipkg` completes with exit 0 (silent success). The previous behaviour was `Module Layout.Types not found` failing the build at module 11/16. Note: ipkg build requires `idris2 --build` (not `--check`) to parse the package file properly — `--check` treats the file as Idris2 source. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 3097b50 commit a01edf3

8 files changed

Lines changed: 57 additions & 6 deletions

File tree

PROOF-NEEDS.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,49 @@ After each session: run `idris2 --check` on every file in
483483
adjacent code (no new unsafe code should land), update this file's
484484
inventory table, commit.
485485

486+
## Outstanding infrastructure work — Layout module fix (added 2026-04-18)
487+
488+
`Layout/Types.idr` was never compiling cleanly under this Idris2 0.8
489+
build. The directory rename `layout/``Layout/` (filesystem case
490+
matching the `Layout.*` module names) and the `import layout.Types`
491+
`import Layout.Types` typo fix in `TypedWasm/ABI/Layout.idr` were
492+
made on 2026-04-18, which surfaced the underlying issues:
493+
494+
1. **Mutual recursion not declared.** `WasmHeapType` references
495+
`WasmValType` (line 65) but `WasmValType` is declared later
496+
(line 73). Wrapping both in `mutual` is needed.
497+
2. **Visibility annotations missing.** `data WasmPrimitive` /
498+
`WasmHeapType` / `WasmValType` and the layout values
499+
(`stringLayout`, `optionLayout`, `resultLayout`, `enumLayout`,
500+
`recordLayout`) all lack `public export`, so downstream
501+
constructors are not visible and `Refl`-based proofs do not
502+
unify.
503+
3. **Imports missing.** `Decidable.Equality` is used (`DecEq`,
504+
`Yes`, `No`, `decEq`) but never imported; `Data.List` similarly.
505+
4. **Nested `with` block patterns** in the `DecEq WasmHeapType`
506+
instance (lines 178-234) trigger pattern-variable unification
507+
errors under this Idris2 build.
508+
5. **Refl-impossible patterns** (`stringOptionDistinct _ Refl
509+
impossible` etc.) need the layout values to reduce at unification
510+
time — even with `public export` the reduction does not happen
511+
under this build, so a different proof strategy is needed
512+
(probably explicit `case ... of` with constructor mismatch).
513+
514+
**Current gating (2026-04-18):** the four `Layout.*` modules are
515+
commented out of `typed-wasm.ipkg` and the `import TypedWasm.ABI.Layout`
516+
line in `TypedWasm/ABI/Proofs.idr` is gated. This unblocks the full
517+
ipkg build for the typed-wasm core (TypedWasm.ABI.* modules) — which
518+
is the primary purpose of typed-wasm. The aggregate-library Layout
519+
contracts remain in the tree for restoration once the issues above
520+
are addressed.
521+
522+
**Remediation plan:** add `public export` to every Layout type/value;
523+
add `import Decidable.Equality, Data.List`; rewrite the `DecEq
524+
WasmHeapType` and `DecEq WasmValType` instances without nested `with`
525+
(use case-of or explicit witness construction); replace the
526+
Refl-impossible patterns with `case ... of` + constructor analysis.
527+
Estimated effort: one focused session.
528+
486529
## Pre-existing notes (preserved from prior revision)
487530

488531
### Template ABI Cleanup (2026-03-29)
File renamed without changes.

src/abi/TypedWasm/ABI/Layout.idr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
module TypedWasm.ABI.Layout
1414

15-
import layout.Types
15+
import Layout.Types
1616
import Data.List
1717
import Data.List.Elem
1818

src/abi/TypedWasm/ABI/Proofs.idr

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ import TypedWasm.ABI.Linear
2727
import TypedWasm.ABI.MultiModule
2828
import TypedWasm.ABI.Tropical
2929
import TypedWasm.ABI.Epistemic
30-
import TypedWasm.ABI.Layout
30+
-- TEMP: Layout import gated pending Idris2 0.8 reduction fix in Layout/Types.idr.
31+
-- See typed-wasm.ipkg Layout block + PROOF-NEEDS.md Layout-fix entry.
32+
-- import TypedWasm.ABI.Layout
3133
import TypedWasm.ABI.ModuleIsolation
3234
import TypedWasm.ABI.SessionProtocol
3335
import TypedWasm.ABI.ResourceCapabilities

src/abi/typed-wasm.ipkg

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@ modules = TypedWasm.ABI.Region
2525
, TypedWasm.ABI.Epistemic
2626
, TypedWasm.ABI.Proofs
2727
-- Cross-language layout contracts (aggregate library role, ADR-004)
28-
, Layout.Types
29-
, Layout.ABI
30-
, Layout.Stdlib
31-
, Layout.AirborneSubmarineSquadron
28+
-- TEMP: Layout.* gated out of ipkg pending an Idris2 0.8 reduction
29+
-- workaround in `Layout/Types.idr` (DecEq nested-with patterns +
30+
-- Refl-impossible proofs against `public export` definitions that do
31+
-- not currently reduce at unification time). TypedWasm.ABI.Proofs
32+
-- has had its `import TypedWasm.ABI.Layout` commented to match. See
33+
-- PROOF-NEEDS.md (Layout-fix entry) for the remediation plan.
34+
--, Layout.Types
35+
--, Layout.ABI
36+
--, Layout.Stdlib
37+
--, Layout.AirborneSubmarineSquadron

0 commit comments

Comments
 (0)