diff --git a/.github/workflows/actions.lock b/.github/workflows/actions.lock index 38f208b8..30896236 100644 --- a/.github/workflows/actions.lock +++ b/.github/workflows/actions.lock @@ -54,6 +54,8 @@ workflows: - 'actions/upload-artifact@v7.0.2' - 'dtolnay/rust-toolchain@v1' - 'swatinem/rust-cache@v2.9.3' + '.github/workflows/proven-lock-gate.yml': + - 'actions/checkout@v7.0.1' '.github/workflows/push-email-notify.yml': - 'hyperpolymath/smtp-notify-action@v0.5.1' - 'step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a' diff --git a/.github/workflows/proven-lock-gate.yml b/.github/workflows/proven-lock-gate.yml new file mode 100644 index 00000000..178cf226 --- /dev/null +++ b/.github/workflows/proven-lock-gate.yml @@ -0,0 +1,120 @@ +# SPDX-License-Identifier: MPL-2.0 +# proven-cicd: proven-lock-gate@0.3.2 sha256:07266ed730561719a7a1f6ac8859b49d1d126d45bcd8390cfaecc9f289789069 +# Stamped copy of hyperpolymath/proven-cicd-and-workflows templates/proven-lock-gate.yml. +# Do not edit by hand. A changed body fails this gate as drift. The applier +# moves the pinned suite SHA. The line after each `proven-cicd:local-next` +# marker is local and outside the stamp's hash. +# +# The gate judges this repository's actions.lock against its workflows with the +# proven lock kernel. It exits 0 for consistent, 1 for a defect or drift, and 2 +# when it could not run. A run that could not run fails this job: it is never +# skipped and never continue-on-error, so a required check cannot pass without +# a verdict. Every way the gate can fail before its verdict has its own class: +# not_run:pin PROVEN_SHA is not a 40-hex commit +# not_run:identity the suite repository is not the one this gate pins +# (repository id 1326697643 owned by account id 6759885, +# hyperpolymath, after following a rename), it moved to +# another owner, or the name no longer exists: refer, +# never re-run +# not_run:identity-unreadable the repository or owner id could not be read +# (API outage or rate limit): a re-run +# not_run:fetch-missing the pinned commit does not exist in the suite (persistent) +# not_run:fetch the suite could not be fetched after retries (transient) +# not_run:checkout the fetched commit could not be checked out +# not_run:suite-behind the pinned suite is older than this copy: its manifest +# lists an earlier proven-lock-gate (or none). Fix: move +# PROVEN_SHA to a commit whose proven/manifest.json lists +# at least this copy's version +# not_run:suite the checkout is not the pinned commit, is modified, or +# lacks a file or directory the gate runs +# and the suite's own script adds drift, toolchain, build, selftest, extract and +# verdict. The Idris2 RefC runtime is vendored in the suite (dist/), so the build +# needs no network and has no class of its own for a third-party host. +name: Proven lock gate +on: + pull_request: + push: + branches: [main] +permissions: + contents: read +jobs: + proven-lock: + name: Proven lock gate + runs-on: ubuntu-24.04 + timeout-minutes: 15 + steps: + # proven-cicd:local-next + - uses: actions/checkout@v7.0.1 + with: + persist-credentials: false + - name: Judge actions.lock with the proven suite at its pinned commit + env: + # proven-cicd:local-next + PROVEN_SHA: "50a443f01b1b85e4957b893a6f1a0ed2e8a52459" + GH_TOKEN: ${{ github.token }} + run: | + set -euo pipefail + fail() { echo "PROVEN_LOCK_CLASS=not_run:$1"; [[ -z ${2:-} ]] || echo "$2" >&2; exit 2; } + [[ $PROVEN_SHA =~ ^[0-9a-f]{40}$ ]] || fail pin + repo=hyperpolymath/proven-cicd-and-workflows + # The suite is pinned by commit; the id pins the repository itself, so a + # recreated repository under the same name is refused. A transfer keeps + # the repository id and GitHub redirects the old name to it, so the + # owner id is pinned as well: a transferred repository is refused, and a + # rename within the owner (same repository id, same owner id) passes. + # Two classes: an id that cannot be read is an availability failure (a + # re-run); an id that differs is a different repository (refer). + # A rename answers 301: follow it (-L) and judge the id it leads to. + # The request and every redirect are HTTPS only (--proto, --proto-redir), + # so a redirect cannot carry the token over plain HTTP. A name that no + # longer exists (404, 410) is permanent, so it is identity; any other + # non-200 (403, 429, 5xx) is availability, a re-run. + code=$(curl -sS -L --proto '=https' --proto-redir '=https' --retry 3 -o "$RUNNER_TEMP/proven-repo.json" -w '%{http_code}' \ + -H "Authorization: Bearer $GH_TOKEN" "https://api.github.com/repos/$repo") || + fail identity-unreadable "could not reach the API for $repo" + case $code in + 200) ;; + 404|410) fail identity "$repo does not exist (HTTP $code)" ;; + *) fail identity-unreadable "the API answered HTTP $code for $repo" ;; + esac + id=$(jq -r '.id // empty' "$RUNNER_TEMP/proven-repo.json" 2>/dev/null) || fail identity-unreadable "the reply for $repo is not JSON" + [[ $id =~ ^[0-9]+$ ]] || fail identity-unreadable "the reply for $repo has no id" + [[ $id == 1326697643 ]] || fail identity "$repo has id '$id', not 1326697643" + owner=$(jq -r '.owner.id // empty' "$RUNNER_TEMP/proven-repo.json" 2>/dev/null) || fail identity-unreadable "the reply for $repo has a malformed owner" + [[ $owner =~ ^[0-9]+$ ]] || fail identity-unreadable "the reply for $repo has no owner id" + [[ $owner == 6759885 ]] || + fail identity "$repo (id $id) is owned by account $owner ($(jq -r '.owner.login // "?"' "$RUNNER_TEMP/proven-repo.json" 2>/dev/null)), not 6759885 (hyperpolymath): a transfer" + suite="$RUNNER_TEMP/proven-suite" + git init -q "$suite" + git -C "$suite" remote add origin "https://github.com/$repo.git" + git -C "$suite" config core.sparseCheckout true + printf '%s\n' dist/ scripts/ tests/fixtures/proven-lock/ /proven/manifest.json > "$suite/.git/info/sparse-checkout" + fetched=0 + for delay in 0 10 30; do + sleep "$delay" + if git -C "$suite" fetch -q --depth=1 origin "$PROVEN_SHA" 2>"$RUNNER_TEMP/proven-fetch.err"; then fetched=1; break; fi + # A commit the server does not have will not appear on a retry. + if grep -qiE "not our ref|couldn't find remote ref|unadvertised object|no such remote ref" "$RUNNER_TEMP/proven-fetch.err"; then + fail fetch-missing "$(cat "$RUNNER_TEMP/proven-fetch.err")" + fi + done + [[ $fetched == 1 ]] || fail fetch "$(cat "$RUNNER_TEMP/proven-fetch.err")" + git -C "$suite" checkout -q --detach FETCH_HEAD || fail checkout + [[ $(git -C "$suite" rev-parse HEAD) == "$PROVEN_SHA" ]] || fail suite "checked out $(git -C "$suite" rev-parse HEAD), not $PROVEN_SHA" + [[ -z $(git -C "$suite" status --porcelain) ]] || fail suite "the suite checkout is modified" + # This copy needs a suite at least as new as itself (0.3.0 needs the + # vendored runtime): a pin older than the copy is its own class, so the + # fix is plain (move the pin), not a generic refusal. + mine=$(sed -n '1,2s/^# proven-cicd: proven-lock-gate@\([0-9]*\.[0-9]*\.[0-9]*\) .*/\1/p' "$GITHUB_WORKSPACE/.github/workflows/proven-lock-gate.yml") + [[ -n $mine ]] || fail suite "this copy has no proven-lock-gate stamp" + theirs=$(jq -r '[.artifacts[] | select(.artifact == "proven-lock-gate") | .version][0] // empty' "$suite/proven/manifest.json" 2>/dev/null || true) + [[ -n $theirs && $(printf '%s\n' "$theirs" "$mine" | sort -V | head -n 1) == "$mine" ]] || + fail suite-behind "the suite at $PROVEN_SHA lists proven-lock-gate ${theirs:-nothing}, older than this copy's $mine; move PROVEN_SHA" + for f in scripts/proven-lock-gate.sh scripts/proven-stamp.sh scripts/build-proven-lock.sh \ + scripts/extract-lock-facts.sh dist/proven-lock/proven-lock-verdict.c; do + [[ -f $suite/$f ]] || fail suite "the suite at $PROVEN_SHA lacks $f" + done + for d in dist/proven-lock/runtime/refc dist/proven-lock/runtime/c tests/fixtures/proven-lock; do + [[ -d $suite/$d ]] || fail suite "the suite at $PROVEN_SHA lacks $d/" + done + bash "$suite/scripts/proven-lock-gate.sh" "$GITHUB_WORKSPACE" .github/workflows/proven-lock-gate.yml diff --git a/.proven.toml b/.proven.toml new file mode 100644 index 00000000..73ee47cf --- /dev/null +++ b/.proven.toml @@ -0,0 +1,49 @@ +# SPDX-License-Identifier: MPL-2.0 +# Manifest for the proven umbrella gate (schema proven/manifest/v1), drafted against +# proven-cicd-and-workflows#168. Repo-local content only: reasons, waivers, commands. +schema = "proven/manifest/v1" + +# Rust: `just test` / `just build` cover robot-repo-automaton (the Justfile recipes); +# the other crates (shared-context, bots/*) are on the later list for the umbrella's +# multi-root support and are not claimed here. + +# Shell sweep 1 (tests/sweep1/*.sweep1.test.sh) needs the proven-tests kit (PTB_LIB, pinned in +# .proven/KIT_PIN). The umbrella does not provide the kit yet, so these are visible, expiring +# waivers, not N/A and not a pass. +[categories.smoke.shell.waiver] +reason = "tests/sweep1 needs the proven-tests kit at .proven/KIT_PIN; the umbrella does not fetch it yet" +until = "2026-12-10" +[categories.p2p.shell.waiver] +reason = "as smoke: tests/sweep1 needs the kit; the umbrella does not fetch it yet" +until = "2026-12-10" + +# Rust smoke and P2P: no smoke/p2p test targets exist under the default root (dashboard); the +# P2P tests live in shared-context/tests/property_tests.rs (another root). Visible waivers. +[categories.smoke.rust.waiver] +reason = "no cargo smoke target at the default root; smoke is shell (tests/sweep1) and is waived above" +until = "2026-12-10" +[categories.p2p.rust.waiver] +reason = "P2P tests are shared-context/tests/property_tests.rs, a second Rust root the manifest cannot yet address" +until = "2026-12-10" + +# Shell unit: tests/*-test.sh have not been validated one by one on a runner; none is claimed yet. +[categories.unit.shell.waiver] +reason = "tests/*-test.sh not yet validated on a runner; a Rust unit job covers robot-repo-automaton" +until = "2026-12-10" + +# Shell build: syntax-check every script (a real check; the shell tests carry a negative control). +[categories.build.shell] +command = "bash -n fleet-coordinator.sh && find scripts tests -name '*.sh' -print0 | xargs -0 -n1 bash -n" + +[languages.ignore.agda] +reason = "bots/echidnabot/proofs/agda are echidnabot prover fixtures (inputs the bot checks), not a project of this repo" +[languages.ignore.coq] +reason = "bots/echidnabot/proofs/coq and theory/rocq are echidnabot prover fixtures, including deliberate Admitted stubs, not a project of this repo" +[languages.ignore.lean] +reason = "bots/echidnabot/proofs/lean are echidnabot prover fixtures, including a deliberate sorry stub, not a project of this repo" +[languages.ignore.idris2] +reason = "Idris2 files are bots/echidnabot ABI sources and idris-dependents fixtures; the umbrella cannot provision idris2 in release 0.1" +[languages.ignore.ruby] +reason = "scripts/check-scanner-caller.rb is being ported to Rust in #713; it is one standalone script" +[languages.ignore.elixir] +reason = "scripts/sync-all-parallel.exs is a single standalone script, not a mix project" diff --git a/.proven/KIT_PIN b/.proven/KIT_PIN new file mode 100644 index 00000000..006cf1fc --- /dev/null +++ b/.proven/KIT_PIN @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: MPL-2.0 +# Consumer kit pin: hyperpolymath/proven-tests-and-benches, kit/ (PR #121, draft). +# Full SHA, never a branch. Tests find the kit through PTB_LIB (kit/lib); nothing is vendored. +4d849e992c9d19a86a860a511a175315dddaf83d diff --git a/.proven/coverage.tsv b/.proven/coverage.tsv new file mode 100644 index 00000000..40be7539 --- /dev/null +++ b/.proven/coverage.tsv @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: MPL-2.0 +# Coverage manifest (kit/README.adoc). Sweep 1 only: rows exist for ids a real test covers. Ids with no row are +# missing, not N/A: kit/check-coverage.sh fails closed on them until sweeps 2-4 add rows or written N/A reasons. +# id status language ref +UT covered bash tests/sweep1/fleet-coordinator.sweep1.test.sh +UT covered rust robot-repo-automaton/tests/fixer_tests.rs +SMK covered bash tests/sweep1/fleet-coordinator.sweep1.test.sh +BLD covered bash tests/sweep1/fleet-coordinator.sweep1.test.sh +P2P covered bash tests/sweep1/fleet-coordinator.sweep1.test.sh +P2P covered rust shared-context/tests/property_tests.rs diff --git a/docs/ESTATE-MASTER-SCHEDULE.adoc b/docs/ESTATE-MASTER-SCHEDULE.adoc new file mode 100644 index 00000000..e716bd7f --- /dev/null +++ b/docs/ESTATE-MASTER-SCHEDULE.adoc @@ -0,0 +1,3 @@ +// SPDX-License-Identifier: CC-BY-SA-4.0 += Estate master schedule +The canonical, continuously updated schedule is `docs/ESTATE-MASTER-SCHEDULE.adoc` in https://github.com/hyperpolymath/proven-cicd-and-workflows/blob/f2/proven-umbrella-v0/docs/ESTATE-MASTER-SCHEDULE.adoc[proven-cicd-and-workflows] (on branch `f2/proven-umbrella-v0` until #168 merges; maintained there by F2; see proven-cicd-and-workflows#168). This repository keeps no copy. diff --git a/tests/sweep1/fleet-coordinator.sweep1.test.sh b/tests/sweep1/fleet-coordinator.sweep1.test.sh new file mode 100755 index 00000000..0a8b0746 --- /dev/null +++ b/tests/sweep1/fleet-coordinator.sweep1.test.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: MPL-2.0 +# Sweep 1 (UT, SMK, BLD, P2P) for fleet-coordinator.sh, on the proven-tests kit. +# PTB_LIB must point at kit/lib of proven-tests-and-benches at the SHA in .proven/KIT_PIN. +# Exit 0 pass, 1 fail, 2 nothing ran (no kit, no assertions): absence is not a pass. +here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +root="$(cd "$here/../.." && pwd)" +lib="${PTB_LIB:-}" +[[ -n "$lib" && -f "$lib/ptb.sh" && -x "$lib/smoke.sh" ]] || { + echo "NO CHECK PERFORMED: set PTB_LIB to kit/lib (see .proven/KIT_PIN)" >&2; exit 2; } +. "$lib/ptb.sh" +fc="$root/fleet-coordinator.sh" + +# UT: each public entry, each error branch +ptb_ok UT-help-exits-0 bash "$fc" --help +ptb_eq UT-help-banner "Gitbot Fleet Coordinator" "$(bash "$fc" --help | sed -n 1p | cut -d' ' -f1-3)" +ptb_fails UT-unknown-command-fails bash "$fc" --no-such-command +ptb_eq UT-unknown-command-names-it 1 "$(bash "$fc" --no-such-command 2>&1 | grep -c 'Unknown command: --no-such-command')" +for c in run-scan scan-supervised process-findings status deploy-bots; do + ptb_eq "UT-help-lists-$c" 1 "$(bash "$fc" --help | grep -c "^ $c ")" +done + +# SMK: the entry point starts, answers, exits cleanly +ptb_ok SMK-help "$lib/smoke.sh" --expect '^Gitbot Fleet Coordinator v[0-9]' -- bash "$fc" --help +ptb_ok SMK-status "$lib/smoke.sh" --expect 'Fleet Status' -- bash "$fc" status + +# BLD: a shell entry point builds as syntax-clean and executable-by-bash; negative control included +ptb_ok BLD-syntax-fleet-coordinator bash -n "$fc" +ptb_ok BLD-syntax-all-scripts bash -c 'for f in "$0"/scripts/*.sh; do bash -n "$f" || exit 1; done' "$root" +ptb_fails BLD-negative-control bash -n <(echo 'if then fi') + +# P2P: producer | consumer across one seam (help text -> command inventory), far end real +inv="$(bash "$fc" --help | awk '/^COMMANDS:/{f=1;next} /^$/{f=0} f{print $1}')" +ptb_eq P2P-help-inventory-nonempty 1 "$([[ -n "$inv" ]] && echo 1 || echo 0)" +ptb_eq P2P-inventory-has-status 1 "$(printf '%s\n' "$inv" | grep -cx status)" +ptb_done