Skip to content

Cleave-surface audit: ABI/FFI/Ephapax/Groove drift + ranked-ownership cleave (forward plan) #82

Description

@hyperpolymath

Cleave-surface audit — ABI/FFI/Ephapax/Groove drift + forward plan

Tracking issue from the 2026-06-15 cleave-surface investigation. Full narrative + decisions in ~/developer/dev-notes/2026-06-15-gossamer-cleave-surface-session-handoff.adoc. Findings below were established by reading the tree and partly verified by running idris2 --typecheck / zig build; a deeper audit workflow was still finishing at session close (its consolidated brief to be appended on pickup).

Confirmed findings (severity-ranked)

  • CRITICAL — the Idris2 ABI describes a phantom template, not the real ABI. src/interface/abi/Foreign.idr declares ~10 generic placeholder %foreign symbols (gossamer_init, gossamer_process, gossamer_process_array, gossamer_get_string, gossamer_register_callback, gossamer_is_initialized …). Only 3 (last_error, version, build_info) exist among the 141 real export fn C symbols in src/interface/ffi/src/*.zig. A green idris2 --typecheck does not mean the ABI matches the FFI — %foreign linkage is not checked at typecheck time. The "13/13 modules green" claim is technically true and practically meaningless for the real surface.
  • HIGH — the Ephapax core is not actually linear. All 13 src/core/*.eph files contain zero let! bindings (the linear construct the whole value proposition rests on). They are thin __ffi(...) passthroughs returning bare I64. ephapax-cli is not installed in the dev env, so these .eph files have likely never been compiled. "Handle leaks become compile errors" is currently aspirational.
  • HIGH — third disagreeing surface (Ephapax↔Zig). src/core/Groove.eph calls gossamer_groove_discover/status/manifest/find_capability/send/recv/summary/disconnect_all; the Zig exports gossamer_groove_connect_typed/disconnect_typed/query_type/dock/undock. The .eph references symbols the native layer does not export.
  • HIGH — the one real teardown proof is unwired from disconnect. ResourceCleanup.idr proves LIFO residue→0, but gossamer_groove_disconnect_typed (main.zig:1878) is a flat wipe that never calls that descent. Per the Ranked-Ownership Cleave spec this violates RC-7/RC-8. First conformance task: wire disconnect to the proven ResourceCleanup descent.
  • MEDIUM — doc/reality drift. README/TOPOLOGY reference ffi/zig/ as the implementation home (only ffi/README.adoc exists; real Zig is src/interface/ffi/src/) and a top-level src/ABI.idr (absent). "173 integration tests" / version claims need an honest recount. Foreign.idr itself admits a "latent error masked by the never-built module."

Correct proof-location map (verified — corrects an earlier mis-statement)

  • Groove.idr:503 handshakeRank/transitionDecreases = the connect ranking function (flat Nat, a DAG).
  • GrooveTermination.idr = connect-handshake bounded-length (≤4), no measure — not teardown.
  • ResourceCleanup.idr = the teardown/residue→0 proof (flat-Nat structural recursion) — the host to upgrade.

The forward frame (the "cleave surface")

Re-attach spec + proofs + linearity to the true cleave (the 141 real Zig symbols), as B-layer membrane properties, not to the phantom template. Cleave-surface layering: A discovery · B1 admissibility · B2 live-governance + lifecycle/residue · C1 logical schema · C2 framing/transport. Single-source-of-truth + codegen decision is the key open architectural choice (see handoff).

Locked decision — rupture policy (owner, 2026-06-15)

Zero-residue-on-rupture: day-one ownership shape (a survivor of the rupture owns the wipe, never the dying party's cleanup) + phased coverage (process-death/conn-drop first → host-crash → power-loss → durable-secret). Constrains the Zig handle-ownership design: resource+secret lifetime keyed to handle liveness; nothing stashed outside OS-reclaimed resources; groove membrane carries liveness/heartbeat so a peer reaps its half on the other's death.

Next actions (first few)

  • Wire gossamer_groove_disconnect_typedResourceCleanup descent (closes the RC-7/RC-8 gap).
  • Decide single-source-of-truth for the 141-symbol cleave + codegen-or-hand-mirror (see handoff "way forward").
  • Reconcile/retract the linearity claim in README until .eph actually uses let! and compiles.
  • Adopt the Groove Ranked-Ownership Cleave spec (see companion standards issue) as the B-layer normative doc.

Suggested labels: abi, ephapax, design, audit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions