Skip to content

test(abi,ffi): port TypeScript test suite to Idris2 + Zig; purge wokelangiser#25

Merged
hyperpolymath merged 3 commits into
mainfrom
feat/abi-tests-idris2-zig-port
May 20, 2026
Merged

test(abi,ffi): port TypeScript test suite to Idris2 + Zig; purge wokelangiser#25
hyperpolymath merged 3 commits into
mainfrom
feat/abi-tests-idris2-zig-port

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

Summary

Three commits, prepared as one PR because they share one goal — get the gossamer test suite off TypeScript and onto the architecturally-correct languages per the project rule ("Idris2 = ABI only, Zig = FFI/API only, Ephapax = everything else, no TypeScript/JavaScript").

  1. 56ca829 chore(linguist): purge the wokelangiser footprint (~50k lines of estate-scan output that wasn't relevant to gossamer); add generated/** linguist-generated to .gitattributes so generated content stops skewing language stats.
  2. 3550f6a test(abi): port 4 unit test suites (result_code, guard_mode, capability, ipc) from TypeScript to Idris2 — they test ABI invariants, so Idris2 is the right home.
  3. d927591 test(abi,ffi): complete the port — security + contracts → Idris2 (ABI aspect/property), dialog + webview_lifecycle → Zig (FFI), benches → Zig (FFI). Delete deno.json + all TS test files.

Adds tests/idris2/Test/Spec.idr — a small homegrown harness (MkTest, assertEq, assertTrue, runTestSuite) because there's no Idris2 BDD framework that fits the ABI-test style. Aggregating Main.idr runs all suites, sums pass/fail, exits non-zero on any failure.

Why

The existing TS tests violated the architecture rule and required a Deno runtime in the dev loop that nothing else in gossamer needs. The Idris2 tests live alongside the ABI types they exercise (src/interface/Gossamer/ABI/*.idr), and the Zig tests live alongside the FFI they exercise (src/interface/ffi/test/*.zig). One toolchain less to maintain.

Test plan

  • All 7 Idris2 suites build under idris2 0.8.0 (resolved totality + Show instance + Nat-modulo PRNG hang issues during port).
  • All 4 Zig suites build under Zig 0.15 (resolved ArrayList .empty + closure-over-locals issues).
  • gossamer-abi-tests runner exits 0 with all suites green.
  • Reviewer: confirm CI picks up new just test-abi and just test-zig-unit / test-zig-bench targets.
  • Reviewer: confirm Linguist language stats now reflect actual gossamer composition (Ephapax + Zig + Idris2 dominant, TS gone).

Notes

  • Test.Spec is intentionally minimal. If a richer Idris2 test pattern emerges across the estate, it should be lifted into repos-monorepo/panic-free-tests-and-benches as a cladistic registry — that's a separate workstream the user has already flagged.
  • Justfile gained test-abi, test-zig-unit, test-zig-bench targets that handle the IDRIS2_PREFIX resolution + the per-suite Zig commands.
  • The cherry-picks come from a previous session's local branch (proof-debt/standards-131-abi-rescue-wip); replayed onto fresh main here so the test-suite work has its own clean PR independent of any proof-debt commits.

🤖 Generated with Claude Code

hyperpolymath and others added 3 commits May 20, 2026 08:30
wokelangiser is a GDPR/CCPA/accessibility/i18n compliance tool. Its
manifest here was pointed at the wider estate (rescript-ecosystem,
flat-mate, echidna, neural-foundations) — none of those are gossamer
code, and the 6.9MB compliance report + 689KB generated consent gates
were dead bytes inflating the Linguist JavaScript share to 86%.

Removals:
  - wokelangiser.toml (estate-scope config)
  - generated/wokelangiser/ (consent gates, banner, compliance report)
  - .gitignore exception lines for the above

Linguist:
  - generated/** now linguist-generated (covers the legitimate tlaiser
    TLA+ specs and any future generator output)

No build / CI impact — Justfile, container/, and .github/workflows had
no references to wokelangiser.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
First phase of replacing tests/*.ts (Deno-FFI tests) with native Idris2
tests against the gossamer-abi package. Goal: eliminate TypeScript from
the gossamer tree per the language-rule split (Idris2 = ABI tests,
Zig = FFI/e2e/bench tests, no TS/JS).

Tests added (107 cases, all green):
  - ResultCodeTest  (35) — Result enum, resultToInt/FromInt round-trip,
                            errorDescription, GuardMode, Platform
  - GuardModeTest   (38) — GuardMode enum, requireOpen / requireUnguarded,
                            window-constraint validation, async IPC slots
  - CapabilityTest  (17) — grant / check / revoke / resourceKind /
                            activeCount lifecycle
  - IPCTest         (17) — IPC channel open / bind / dispatch / close,
                            message routing, command-name validation

Test infrastructure:
  - tests/idris2/Test/Spec.idr   minimal harness (assertEq, assertNotEq,
                                  assertTrue, allPass, runTestSuite, runTests)
  - tests/idris2/Main.idr        aggregating runner — append new suites here
  - gossamer-abi-tests.ipkg      depends on installed gossamer-abi package
  - Justfile `test-abi` target   wired into `just test`

Idris2 toolchain note: the installed idris2 has a stale baked-in prefix
(.asdf/...), so test-abi recomputes IDRIS2_PREFIX from the binary path.

Remaining ports (TS files still on disk, not yet eliminated):
  - tests/property/contracts_test.ts        → Idris2
  - tests/aspect/security_test.ts           → Idris2
  - tests/unit/dialog_test.ts               → Zig
  - tests/e2e/webview_lifecycle_test.ts     → Zig
  - tests/bench/{gossamer,startup}_bench.ts → Zig

After all ports land, tests/*.ts and the deno.json test:* tasks get
deleted in a final cleanup commit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Phase 2 of the TS-elimination campaign. Adds the remaining 6 ports,
deletes all tests/*.ts files, and removes the Deno test infrastructure.

Idris2 ports added (suites land in gossamer-abi-tests):
  - ContractsTest.idr (15 tests)   property-style invariants via LCG PRNG
  - SecurityTest.idr  (25 tests)   IPC + shell + FS + webview-title + cap hardening

Zig ports added (under src/interface/ffi/test/):
  - dialog_test.zig             (17 tests)  Dialog mock + filter parser
  - webview_lifecycle_test.zig  (15 tests)  state machine + mocked FFI e2e
  - gossamer_bench.zig          (24 benches)  core ops microbenchmarks
  - startup_bench.zig           (19 benches)  startup-path microbenchmarks

Cleanup:
  - Delete all 10 tests/*.ts files + empty subdirs (unit/property/aspect/e2e/bench)
  - Delete deno.json (was solely for the TS test runner)
  - Update tests/README.adoc to describe the new Idris2 + Zig layout
  - Update GETTING-STARTED.md to drop deno bench reference
  - Update TEST-NEEDS.md to point at `just test` instead of deno
  - Justfile: add `test-zig-unit` (dialog + webview) and `test-zig-bench`
    (gossamer_bench + startup_bench with -OReleaseFast)

Final tallies:
  Idris2 ABI tests:  147 (across 6 suites, all green)
  Zig unit/e2e:       32 (dialog 17 + webview 15, all green)
  Zig benchmarks:     43 (gossamer 24 + startup 19, all green)
  TypeScript files:    0  (eliminated)

Notes preserved as comments in the ports:
  - SecurityTest's HTML sanitiser uses partial helpers (manifestly
    terminating but not structurally recursive — Idris2 needs `partial`)
  - startup_bench preserves the TS port's 15 result codes (3 more than
    Types.idr defines — pre-existing TS drift, benchmark-only so harmless)
  - Optimizer DCE makes some bench numbers 0.0 ns/op even with
    -OReleaseFast; doNotOptimizeAway used where it mattered

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@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

@hyperpolymath hyperpolymath merged commit d4eb5ae into main May 20, 2026
18 of 20 checks passed
@hyperpolymath hyperpolymath deleted the feat/abi-tests-idris2-zig-port branch May 20, 2026 13:08
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