Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .clusterfuzzlite/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ echo "=== ClusterFuzzLite build: proven ==="
mkdir -p "$OUT"

# Build the standalone Zig FFI fixture as libproven.so. The full Idris RefC
# bridge is exercised by ffi-full-integration.yml when its private dependency
# credential is configured; this PR fuzz gate must stay self-contained.
# bridge is exercised by ffi-full-integration.yml using the pinned public SDK.
# This fixture explicitly binds the unavailable lifecycle backend.
if [[ -f ffi/zig/build.zig ]]; then
pushd ffi/zig >/dev/null
mkdir -p zig-out/lib
zig build-lib -static -O ReleaseSafe -fno-stack-check -fPIC --name proven \
-femit-bin=zig-out/lib/libproven.a src/main.zig -lc || {
-femit-bin=zig-out/lib/libproven.a -lc --dep lifecycle -Mroot=src/main.zig \
-Mlifecycle=src/lifecycle_unavailable.zig || {
echo "WARN: standalone Zig FFI build failed; fuzz targets will not link." >&2
exit 1
}
Expand Down
42 changes: 39 additions & 3 deletions .github/workflows/ffi-full-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
name: FFI Full Integration
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
permissions:
contents: read
permissions: {}
on:
push:
branches: [main]
Expand All @@ -16,6 +15,15 @@ on:
- 'scripts/build-header-refc.sh'
- 'scripts/test-refc-staging.sh'
- '.github/workflows/ffi-full-integration.yml'
- 'scripts/test-native-lifecycle.sh'
- 'scripts/test-remediation-bridge.sh'
- 'scripts/check-abi-ledger.sh'
- 'scripts/check-native-nif-exports.sh'
- 'scripts/test-abi-ledger.sh'
- 'tests/check-native-nif-exports.sh'
- 'tests/remediation/**'
- 'bindings/c/include/**'
- 'bindings/rust/src/ffi.rs'
Comment thread
hyperpolymath marked this conversation as resolved.
Resolved
pull_request:
paths:
- 'src/**'
Expand All @@ -25,6 +33,15 @@ on:
- 'scripts/build-header-refc.sh'
- 'scripts/test-refc-staging.sh'
- '.github/workflows/ffi-full-integration.yml'
- 'scripts/test-native-lifecycle.sh'
- 'scripts/test-remediation-bridge.sh'
- 'scripts/check-abi-ledger.sh'
- 'scripts/check-native-nif-exports.sh'
- 'scripts/test-abi-ledger.sh'
- 'tests/check-native-nif-exports.sh'
- 'tests/remediation/**'
- 'bindings/c/include/**'
- 'bindings/rust/src/ffi.rs'
workflow_dispatch:
concurrency:
group: ffi-full-integration-${{ github.ref }}
Expand All @@ -34,6 +51,8 @@ jobs:
name: Idris -> RefC -> Zig
runs-on: ubuntu-22.04
timeout-minutes: 45
permissions:
contents: read
steps:
- name: Checkout proven
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
Expand Down Expand Up @@ -65,11 +84,28 @@ jobs:
-Didris-c-support="$IDRIS2_C_SUPPORT" \
-Didris-support-lib="$IDRIS2_SUPPORT_LIB" 2>&1 | tee ../../build/refc/zig-tests.log
test -s zig-out/lib/libproven.a
- name: Check production lifecycle proofs and actual C/Rust consumers
env:
IDRIS2: /home/runner/.idris2/bin/idris2
run: bash scripts/test-native-lifecycle.sh
- name: Test the NIF symbol checker with planted controls
run: bash tests/check-native-nif-exports.sh
- name: Test the ABI ledger with shared and static planted controls
run: bash scripts/test-abi-ledger.sh
- name: Test production nonce and entropy through the public RefC SDK
env:
IDRIS2: /home/runner/.idris2/bin/idris2
run: |
set -euo pipefail
mkdir -p build/native-abi-evidence
bash scripts/test-remediation-bridge.sh 2>&1 | tee build/native-abi-evidence/nonce-remediation.log
- name: Reject stale output and misleading compiler success
run: bash scripts/test-refc-staging.sh
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
if: always()
with:
name: full-refc-build-evidence
path: build/refc/
path: |
build/refc/
build/native-abi-evidence/
if-no-files-found: error
11 changes: 10 additions & 1 deletion .github/workflows/idris2-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:
- 'scripts/test-totality-regressions.sh'
- 'proven.ipkg'
- 'tests.ipkg'
- 'scripts/test-critical-remediation.sh'
- '.github/workflows/idris2-ci.yml'
pull_request:
branches: [main]
Expand All @@ -23,6 +24,7 @@ on:
- 'scripts/test-totality-regressions.sh'
- 'proven.ipkg'
- 'tests.ipkg'
- 'scripts/test-critical-remediation.sh'
- '.github/workflows/idris2-ci.yml'
workflow_dispatch:
# Cancel superseded runs on the same ref. Idris2 bootstrap + build is
Expand Down Expand Up @@ -134,7 +136,7 @@ jobs:
- name: Install Idris 2 dependencies
run: |
sudo apt-get update
sudo apt-get install -y chezscheme libgmp-dev
sudo apt-get install -y chezscheme libgmp-dev sqlite3
# Cache the Idris2 compiler + bundled packages (base/contrib/network)
# only. This job never runs `idris2 --install proven.ipkg` and never
# caches `build/`, so every run type-checks the CURRENT source of each
Expand All @@ -156,6 +158,13 @@ jobs:
make install
- name: Add Idris 2 to PATH
run: echo "$HOME/.idris2/bin" >> $GITHUB_PATH
- name: Set up Julia for SQLite receiver tests
uses: julia-actions/setup-julia@4c0cb0fce8556fdb04a90347310e5db8b1f98fb9 # v2
with:
version: '1.13.1'
- name: Prove and execute critical remediation regressions
# Julia calls SQLite's API so CLI newline processing cannot alter fixtures.
run: bash scripts/test-critical-remediation.sh
- name: Type check the proof modules in proven.ipkg
# Scope: every `*.Proofs` module LISTED IN proven.ipkg — i.e. the proof
# modules the package actually builds. (64 of the 93 Proofs.idr files on
Expand Down
3 changes: 3 additions & 0 deletions .gitleaksignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ tests/unit/SafeJWTUnit.idr:jwt:37
# Inspection/refusal fixture: HS256 header with a four-byte ASCII signature
# (HS256 requires 32 bytes); these tests require authentication to reject it.
e7a0aa8a46601df22f0853c28ec26424a3874321:tests/remediation/JWTSQLMain.idr:generic-api-key:52

# Current-tree form of the same deliberately invalid four-byte-signature fixture above.
tests/remediation/JWTSQLMain.idr:generic-api-key:52
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "nextgen-languages/language-bridges"]
path = nextgen-languages/language-bridges
url = https://github.com/hyperpolymath/language-bridges.git
10 changes: 7 additions & 3 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
:icons: font
:source-highlighter: rouge

*Mathematically proven safe operations.* Code that **cannot crash**, verified with Idris2 dependent types and totality checking.
Safety operations with Idris2 contracts, checked properties and native integration
tests. Assurance is scoped to individual properties and execution boundaries;
this repository is not wholly proved and its complete native ABI is not ready
for release. See link:docs/status/LIFECYCLE-PROOF-STATUS.adoc[the lifecycle proof
ledger] for the checked Linux lifecycle slice, retained evidence and open assumptions.

image:https://img.shields.io/badge/OpenSSF-Best_Practices-green?logo=opensourcesecurity[OpenSSF Best Practices,link="https://www.bestpractices.dev/en/projects/new?repo_url=https://github.com/hyperpolymath/proven"]
image:https://img.shields.io/badge/version-1.2.0-blue[Version 1.2.0]
Expand All @@ -15,7 +19,6 @@ image:https://img.shields.io/badge/modules-104-blue[104 Modules]
image:https://img.shields.io/badge/bindings-120+_targets-orange[120+ Binding Targets]
image:https://img.shields.io/badge/verified-Idris_2-purple[Verified with Idris 2]
image:https://img.shields.io/badge/believe__me-0_✓-brightgreen[believe_me = 0 (fully eliminated)]
image:https://img.shields.io/badge/overall-55%25-yellow[Overall 55%]
image:https://api.thegreenwebfoundation.org/greencheckimage/jewell.nexus[Green Hosting,link="https://www.thegreenwebfoundation.org/green-web-check/?url=jewell.nexus"]

== License
Expand All @@ -25,7 +28,8 @@ This project is licensed under **MPL-2.0**. See link:LICENSE[LICENSE].
== What Makes proven Different?

*Traditional Libraries:* Trust the author got it right +
*proven:* **Mathematical proof** the code cannot crash
*proven:* Explicit contracts and checked properties, with proof debt and native
boundary assumptions recorded separately from tests.

=== Architecture

Expand Down
11 changes: 11 additions & 0 deletions ROADMAP.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@

toc::[]

== Lifecycle integration (2026-11-25)

PR246 integrates lifecycle policy with the current Idris-backed header profile
and capability ledger. Source-bound evidence for the earlier snapshot remains
in verification/receipts/lifecycle-20261124. Fresh integrated lifecycle proofs,
native consumers, ledger and rejecting mutations passed and are recorded in
verification/receipts/lifecycle-20261125, bound to signed source `8da3131`.
The hosted package build and critical security suite passed at the integration
parent; repaired property tests and current-head gates remain required before
merge. Broader ABI exports and correspondence/ownership obligations remain open. See
link:docs/adr/2026-11-25-lifecycle-integration.adoc[the integration decision].
== Vision

proven aims to be the **definitive verified safety library** across all programming ecosystems, providing:
Expand Down
11 changes: 6 additions & 5 deletions bindings/c/include/proven-abi.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ proven_datetime_days_in_month owed - -
proven_datetime_format_iso8601 owed - -
proven_datetime_is_leap_year owed - -
proven_datetime_parse owed - -
proven_deinit owed - -
proven_deinit exported idris-refc void(void); full lifecycle profile; standalone/header-only stays stopped
proven_digest_parse owed - -
proven_digest_to_string owed - -
proven_digest_verify owed - -
Expand All @@ -96,7 +96,6 @@ proven_graph_free owed - -
proven_graph_has_edge owed - -
proven_header_build_csp owed - -
proven_header_build_hsts owed - -
proven_header_codegen_main undeclared idris-refc RefC program main renamed by -Dmain; not an API; should not be exported
proven_header_has_crlf exported idris-refc -
proven_header_is_dangerous owed - -
proven_header_is_valid_name owed - -
Expand All @@ -107,11 +106,11 @@ proven_hex_free owed - -
proven_http_parse_www_authenticate owed - -
proven_http_url_decode owed - -
proven_http_url_encode owed - -
proven_init conflict zig-legacy header int32_t(void); export ?*Handle(void)
proven_is_initialized conflict zig-legacy header bool(void); export u32(?*Handle)
proven_init exported idris-refc int32_t(void); full lifecycle profile; standalone/header-only returns -99
proven_is_initialized exported idris-refc bool(void); full lifecycle profile; standalone/header-only returns false
proven_json_get_type owed - -
proven_json_is_valid owed - -
proven_last_error undeclared zig-legacy -
proven_last_error exported zig-legacy const char*(void); borrowed static storage; caller must not free
proven_lru_create owed - -
proven_lru_free owed - -
proven_lru_get owed - -
Expand Down Expand Up @@ -192,3 +191,5 @@ proven_version_major exported zig-legacy -
proven_version_minor exported zig-legacy -
proven_version_parse owed - -
proven_version_patch exported zig-legacy -
proven_handle_create undeclared zig-legacy Renamed legacy handle constructor; not canonical lifecycle
proven_handle_is_initialized undeclared zig-legacy Renamed legacy handle query; not canonical lifecycle
27 changes: 18 additions & 9 deletions bindings/c/include/proven.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@

/**
* @file proven.h
* @brief Proven FFI - Complete C header for libproven
* @brief Proven FFI - Intended C contract for libproven
*
* This is the single, complete header file declaring all exported functions
* from libproven. The library is implemented in Idris 2 (formally verified)
* with a Zig FFI bridge exposing a stable C ABI. Link against libproven.so
* or libproven.a to use these functions.
* This header declares the intended surface; many functions are not yet
* exported by the current library. Symbol, type and behavioral validation
* against the exact artifact is required. See the native ABI contract report.
*
* All computation is performed in verified Idris 2 code; this header is a
* thin, type-safe declaration layer. Do NOT reimplement any logic in C.
* The lifecycle adapter calls Idris through RefC. Other existing Zig operations
* still have provenance/proof gaps. Declarations alone establish no proof.
*
* Memory management rules:
* - ProvenStringResult.value must be freed with proven_free_string()
Expand Down Expand Up @@ -57,6 +56,7 @@ extern "C" {

/** Library version string */
#define PROVEN_VERSION_STRING "0.9.0"
#define PROVEN_FFI_ABI_VERSION 2

/** Total number of modules in the library */
#define PROVEN_MODULE_COUNT 41
Expand Down Expand Up @@ -129,10 +129,12 @@ void proven_free_string(char* ptr);
* ============================================================================ */

/**
* @brief Initialize the Proven runtime (includes Idris 2 runtime).
* @brief Initialize the supported native Idris call path.
* @return PROVEN_OK on success, error code otherwise.
*
* Must be called before any other Proven function. Safe to call multiple times.
* Safe to call multiple times. A standalone build returns NOT_IMPLEMENTED and
* remains uninitialized. Success does not promise every declared API exists.
* ABI 2 corrects the old Zig handle-returning export to this status contract.
*/
int32_t proven_init(void);

Expand All @@ -150,6 +152,13 @@ void proven_deinit(void);
*/
bool proven_is_initialized(void);

/**
* @brief Borrow this thread's last error text, or NULL.
* Static immutable storage: do not pass this pointer to proven_free_string().
* A later call can change which message this function returns.
*/
const char* proven_last_error(void);

/* ============================================================================
* Version Information (4 functions)
* ============================================================================ */
Expand Down
62 changes: 62 additions & 0 deletions docs/adr/2026-11-25-lifecycle-integration.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// SPDX-License-Identifier: CC-BY-SA-4.0
// Copyright (c) 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
= Lifecycle integration with the qualified header boundary

Status: implementation prepared; integrated-source validation pending.

The merge preserves the current main branch's exact-byte Idris header kernel,
compiler-SDK bridge, isolated RefC producer and C capability ledger. The older
lifecycle source remains published at e7a0aa8a46601df22f0853c28ec26424a3874321;
its receipts and Mathesis registration describe that historical source only.
They do not certify the merged implementation.

Lifecycle policy remains `Proven.ABI.Lifecycle.lifecycleCommand`. The full FFI
code-generation root retains both header and lifecycle functions. Its Zig
adapter uses the pinned public compiler SDK's Bits64 constructors, trampoline,
tagged result and reference-release functions. It serializes calls under one
mutex. Generated functions consume the input reference; the returned reference
is released once. Pointer validity, compiler correctness, allocator behavior and
general ownership refinement remain trusted or unproved boundaries. The private
bridge remains pinned for historical/dedicated nonce tests, but is not required
by either production build entry point or the public lifecycle CI job.

The full profile provides the no-argument status/void/bool lifecycle ABI. The
standalone and header-only profiles export the same signatures and refuse init
with -99; readiness remains false. Legacy handle construction/query have separate
names. ABI version2 distinguishes this correction from the incompatible legacy
signatures. Error strings are borrowed static storage, not leaked allocations.
The compiler-generated program entry is renamed outside the public `proven_`
namespace; it is not part of the C API. The existing ledger is updated with these
real exports and keeps every unimplemented operation explicitly owed.

The required integration gate follows main's capability-ledger decision: it
checks every target-header and actual-library symbol against its declared
status, plus real typed lifecycle/header consumers. It does not claim that all
Rustler APIs are implemented. The independent complete-NIF checker remains
fail-closed and retains rejecting regression controls; complete NIF availability
is still a release obligation. No dummy export or fabricated implementation is
introduced to satisfy that broader gate.

Validation must recheck total production lifecycle proofs and both forged-proof
controls; regenerate the combined RefC package; exercise static/shared C and
Rust callers, concurrency, standalone refusal and an actual generated-result
mutant; preserve the exhaustive header byte corpus and its own mutant; and
verify the current ledger against the real artifacts. Public-SDK decoding adds
null/immediate/wrong-tag result controls. C regression refactoring preserves
all lifecycle assertions while splitting sequential and concurrent checks.

Legacy A2ML is retained from main without new edits. Earlier remediation
rationale remains in docs/remediation and the immutable publication history;
new decisions belong here and in ROADMAP.adoc. No new whole-library proof or
package build success is claimed before its commands pass.

The initial integrated native run passed the production proofs, both negative
proof controls, 1,033 assertions, combined RefC generation, both libraries and
17 Zig tests, then exposed a ledger-checker defect: GNU nm -D may return success
with no symbols for static archives. The checker now selects archive symbols
only for ar-readable archives and dynamic symbols for shared libraries. New
regressions exercise each fixture in both forms and reject hidden shared symbols.
The typed error-string export is classified as exported/zig-legacy, matching
its header and borrowed-storage implementation. The SDK decoder rejects bad
alignment before touching a header and uses the compiler SDK payload accessor;
arbitrary aligned-pointer validity remains an explicit assumption.
Loading
Loading