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
84 changes: 77 additions & 7 deletions .github/workflows/npm-conformance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ name: npm conformance
#
# A runtime joins by adding its shim to sdk/npm/conformance/runtimes.json and a
# step to the suite job that writes results/<name>.json; `matrix --check` refuses
# a registered runtime with no results.
# a registered runtime with no results. The Rust column (the DK-42 shim) is a
# receipt keyed by the content identity of its inputs: the suite job builds the
# shim only when no main push has measured those inputs. The unit tests that need
# every registered runtime run there; the OS matrix skips those three.

on:
pull_request:
Expand All @@ -22,6 +25,12 @@ on:
- sdk/npm/spec/schemas/verdict/**
- sdk/npm/spec/test/json-schema.mjs
- docs/adr/015-dual-digests.md
# The Rust runtime's shim and what it calls.
- crates/conformance/runtime/**
- crates/conformance/src/bin/prism-conformance-shim.rs
- crates/prismpm/src/inspect/**
- Cargo.lock
- rust-toolchain.toml
- COMPLIANCE.md
- .github/workflows/npm-conformance.yml
push:
Expand All @@ -35,6 +44,12 @@ on:
- sdk/npm/spec/schemas/verdict/**
- sdk/npm/spec/test/json-schema.mjs
- docs/adr/015-dual-digests.md
# The Rust runtime's shim and what it calls.
- crates/conformance/runtime/**
- crates/conformance/src/bin/prism-conformance-shim.rs
- crates/prismpm/src/inspect/**
- Cargo.lock
- rust-toolchain.toml
- COMPLIANCE.md
- .github/workflows/npm-conformance.yml

Expand Down Expand Up @@ -93,21 +108,74 @@ jobs:
rm pack.json

suite:
name: prism-code passes, and COMPLIANCE.md is current
name: prism-code and the Rust shim pass, and COMPLIANCE.md is current
runs-on: ubuntu-24.04
timeout-minutes: 15
timeout-minutes: 30
permissions:
contents: read
# To find and download the Rust receipt of an earlier main push.
actions: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38
with:
node-version: '24'
- name: Run the suite against the JavaScript runtime
# The Rust column is a Factory receipt: results/rust.json keyed by the content identity of everything that
# decides it (the git blob ids of the Rust sources, vendored crates, lockfile, toolchain pin, the suite and this
# workflow). A main push that measured the same identity left it as an artifact, so an unchanged Rust input
# set is never rebuilt. Only receipts from this repository's main pushes are trusted.
- name: Identify the Rust runtime's inputs
id: rust
shell: bash
run: |
set -euo pipefail
kappa=$(git ls-files -s -- crates vendor Cargo.toml Cargo.lock rust-toolchain.toml .cargo sdk/npm/conformance \
.github/workflows/npm-conformance.yml | sha256sum | cut -c1-64)
echo "receipt=conformance-rust-$kappa" >> "$GITHUB_OUTPUT"
- name: Reuse the receipt for those inputs
id: receipt
shell: bash
env:
GH_TOKEN: ${{ github.token }}
NAME: ${{ steps.rust.outputs.receipt }}
run: |
set -euo pipefail
mkdir -p target/conformance/results
run=$(gh api "repos/$GITHUB_REPOSITORY/actions/artifacts?name=$NAME&per_page=20" --jq '[.artifacts[]
| select(.expired == false and .workflow_run.head_branch == "main"
and .workflow_run.head_repository_id == .workflow_run.repository_id)][0].workflow_run.id // empty')
if [ -n "$run" ] && gh run download "$run" -n "$NAME" -D target/conformance/results; then
echo "hit=true" >> "$GITHUB_OUTPUT"
echo "Rust results reused from run $run ($NAME)"
else
echo "hit=false" >> "$GITHUB_OUTPUT"
fi
# rust-toolchain.toml pins the toolchain; rustup installs it on first use.
- name: Build the Rust runtime's shim and run the suite against it
if: steps.receipt.outputs.hit != 'true'
shell: bash
run: |
set -euo pipefail
cargo build --locked -p repo-conformance --bin prism-conformance-shim
node sdk/npm/conformance/bin/prism-conformance.mjs run --runtime rust \
--out target/conformance/results/rust.json | tee target/conformance/rust.txt
- name: Keep the Rust results as the receipt for those inputs
if: steps.receipt.outputs.hit != 'true' && github.event_name == 'push'
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ${{ steps.rust.outputs.receipt }}
path: target/conformance/results/rust.json
if-no-files-found: error
retention-days: 90
- name: Unit tests that need every registered runtime
working-directory: sdk/npm/conformance
run: node --test test/matrix.test.mjs
- name: Run the suite against the JavaScript runtime
shell: bash
run: |
set -euo pipefail
node sdk/npm/conformance/bin/prism-conformance.mjs run --runtime js \
--out target/conformance/results/js.json | tee target/conformance/js.txt
- name: Regenerate the matrix from those results
Expand All @@ -127,8 +195,10 @@ jobs:
if [ -f target/conformance/COMPLIANCE.md ]; then
sed -n '/^## Features/,/^## Checks/p' target/conformance/COMPLIANCE.md | sed '$d' >> "$GITHUB_STEP_SUMMARY"
fi
if [ -f target/conformance/js.txt ]; then
tail -n 2 target/conformance/js.txt >> "$GITHUB_STEP_SUMMARY"
fi
for runtime in js rust; do
if [ -f "target/conformance/$runtime.txt" ]; then
tail -n 2 "target/conformance/$runtime.txt" >> "$GITHUB_STEP_SUMMARY"
fi
done
- name: The committed COMPLIANCE.md is the one the suite just generated
run: node sdk/npm/conformance/bin/prism-conformance.mjs matrix --results target/conformance/results --check
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ To move to 1.0, read the [migration guide](docs/site/migration/to-1-0.md).
## [Unreleased]

### Features Added
- `COMPLIANCE.md` shows the Rust runtime (#449, #298): `sdk/npm/conformance/runtimes.json` registers `prism-conformance-shim`, the npm conformance suite job builds it and runs the suite against it beside prism-code, and the matrix shows both runtimes passing all 24 `verify` checks. `prism.verify.pullClosure` makes every trust decision a pull needs, and signing moves to `auth` (`auth.identities.from`), so the pending `auth.mjs` to `attest.mjs` cut in `model/modules.toml` is made; see the prism-code CHANGELOG.
- `prismpm generate <path.holo> --lang <js|python|rust> --out <dir>` (#289, experimental): the Rust CLI writes the same bindings and typed client as `prism-code generate`, byte for byte apart from the generator each file header names, beside the same `prism-generate.json` record, and a run whose record and files are in place writes nothing. Every decision is the LexLean model `bindings/src/Foundation/Bindings/V1`: the new `Source.lex.tex` reads the WIT world and the model document into the code model (the WIT subset, the world's exports and memory, the application's class name, the numeric profile's operations), and `Generate.lex.tex` joins it to the JS, Python and Rust writers. `cargo xtask bindings-package` exports the three roots and vendors them into the crate, so the published `prismpm` carries them and the unpublished `prism-bindings` crate is gone. A holo generate cannot bind is `PP3201`; an output directory holding a file generate did not write is `PP3202`.
- `prismpm verify` writes the proof statement of a verified application (#266, #582): `proof-statement.json` in the verified directory, an unsigned in-toto statement with the predicate `https://uor.foundation/prism/proof/v1`. Its subject is the guest; it lists every theorem of the model with its verdict and axiom audit, the verifier, the model's identities, the named TCB and the evidence digests. The statement is the output of a LexLean model, `bindings/src/Foundation/Proof/V1/Statement.lex.tex`, exported by `cargo xtask bindings-package` into the `prismpm` crate; it writes the calculator statement of `docs/proposals/266-proof-predicate.md` byte for byte. A model with no theorem, or a project with no `prismpm.lock`, gets no statement and a line on stderr that says why. `prism-code attest --statement` signs it into the holo.
- `prismpm verify` names each stage it enters on stderr as `prismpm: stage <name>` when `PRISMPM_PROGRESS` is set (#585): every process it runs (Lean export, Rust, WebAssembly, the acceptance run), the Lean proof and the holo. Without the variable it prints nothing new. The guided journey sets it, so `prism_build` reports the running stage in `latest` instead of one line for the whole build.
Expand Down
Loading
Loading