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
112 changes: 112 additions & 0 deletions .github/workflows/release-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Release source custody and pinned toolchain replay
on:
pull_request:
paths:
- tools/release_snapshot.py
- tools/formal_execution_context.py
- tests/test_release_snapshot.py
- tests/test_formal_execution_context.py
- .github/workflows/release-snapshot.yml
- docs/RELEASE_OPERATIONS.md
workflow_dispatch:
permissions:
contents: read
concurrency:
group: release-snapshot-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: false
jobs:
source-custody:
runs-on: ubuntu-24.04
timeout-minutes: 35
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
persist-credentials: false
- name: Read-only collector controls in both Python modes
run: |
python3 -B -S -m unittest discover -s tests -p test_release_snapshot.py -v
python3 -B -O -S -m unittest discover -s tests -p test_release_snapshot.py -v
python3 -B -S -m unittest discover -s tests -p test_formal_execution_context.py -v
python3 -B -O -S -m unittest discover -s tests -p test_formal_execution_context.py -v
- name: Capture all allowlisted defaults and open PR source heads
env:
GITHUB_TOKEN: ${{ github.token }}
run: python3 -B -S tools/release_snapshot.py --output "$RUNNER_TEMP/release-snapshot"
- name: Preserve source and review snapshots, including partial failures
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: release-source-custody-${{ github.run_id }}
path: ${{ runner.temp }}/release-snapshot/
if-no-files-found: error
include-hidden-files: true
retention-days: 90
primary-toolchain-replay:
runs-on: ubuntu-24.04
timeout-minutes: 30
defaults:
run:
working-directory: primary
env:
LEAN_NUM_THREADS: '2'
steps:
- name: Read source-execution binding tools
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
path: operations
persist-credentials: false
- name: Read the exact merged primary formal project
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
repository: d6g8k5htny-coder/Math-
path: primary
ref: 867d9e34b60186ff46ab5b3ecf8ad5ba6a5cc8b4
persist-credentials: false
- name: Check source and regression controls before installing tools
run: |
python3 -B -S -m unittest discover -s formal/tests -v
python3 -B -O -S -m unittest discover -s formal/tests -v
python3 -B -S formal/gate.py
- uses: leanprover/lean-action@50fcf42d2e460296f1a34b402e990d1b24f8b596
with:
lake-package-directory: primary/formal
auto-config: 'false'
build: 'false'
test: 'false'
lint: 'false'
use-mathlib-cache: 'true'
use-github-cache: 'false'
- name: Rebuild, replay kernel, audit axioms and run false-proof controls
run: python3 -B -S formal/gate.py --execute
- name: Bind source and execution identities without rewriting the raw receipt
run: |
python3 -B -S ../operations/tools/formal_execution_context.py --source . --operations ../operations --expected-commit 867d9e34b60186ff46ab5b3ecf8ad5ba6a5cc8b4 --run-id "$GITHUB_RUN_ID"
- name: Record installed runtime versions and executable hashes
if: always()
shell: bash
run: |
mkdir -p formal/.lake/formal-evidence
{
echo 'Execution location: disposable GitHub-hosted runner, not the owner laptop'
git rev-parse HEAD
python3 --version
git --version
elan --version
cd formal
lake env lean --version
lake --version
for name in lean lake leanchecker; do
resolved="$(lake env which "$name")" || continue
printf '%s: %s\n' "$name" "$resolved"
sha256sum "$resolved"
done
} > formal/.lake/formal-evidence/runner-tools.txt 2>&1
- name: Preserve fresh primary evidence
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: primary-toolchain-evidence-${{ github.run_id }}
path: primary/formal/.lake/formal-evidence/
include-hidden-files: true
if-no-files-found: error
retention-days: 90
81 changes: 81 additions & 0 deletions docs/RELEASE_OPERATIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Release operations and source custody

Owner authorization: Dylan Roy, 27 September 2026. Scientific effect: **NONE**.

The existing [formal-verification guide](FORMAL_VERIFICATION.md), Math- formal
project, and [coordination issue #95](https://github.com/d6g8k5htny-coder/main/issues/95)
remain the integration entry points. This is not another scientific registry,
promotion engine, automatic merger, or scheduled agent loop.

## Download and reproduce

`tools/release_snapshot.py --output <empty-directory>` uses Python 3.11+ and Git.
It reads only the ten explicit public repositories in its allowlist, exhausts API
pagination, and records default commits and open same-repository PR heads. Sources
are archived directly from Git blobs, including export-ignored files; every blob's
Git identity and SHA-256 are checked. Symlinks are archived as link-target bytes,
not followed. Submodule gitlinks are listed, not recursively fetched. No complete
Git history, Git LFS hydration, personal Drive content, model weights, credentials,
or installation on the owner's laptop is implied. API/download failures produce
an explicit partial report and nonzero exit, never an empty successful queue.

`SUMMARY.json`, per-commit manifests and `SHA256SUMS` bind the evidence. A snapshot
is an as-of observation, not a permanently current branch tip. Before extracting
an archive, validate paths and symlinks. Use isolated checkouts for executing code.

The `Release source custody and pinned toolchain replay` Actions workflow runs
on relevant PRs or manual dispatch. It has read-only permissions, immutable action
pins, no persisted checkout credential and no privileged PR trigger. Evidence is
retained for 90 days by the requested artifact policy; download important receipts
for durable custody before expiration. Repository-policy limits can shorten retention.

The separate primary replay job checks out Math- at
`867d9e34b60186ff46ab5b3ecf8ad5ba6a5cc8b4`, installs the existing locked Lean/mathlib
environment, and executes the unchanged source gate, kernel replay, axiom audit
and false-proof controls. Runtime versions and executable hashes are captured.
A workflow definition is not an installation receipt: only an observed successful
run licenses a statement that these tools were installed and executed there.

**Cross-repository receipts:** the unchanged primary gate's `repository` field
records the Actions execution host (`main`), while `checked_commit` belongs to the
checked-out source (`Math-`). Do not pair those fields into a false source URL.
`execution-context.json` separately binds source repository/commit/remote,
execution repository/commit/run and the exact original receipt SHA-256. The binder
checks the live checkout identity and every recorded log hash. Original receipts
are preserved, not rewritten to conceal this distinction. Read the companion
context whenever replay is hosted in a different repository.

## Review and merge

Read the exact diff, full reviews and unresolved threads, current tests and source
bindings. A successful static check is not a fresh Lean execution. An absent check
is not a passing check. Re-fetch the PR immediately before a merge and use
`expected_head_sha`. A changed source or scope stales the corresponding review.
Do not bypass branch protection or simulate another account's approval. The owner
may delegate engineering integration, but delegation does not create independent
review or satisfy a mathematical premise. Record your actual provider/session and
scope; when agents share a GitHub account, a comment must not be represented as an
independent GitHub approval.

Existing mathematical HOLD/AMENDs remain until their own evidence is reviewed.
Close genuinely superseded engineering PRs with successor links and preserved
history, not by merging obsolete code. Resolve parallel proposals by reusing their
useful components under explicit namespaces and source crosswalks rather than
landing competing registries. Do not race an active writer's branch.

## All current and future agents

Coordinate in main #95 and the relevant existing PR, not a parallel dispatch
system. Math- #92 and main #177 established the first merged formal foundation.
Math- #93, main #178, sandbox #3 and trial #160 were separately observed proposals.
Main #178 subsequently merged at `eaf12644bdcbf6176a9e216ffb4ab9304f17de12`
during this audit. Preserve that work and reconcile interfaces rather than
silently replacing it or claiming unobserved review. Trial's 4.19.0 experiment
must not be presented as the primary 4.34.1 toolchain. Keep component evidence,
semantic alignment, source custody, and scientific acceptance separate.

An assignment or notification is OFFERED until a recipient posts a source-bound
pickup/result. Publishing this file does not prove every agent has read it.
Optional Blueprint publishing, external prover weights, additional proof-assistant
backends and an independent checker require their own explicit run receipts; they
are not prerequisites to call an isolated scalar Lean proof kernel-checked.
13 changes: 13 additions & 0 deletions docs/superpowers/plans/2026-09-27-release-snapshot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Release snapshot implementation plan

Goal: reproducible, read-only repository/PR custody and primary toolchain replay.
Architecture: one stdlib collector plus isolated GitHub Actions jobs; existing formal gates retain their scoped evidence roles. No new scientific-status database.
Tech stack: Python 3, Git, GitHub REST GET, existing pinned Lean action.
Spec: ../specs/2026-09-27-release-snapshot.md

1. Write tests for immutable SHA/repo validation, complete pagination, unsafe paths, actual Git blob archive identity, tampering, gitlink exclusion, authenticated redirect refusal and nonempty output discipline. Observe RED, then implement tools/release_snapshot.py and run both Python modes.
2. Add .github/workflows/release-snapshot.yml: tests, snapshot, primary pinned replay, always-save evidence. Record exact runtime identities and failure limitations.
3. Create an isolated integration branch and PR; inspect hosted results. Download artifacts into the active container and verify archive/log digests. Use snapshots to inspect open PR diffs and current reviews, then merge only eligible changes using expected_head_sha.
4. Record every action/blocker in existing main #95 and per-PR conversations; publish permanent agent entry pointers without claiming acknowledgments not observed.

Review focus: pagination truncation, fork/URL substitution, Git attribute exclusions, source drift, unmaterialized gitlinks, missing API access, premature merge eligibility. Each must fail closed or remain explicitly incomplete. Owner preapproval permits inline execution; no subagent independence is represented.
9 changes: 9 additions & 0 deletions docs/superpowers/specs/2026-09-27-release-snapshot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Release snapshot and integration design

Owner: Dylan Roy, explicit autonomous implementation and merge-management request of 2026-09-27. Scientific effect: NONE.

Use the existing main #95 and Math-/formal foundation. Add one read-only, manually reproducible evidence collector, not another formal registry, promotion engine, scheduler or agent loop. It records all ten currently accessible owner repositories, their default commit, every open same-repository PR head, current CI/review evidence, and exact downloadable source snapshots. A snapshot is as-of evidence, never a claim of current tip equality. Archive all tracked blobs at each pinned commit, verify Git blob identities, compute SHA-256 and record gitlinks without traversing them. No credentials enter source archives or reports. Restrict remote reads to the explicit public owner/repository allowlist. API pages must be exhausted or an error recorded; retrieval failure cannot become an empty queue. Snapshot errors produce a nonzero exit and a partial report.

The hosted workflow uses read-only permissions, immutable action refs, no persisted checkout credential and no privileged PR trigger. A separate job installs the existing pinned primary Lean/mathlib environment and replays its unchanged gate at the observed merged Math- commit. Actual execution is the installation evidence. No assertion that Dylan's computer has been installed or that optional research/prover tools were run.

Reconcile overlapping formal proposals by source-bound reviews in their own PRs. Do not modify peer branches, erase historical failures, self-approve or change mathematical verdicts. Merge decisions remain separate, exact-head operations after diff/review/check inspection; source changes stale prior reviews.
49 changes: 49 additions & 0 deletions tests/test_formal_execution_context.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import hashlib, importlib.util, json, pathlib, tempfile, unittest
ROOT=pathlib.Path(__file__).resolve().parents[1]
p=ROOT/'tools/formal_execution_context.py'
s=importlib.util.spec_from_file_location('ctx',p);m=importlib.util.module_from_spec(s)
if p.exists():s.loader.exec_module(m)
class ContextTests(unittest.TestCase):
def setUp(self):
self.tmp=tempfile.TemporaryDirectory();self.addCleanup(self.tmp.cleanup);self.root=pathlib.Path(self.tmp.name)
self.sha='a'*40; (self.root/'build.log').write_bytes(b'actual log\n')
self.receipt={'repository':'d6g8k5htny-coder/main','checked_commit':self.sha,'workflow_run_id':'123', 'formalization_status':'kernel-checked','scientific_effect':'NONE','logs':{'build.log':hashlib.sha256(b'actual log\n').hexdigest()}}
self.write()
self.kw={'source_repository':'d6g8k5htny-coder/Math-','expected_commit':self.sha,'observed_commit':self.sha,'observed_remote':'https://github.com/d6g8k5htny-coder/Math-','execution_repository':'d6g8k5htny-coder/main','execution_commit':'b'*40,'run_id':'123'}
def write(self): (self.root/'receipt.json').write_text(json.dumps(self.receipt))
def bind(self):return m.bind(self.root/'receipt.json',**self.kw)
def test_distinct_source_and_execution_binding(self):
self.assertTrue(hasattr(m,'bind'),'cross-repository context binder is missing')
r=self.bind();self.assertEqual(r['source']['repository'],self.kw['source_repository']);self.assertEqual(r['execution']['repository'],self.kw['execution_repository'])
self.assertNotEqual(r['source']['repository'],r['execution']['repository']);self.assertEqual(r['receipt_repository_field_means'],'execution repository, not source repository')
self.assertEqual(r['receipt_sha256'],hashlib.sha256((self.root/'receipt.json').read_bytes()).hexdigest())
def test_source_commit_mismatch(self):
self.kw['observed_commit']='c'*40
with self.assertRaises(ValueError): self.bind()
def test_receipt_commit_mismatch(self):
self.receipt['checked_commit']='c'*40;self.write()
with self.assertRaises(ValueError): self.bind()
def test_source_remote_mismatch(self):
self.kw['observed_remote']='https://github.com/other/Math-'
with self.assertRaises(ValueError):self.bind()
def test_receipt_host_mismatch(self):
self.receipt['repository']='d6g8k5htny-coder/Math-';self.write()
with self.assertRaises(ValueError):self.bind()
def test_run_mismatch(self):
self.kw['run_id']='124'
with self.assertRaises(ValueError):self.bind()
def test_modified_log(self):
(self.root/'build.log').write_text('modified')
with self.assertRaises(ValueError):self.bind()
def test_log_path_escape(self):
self.receipt['logs']={'../build.log':'f'*64};self.write()
with self.assertRaises(ValueError):self.bind()
def test_kernel_status_is_required(self):
self.receipt['formalization_status']='specified';self.write()
with self.assertRaises(ValueError):self.bind()
def test_git_suffix(self):
self.kw['observed_remote']+=' .git'
with self.assertRaises(ValueError):self.bind()
self.kw['observed_remote']='https://github.com/d6g8k5htny-coder/Math-.git'
self.assertEqual(self.bind()['source']['commit'],self.sha)
if __name__=='__main__': unittest.main()
Loading
Loading