From f0ff5bece2427dda9ec3e2e28f223532aa366eae Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 21 Jun 2026 13:57:49 +0000 Subject: [PATCH] ci+chore: fix in-repo CI failures and clear rsr-template residue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pre-existing red checks on main, fixed where the cause lives in this repo: - e2e.yml: every job block shipped commented out, leaving `jobs:` empty — an invalid workflow that failed on every run. Replaced with a valid no-op (coordination repo has no application code to E2E; per-project E2E lives in the constituent repos). - rust-ci.yml: thin wrapper around the estate Rust reusable; this coordination repo has no Rust, so the reusable failed with nothing to build. Path-gated to Rust artefacts so it only runs if Rust is ever added here (currently never). rsr-template residue cleanup (OQ-002): - Justfile: project/REPO identity rsr-template-repo -> nextgen-typing. - docs/developer/ABI-FFI-README.adoc: was a 388-line doc describing a src/interface/Abi + ffi/zig layout this coordination repo does not have (and which re-misled agents into adding ABI/FFI code here). Replaced with a short pointer to typed-wasm + placement.a2ml. Out of scope (need access this session lacks): scorecard/governance/hypatia call hyperpolymath/standards reusables; mirror/instant-sync need org secrets; release is tag-only; quality startup_failure needs further triage. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01X2UKV63H4584CQ66qdgxZy --- .github/workflows/e2e.yml | 191 ++------------ .github/workflows/rust-ci.yml | 6 + Justfile | 4 +- docs/developer/ABI-FFI-README.adoc | 397 ++--------------------------- 4 files changed, 44 insertions(+), 554 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index f4ee3ec..6a56f23 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -1,190 +1,37 @@ # SPDX-License-Identifier: MPL-2.0 # Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) # -# RSR Standard E2E + Aspect + Benchmark Workflow Template -# -# Covers ALL merge requirement test categories: -# - E2E (end-to-end pipeline tests) -# - Aspect (cross-cutting concern validation) -# - Benchmarks (performance regression detection) -# - Readiness (Component Readiness Grade: D/C/B) -# -# INSTRUCTIONS: Uncomment and customise the section matching your stack. -# Delete sections that don't apply. See examples in each job. - +# nextgen-typing is a COORDINATION repo — it has no application/compiler code +# to exercise end-to-end (see AGENTS.md / .machine_readable/bot_directives/placement.a2ml). +# The estate E2E template ships with every job commented out, which leaves +# `jobs:` empty and makes the workflow invalid, so it failed on every run. +# This is a valid no-op that passes; per-project E2E lives in the constituent +# repos (typell, typed-wasm, ...). name: E2E + Aspect + Bench on: push: branches: [main, master, develop] - paths: - - 'src/**' - - 'ffi/**' - - 'tests/**' - - '.github/workflows/e2e.yml' pull_request: branches: [main, master] - paths: - - 'src/**' - - 'ffi/**' - - 'tests/**' workflow_dispatch: -permissions: read-all +permissions: + contents: read concurrency: group: e2e-${{ github.ref }} cancel-in-progress: true jobs: - # ─── End-to-End Tests ────────────────────────────────────────────── - # Uncomment ONE of the following e2e job blocks matching your stack. - - ## === RUST E2E === - # e2e: - # name: E2E — Full Pipeline - # runs-on: ubuntu-latest - # timeout-minutes: 15 - # steps: - # - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - # - uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable - # - uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2 - # - run: cargo build --release - # - run: bash tests/e2e.sh - # # OR: cargo test --test end_to_end -- --nocapture - - ## === ZIG FFI E2E === - # e2e: - # name: E2E — FFI Pipeline - # runs-on: ubuntu-latest - # timeout-minutes: 15 - # steps: - # - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - # - uses: goto-bus-stop/setup-zig@abea47f85e598557f500fa1fd2ab7464fcb39406 # v2.2.1 - # with: - # version: 0.15.0 - # - run: cd ffi/zig && zig build test - # - run: bash tests/e2e.sh - - ## === ELIXIR E2E === - # e2e: - # name: E2E — Full Pipeline - # runs-on: ubuntu-latest - # timeout-minutes: 15 - # steps: - # - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - # - uses: erlef/setup-beam@fc68ffb90438ef2936bbb3251622353b3dcb2f93 # v1.24.0 - # with: - # otp-version: '27.0' - # elixir-version: '1.17' - # - run: mix deps.get && mix compile --warnings-as-errors - # - run: mix test test/integration/e2e_test.exs --trace - - ## === DENO/RESCRIPT E2E === - # e2e: - # name: E2E — Full Pipeline - # runs-on: ubuntu-latest - # timeout-minutes: 15 - # steps: - # - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - # - uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2.0.4 - # with: - # deno-version: v2.x - # - run: deno install --node-modules-dir=auto - # - run: deno task res:build # ReScript compile - # - run: deno test tests/e2e/ - - ## === PLAYWRIGHT (Browser E2E) === - # e2e-playwright: - # name: Playwright — ${{ matrix.project }} - # runs-on: ubuntu-latest - # timeout-minutes: 20 - # strategy: - # fail-fast: false - # matrix: - # project: [chromium-1080p, firefox-1080p, webkit-1080p] - # steps: - # - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - # - uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2.0.4 - # with: - # deno-version: v2.x - # - run: deno install --node-modules-dir=auto - # - run: npx playwright install --with-deps - # - run: npx playwright test --project=${{ matrix.project }} - # - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 - # if: failure() - # with: - # name: playwright-traces-${{ matrix.project }} - # path: test-results/**/trace.zip - # retention-days: 7 - - ## === HASKELL E2E === - # e2e: - # name: E2E — Full Pipeline - # runs-on: ubuntu-latest - # timeout-minutes: 15 - # steps: - # - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - # - uses: haskell-actions/setup@cd0d9bdd65b20557f41bea4dbe43d0b5fbbfe553 # v2.11.0 - # with: - # ghc-version: '9.6' - # cabal-version: '3.10' - # - run: cabal build all - # - run: bash tests/integration-test.sh - - # ─── Aspect Tests ────────────────────────────────────────────────── - # Cross-cutting concerns: thread safety, ABI contracts, SPDX, dangerous patterns - # Uncomment and customise: - - # aspect-tests: - # name: Aspect — Architectural Invariants - # runs-on: ubuntu-latest - # timeout-minutes: 10 - # steps: - # - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - # - run: bash tests/aspect_tests.sh - - # ─── Benchmarks ──────────────────────────────────────────────────── - # Performance regression detection. Uncomment matching stack: - - ## === RUST BENCH === - # benchmarks: - # name: Bench — Performance Regression - # runs-on: ubuntu-latest - # timeout-minutes: 15 - # steps: - # - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - # - uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable - # - uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2 - # - run: cargo bench 2>&1 | tee /tmp/bench-results.txt - # - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 - # if: always() - # with: - # name: benchmark-results - # path: /tmp/bench-results.txt - # retention-days: 30 - - ## === ZIG BENCH === - # benchmarks: - # name: Bench — Performance Regression - # runs-on: ubuntu-latest - # timeout-minutes: 15 - # steps: - # - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - # - uses: goto-bus-stop/setup-zig@abea47f85e598557f500fa1fd2ab7464fcb39406 # v2.2.1 - # with: - # version: 0.15.0 - # - run: cd ffi/zig && zig build bench - - # ─── Readiness (CRG) ────────────────────────────────────────────── - # Component Readiness Grade: D (runs) → C (correct) → B (edge cases) - - # readiness: - # name: Readiness — Grade D/C/B - # runs-on: ubuntu-latest - # timeout-minutes: 10 - # steps: - # - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - # - uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7 # stable - # - uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2 - # - run: cargo test --test readiness -- --nocapture + e2e: + name: E2E (coordination repo — nothing to exercise) + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: No application code to test + run: | + echo "nextgen-typing coordinates the type-theory pipeline; it holds no" + echo "compiler/application code. End-to-end, aspect, and benchmark tests" + echo "live in the owning repos (typell, typed-wasm, ...)." + echo "See .machine_readable/bot_directives/placement.a2ml." diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml index 5ccecc5..533355c 100644 --- a/.github/workflows/rust-ci.yml +++ b/.github/workflows/rust-ci.yml @@ -2,12 +2,18 @@ # Rust CI — thin wrapper calling the shared estate reusable in # hyperpolymath/standards. Configure once, propagate everywhere. # See: docs/CI-REUSABLE-WORKFLOWS.adoc in standards. +# +# nextgen-typing is a coordination repo with NO Rust code, so the reusable had +# nothing to build and failed. Path-gated to Rust artefacts so it only runs if +# Rust is ever added here (currently never), instead of failing on every push. name: Rust CI on: push: branches: [main, master] + paths: ['**/*.rs', '**/Cargo.toml', '**/Cargo.lock', 'crates/**'] pull_request: + paths: ['**/*.rs', '**/Cargo.toml', '**/Cargo.lock', 'crates/**'] permissions: contents: read diff --git a/Justfile b/Justfile index 2361fa2..3579f36 100644 --- a/Justfile +++ b/Justfile @@ -19,9 +19,9 @@ set positional-arguments := true import? "contractile.just" # Project metadata — customize these -project := "rsr-template-repo" +project := "nextgen-typing" OWNER := "hyperpolymath" -REPO := "rsr-template-repo" +REPO := "nextgen-typing" version := "0.1.0" tier := "infrastructure" # 1 | 2 | infrastructure diff --git a/docs/developer/ABI-FFI-README.adoc b/docs/developer/ABI-FFI-README.adoc index dbf2b2b..3f680cf 100644 --- a/docs/developer/ABI-FFI-README.adoc +++ b/docs/developer/ABI-FFI-README.adoc @@ -1,387 +1,24 @@ // SPDX-License-Identifier: MPL-2.0 -// Copyright (c) Jonathan D.A. Jewell -= ABI/FFI Standards -{{~ Aditionally delete this line and fill out the template below ~}} +// Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) += ABI/FFI — not defined in this repo -# NEXTGEN_TYPING ABI/FFI Documentation +nextgen-typing is a *coordination repo*: it documents and connects the +type-theory pipeline and holds no compiler or application code, so it defines +no ABI and no FFI of its own. -## Overview +NOTE: the previous content here was RSR-template residue describing a +`src/interface/Abi/` + `ffi/zig/` + `generated/abi/` layout that this repo does +not have and never will. It was removed because it misled both humans and +agents into adding ABI/FFI code to the coordination layer. -This library follows the **Hyperpolymath RSR Standard** for ABI and FFI design: +== Where the ABI actually lives -- **ABI (Application Binary Interface)** defined in **Idris2** with formal proofs -- **FFI (Foreign Function Interface)** implemented in **Zig** for C compatibility -- **Generated C headers** bridge Idris2 ABI to Zig FFI -- **Any language** can call through standard C ABI +The estate's *verified convergence ABI* — the binary contract that independent +WasmGC languages (AffineScript, Ephapax) agree on — and the aggregate-library +binary conventions live in *typed-wasm*: -## Architecture +* WasmGC memory-safety proofs + convergence ABI: `hyperpolymath/typed-wasm` +* Aggregate-library conventions (ADR-004): `hyperpolymath/typed-wasm` -``` -┌─────────────────────────────────────────────┐ -│ ABI Definitions (Idris2) │ -│ src/interface/Abi/ │ -│ - Types.idr (Type definitions) │ -│ - Layout.idr (Memory layout proofs) │ -│ - Foreign.idr (FFI declarations) │ -└─────────────────┬───────────────────────────┘ - │ - │ generates (at compile time) - ▼ -┌─────────────────────────────────────────────┐ -│ C Headers (auto-generated) │ -│ generated/abi/nextgen_typing.h │ -└─────────────────┬───────────────────────────┘ - │ - │ imported by - ▼ -┌─────────────────────────────────────────────┐ -│ FFI Implementation (Zig) │ -│ ffi/zig/src/main.zig │ -│ - Implements C-compatible functions │ -│ - Zero-cost abstractions │ -│ - Memory-safe by default │ -└─────────────────┬───────────────────────────┘ - │ - │ compiled to libnextgen_typing.so/.a - ▼ -┌─────────────────────────────────────────────┐ -│ Any Language via C ABI │ -│ - Rust, ReScript, Julia, Python, etc. │ -└─────────────────────────────────────────────┘ -``` - -## Directory Structure - -``` -nextgen_typing/ -├── src/ -│ └── interface/ -│ └── Abi/ # ABI definitions (Idris2) -│ ├── Types.idr # Core type definitions with proofs -│ ├── Layout.idr # Memory layout verification -│ └── Foreign.idr # FFI function declarations -│ └── lib/ # Core library (any language) -│ -├── ffi/ -│ └── zig/ # FFI implementation (Zig) -│ ├── build.zig # Build configuration -│ ├── build.zig.zon # Dependencies -│ ├── src/ -│ │ └── main.zig # C-compatible FFI implementation -│ ├── test/ -│ │ └── integration_test.zig -│ └── include/ -│ └── nextgen_typing.h # C header (optional, can be generated) -│ -├── generated/ # Auto-generated files -│ └── abi/ -│ └── nextgen_typing.h # Generated from Idris2 ABI -│ -└── bindings/ # Language-specific wrappers (optional) - ├── rust/ - ├── rescript/ - └── julia/ -``` - -## Why Idris2 for ABI? - -### 1. **Formal Verification** - -Idris2's dependent types allow proving properties about the ABI at compile-time: - -```idris --- Prove struct size is correct -public export -exampleStructSize : HasSize ExampleStruct 16 - --- Prove field alignment is correct -public export -fieldAligned : Divides 8 (offsetOf ExampleStruct.field) - --- Prove ABI is platform-compatible -public export -abiCompatible : Compatible (ABI 1) (ABI 2) -``` - -### 2. **Type Safety** - -Encode invariants that C/Zig cannot express: - -```idris --- Non-null pointer guaranteed at type level -data Handle : Type where - MkHandle : (ptr : Bits64) -> {auto 0 nonNull : So (ptr /= 0)} -> Handle - --- Array with length proof -data Buffer : (n : Nat) -> Type where - MkBuffer : Vect n Byte -> Buffer n -``` - -### 3. **Platform Abstraction** - -Platform-specific types with compile-time selection: - -```idris -CInt : Platform -> Type -CInt Linux = Bits32 -CInt Windows = Bits32 - -CSize : Platform -> Type -CSize Linux = Bits64 -CSize Windows = Bits64 -``` - -### 4. **Safe Evolution** - -Prove that new ABI versions are backward-compatible: - -```idris --- Compiler enforces compatibility -abiUpgrade : ABI 1 -> ABI 2 -abiUpgrade old = MkABI2 { - -- Must preserve all v1 fields - v1_compat = old, - -- Can add new fields - new_features = defaults -} -``` - -## Why Zig for FFI? - -### 1. **C ABI Compatibility** - -Zig exports C-compatible functions naturally: - -```zig -export fn library_function(param: i32) i32 { - return param * 2; -} -``` - -### 2. **Memory Safety** - -Compile-time safety without runtime overhead: - -```zig -// Null check enforced at compile time -const handle = init() orelse return error.InitFailed; -defer free(handle); -``` - -### 3. **Cross-Compilation** - -Built-in cross-compilation to any platform: - -```bash -zig build -Dtarget=x86_64-linux -zig build -Dtarget=aarch64-macos -zig build -Dtarget=x86_64-windows -``` - -### 4. **Zero Dependencies** - -No runtime, no libc required (unless explicitly needed): - -```zig -// Minimal binary size -pub const lib = @import("std"); -// Only includes what you use -``` - -## Building - -### Build FFI Library - -```bash -cd ffi/zig -zig build # Build debug -zig build -Doptimize=ReleaseFast # Build optimized -zig build test # Run tests -``` - -### Generate C Header from Idris2 ABI - -```bash -cd src/interface/Abi -idris2 --cg c-header Types.idr -o ../../../generated/abi/nextgen_typing.h -``` - -### Cross-Compile - -```bash -cd ffi/zig - -# Linux x86_64 -zig build -Dtarget=x86_64-linux - -# macOS ARM64 -zig build -Dtarget=aarch64-macos - -# Windows x86_64 -zig build -Dtarget=x86_64-windows -``` - -## Usage - -### From C - -```c -#include "nextgen_typing.h" - -int main() { - void* handle = nextgen_typing_init(); - if (!handle) return 1; - - int result = nextgen_typing_process(handle, 42); - if (result != 0) { - const char* err = nextgen_typing_last_error(); - fprintf(stderr, "Error: %s\n", err); - } - - nextgen_typing_free(handle); - return 0; -} -``` - -Compile with: -```bash -gcc -o example example.c -lnextgen_typing -L./zig-out/lib -``` - -### From Idris2 - -```idris -import NEXTGEN_TYPING.ABI.Foreign - -main : IO () -main = do - Just handle <- init - | Nothing => putStrLn "Failed to initialize" - - Right result <- process handle 42 - | Left err => putStrLn $ "Error: " ++ errorDescription err - - free handle - putStrLn "Success" -``` - -### From Rust - -```rust -#[link(name = "nextgen_typing")] -extern "C" { - fn nextgen_typing_init() -> *mut std::ffi::c_void; - fn nextgen_typing_free(handle: *mut std::ffi::c_void); - fn nextgen_typing_process(handle: *mut std::ffi::c_void, input: u32) -> i32; -} - -fn main() { - unsafe { - let handle = nextgen_typing_init(); - assert!(!handle.is_null()); - - let result = nextgen_typing_process(handle, 42); - assert_eq!(result, 0); - - nextgen_typing_free(handle); - } -} -``` - -### From Julia - -```julia -const libnextgen_typing = "libnextgen_typing" - -function init() - handle = ccall((:nextgen_typing_init, libnextgen_typing), Ptr{Cvoid}, ()) - handle == C_NULL && error("Failed to initialize") - handle -end - -function process(handle, input) - result = ccall((:nextgen_typing_process, libnextgen_typing), Cint, (Ptr{Cvoid}, UInt32), handle, input) - result -end - -function cleanup(handle) - ccall((:nextgen_typing_free, libnextgen_typing), Cvoid, (Ptr{Cvoid},), handle) -end - -# Usage -handle = init() -try - result = process(handle, 42) - println("Result: $result") -finally - cleanup(handle) -end -``` - -## Testing - -### Unit Tests (Zig) - -```bash -cd ffi/zig -zig build test -``` - -### Integration Tests - -```bash -cd ffi/zig -zig build test-integration -``` - -### ABI Verification (Idris2) - -```idris --- Compile-time verification -%runElab verifyABI - --- Runtime checks -main : IO () -main = do - verifyLayoutsCorrect - verifyAlignmentsCorrect - putStrLn "ABI verification passed" -``` - -## Contributing - -When modifying the ABI/FFI: - -1. **Update ABI first** (`src/interface/Abi/*.idr`) - - Modify type definitions - - Update proofs - - Ensure backward compatibility - -2. **Generate C header** - ```bash - idris2 --cg c-header src/interface/Abi/Types.idr -o generated/abi/nextgen_typing.h - ``` - -3. **Update FFI implementation** (`ffi/zig/src/main.zig`) - - Implement new functions - - Match ABI types exactly - -4. **Add tests** - - Unit tests in Zig - - Integration tests - - ABI verification tests - -5. **Update documentation** - - Function signatures - - Usage examples - - Migration guide (if breaking changes) - -## License - -{{LICENSE}} - -## See Also - -- [Idris2 Documentation](https://idris2.readthedocs.io) -- [Zig Documentation](https://ziglang.org/documentation/master/) -- [Rhodium Standard Repositories](https://github.com/hyperpolymath/rhodium-standard-repositories) +For where any given artefact belongs, see the authoritative routing table at +`.machine_readable/bot_directives/placement.a2ml` and the summary in `AGENTS.md`.