Skip to content

recover(cli): Main.eph subcommand dispatcher (re-targets PR #33 at main)#38

Merged
hyperpolymath merged 1 commit into
mainfrom
feat/recover-15-step-2-dispatcher
May 20, 2026
Merged

recover(cli): Main.eph subcommand dispatcher (re-targets PR #33 at main)#38
hyperpolymath merged 1 commit into
mainfrom
feat/recover-15-step-2-dispatcher

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

Why this PR exists

PR #33 ("feat(cli): Main.eph subcommand dispatcher in v2-grammar Ephapax") shows as MERGED on GitHub but its commit never landed on main — same stacked-PR-into-feature-branch trap as PRs #29/#30. This is recovery PR 3 of 4.

PR 1/4 (#35) is MERGED. PR 2/4 (#37) is open. This PR should merge after #37.

What this PR lands

Single new file: `cli/src/Main.eph` (~109 LOC).

Same content as orphaned #33 — a dispatcher that exercises sum types, pattern matching, multi-branch conditionals, let bindings, multiple FFI externs, and real calls into libgossamer through the 14a.5b bridges (now on main via #35).

Component Purpose
`pub data Subcommand` 6-variant sum type classifying the run by argv_count
`classify(n)` Multi-branch if/else into Subcommand
`dispatchCode(s)` Pattern-matches each variant to a stable status code (100..900)
`grooveProbe()` Calls `env::gossamer_groove_discover` — proves 14a.5b bridges reachable
`statusCode()` Composes dispatch + clamped groove count into one I32
`main()` Prints statusCode and returns

Three v2-grammar limits documented (all addressed in PR 4/4)

  1. No linear-memory reads from user code. Subcommand-name dispatch (`match argv[1] of "dev" => ...`) needs to extract bytes from an argv buffer. Workaround in this PR: dispatch on argv_count.
  2. No I64 literal. `cap_token == 0` (I64 vs I32 literal) can't typecheck.
  3. String-typed externs lower to opaque i32 handles, not (ptr, len) pairs.

Recovery PR 4/4 resolves all three via launcher-side bridges (`say_string`, `argv_eq_string`, `i64_is_zero`), upgrading this dispatcher to argv[0]-name matching.

Merge order

⚠️ This PR's Main.eph is dead code without #37's build.zig ephapax compile step. Merge #37 first; then this PR.

Verification

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 31 issues detected

Severity Count
🔴 Critical 11
🟠 High 4
🟡 Medium 16

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Issue in quality.yml",
    "type": "missing_workflow",
    "file": "quality.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in security-policy.yml",
    "type": "missing_workflow",
    "file": "security-policy.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
    "type": "unpinned_action",
    "file": "governance.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Action actions/upload-artifact@v4 needs attention",
    "type": "unpinned_action",
    "file": "release.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action actions/download-artifact@v4 needs attention",
    "type": "unpinned_action",
    "file": "release.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "believe_me undermines formal verification (1 occurrences, CWE-704)",
    "type": "believe_me",
    "file": "/home/runner/work/gossamer/gossamer/src/interface/abi/IPCDispatch.idr",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "critical"
  },
  {
    "reason": "believe_me undermines formal verification (1 occurrences, CWE-704)",
    "type": "believe_me",
    "file": "/home/runner/work/gossamer/gossamer/src/interface/abi/ResourceCleanup.idr",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "critical"
  },
  {
    "reason": "believe_me undermines formal verification (1 occurrences, CWE-704)",
    "type": "believe_me",
    "file": "/home/runner/work/gossamer/gossamer/src/interface/abi/GrooveTermination.idr",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "critical"
  },
  {
    "reason": "believe_me undermines formal verification (1 occurrences, CWE-704)",
    "type": "believe_me",
    "file": "/home/runner/work/gossamer/gossamer/src/interface/abi/HandleLinearity.idr",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "critical"
  },
  {
    "reason": "believe_me undermines formal verification (1 occurrences, CWE-704)",
    "type": "believe_me",
    "file": "/home/runner/work/gossamer/gossamer/src/interface/abi/WindowStateMachine.idr",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "critical"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

Recovery PR 3/4. Same content as orphaned PR #33 — a dispatcher
that exercises sum types, pattern matching, multi-branch
conditionals, let bindings, multiple FFI externs, and real calls
into libgossamer through the 14a.5b bridges (now on main via #35).

Architecture:

  • pub data Subcommand = NoArg | InfoOrVersion | DevOrRunOrBuild |
    Init | Bundle | TooMany — classifies the run by argv_count.
  • dispatchCode(s) match-lowers each variant to a stable status
    code (100..900).
  • grooveProbe() calls env::gossamer_groove_discover — proves the
    14a.5b libgossamer bridge surface is reachable from Ephapax.
  • statusCode() composes dispatch + clamped-groove-count into a
    single I32 the harness reads back.
  • main() prints statusCode() and returns.

Compiles to 1514-byte cli.wasm. 5 host imports (all in the launcher's
bridge surface from 14a.5a/5b): print_i32, argv_count, argv_arg_len,
gossamer_groove_discover, gossamer_groove_status. Plus the 2 always-on
ephapax baseline imports.

Documented v2-grammar limits hit during this work (all three
addressed in the next recovery PR via launcher-side helpers):

  1. No linear-memory reads from user code (no argv[1] string match).
  2. No I64 literal (cap_token == 0 can't typecheck).
  3. String-typed externs lower to opaque i32 handles, not (ptr, len).

Subcommand dispatch via argv_count is the workaround in this PR;
the conventional argv[0]-match shape lands in recovery PR 4/4 with
the String FFI bridges.

Recovery PR 3/4. Lands on top of:
  • #35 (14a.5b libgossamer bridges) — MERGED
  • #37 (14a.5c build integration) — open, will merge before this

This PR's Main.eph is dead code without #37's build.zig ephapax
compile step. Merge order matters: #37 first, then this PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@hyperpolymath hyperpolymath force-pushed the feat/recover-15-step-2-dispatcher branch from f30907a to f7f81f1 Compare May 20, 2026 12:26
@hyperpolymath hyperpolymath merged commit 14d8b29 into main May 20, 2026
14 of 16 checks passed
hyperpolymath added a commit that referenced this pull request May 20, 2026
Three things were blocking gossamer #38/#39 (the recovery chain) from
going green even after rebase:

1. CLI build silently failing (`zig build 2>/dev/null` hides the actual
   error). Drop the redirect so future failures are diagnosable.

2. "Dangerous Idris2 patterns in ABI" was a false positive — the grep
   matched doc-comment lines saying *"Zero believe_me. All proofs are
   constructive."* Tighten the grep to exclude `||| ...` and `-- ...`
   comment lines so only real code uses fail the test.

3. 18 of 19 src/interface/ffi/src/*.zig files were missing SPDX headers.
   Added the canonical
       SPDX-License-Identifier: PMPL-1.0-or-later
       Copyright (c) 2026 Jonathan D.A. Jewell …
   prefix to each. Also widened the SPDX check from a 20-file sample
   to the full FFI source set, so a future regression can't hide in
   the un-sampled tail.

The libwasmtime install gate per session memory: the cli/launcher
(Zig wasm host) links wasmtime via /usr/local/lib but CI never
installed the C-API release tarball. Add a pinned install step
(v44.0.1, SHA256-verified, x86_64) plus a Section 3b probe in
tests/e2e.sh that asserts the headers + library are present. The
launcher itself isn't built in CI yet because that path also needs
the ephapax binary; that wiring is a separate follow-up.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@hyperpolymath hyperpolymath deleted the feat/recover-15-step-2-dispatcher branch May 20, 2026 13:08
@github-actions
Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 31 issues detected

Severity Count
🔴 Critical 11
🟠 High 4
🟡 Medium 16

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Issue in quality.yml",
    "type": "missing_workflow",
    "file": "quality.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in security-policy.yml",
    "type": "missing_workflow",
    "file": "security-policy.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
    "type": "unpinned_action",
    "file": "governance.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Action actions/upload-artifact@v4 needs attention",
    "type": "unpinned_action",
    "file": "release.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action actions/download-artifact@v4 needs attention",
    "type": "unpinned_action",
    "file": "release.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "believe_me undermines formal verification (1 occurrences, CWE-704)",
    "type": "believe_me",
    "file": "/home/runner/work/gossamer/gossamer/src/interface/abi/IPCDispatch.idr",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "critical"
  },
  {
    "reason": "believe_me undermines formal verification (1 occurrences, CWE-704)",
    "type": "believe_me",
    "file": "/home/runner/work/gossamer/gossamer/src/interface/abi/ResourceCleanup.idr",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "critical"
  },
  {
    "reason": "believe_me undermines formal verification (1 occurrences, CWE-704)",
    "type": "believe_me",
    "file": "/home/runner/work/gossamer/gossamer/src/interface/abi/GrooveTermination.idr",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "critical"
  },
  {
    "reason": "believe_me undermines formal verification (1 occurrences, CWE-704)",
    "type": "believe_me",
    "file": "/home/runner/work/gossamer/gossamer/src/interface/abi/HandleLinearity.idr",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "critical"
  },
  {
    "reason": "believe_me undermines formal verification (1 occurrences, CWE-704)",
    "type": "believe_me",
    "file": "/home/runner/work/gossamer/gossamer/src/interface/abi/WindowStateMachine.idr",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "critical"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

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