Skip to content
Draft
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
71 changes: 71 additions & 0 deletions .github/workflows/flash-magma-flag-causal-20261104.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Flash magma causal screen — five fast-path flags off

on:
pull_request:
branches:
- flash
workflow_dispatch:

permissions:
contents: read

jobs:
memory-and-completeness-screen:
runs-on: ubuntu-24.04
timeout-minutes: 45
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: -C target-cpu=native
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Build matched published baseline and all-flags-off diagnostic
run: |
set -euo pipefail
git rev-parse HEAD
git worktree add --detach /tmp/magma-published 78c7502bac8a5ba000057b3f083bc0595ac65750
cargo build --manifest-path /tmp/magma-published/Cargo.toml --release --locked
cargo build --manifest-path Cargo.toml --release --locked
mkdir -p /tmp/magma-screen
sha256sum /tmp/magma-published/target/release/sokonanoda target/release/sokonanoda | tee /tmp/magma-screen/binaries.sha256
git diff 78c7502bac8a5ba000057b3f083bc0595ac65750 -- src/flash.rs | tee /tmp/magma-screen/flag-diff.patch

- name: Fetch official source-pinned Arena magma fixtures
run: |
set -euo pipefail
curl --fail --location --silent --show-error --retry 3 --max-time 120 \
https://arena.lean-lang.org/lean-arena-tests.tar.gz \
--output /tmp/magma-screen/lean-arena-tests.tar.gz
printf '%s %s\n' 8223cb53aa5fa65f471054fbdf8cdcf50206556cfc7888f75e910f7816f4c8bb /tmp/magma-screen/lean-arena-tests.tar.gz | sha256sum -c -
mkdir -p /tmp/magma-screen/tests
tar -xzf /tmp/magma-screen/lean-arena-tests.tar.gz -C /tmp/magma-screen/tests
find /tmp/magma-screen/tests -name 'magma-list-pair-n*.ndjson' -print

- name: Execute two-arm source-pinned small and large magma screen
run: |
set -euo pipefail
printf '{"use_stdin":true,"nat_extension":true,"string_extension":true,"unpermitted_axiom_hard_error":false,"unsafe_permit_all_axioms":true,"num_threads":2}\n' > /tmp/magma-screen/config.json
python3 experiments/flash-magma-flag-causal-20261104/screen.py \
--published /tmp/magma-published/target/release/sokonanoda \
--all-off "$PWD/target/release/sokonanoda" \
--config /tmp/magma-screen/config.json \
--fixtures /tmp/magma-screen/tests \
--archive /tmp/magma-screen/lean-arena-tests.tar.gz \
--output /tmp/magma-screen/results

- name: Preserve causal report including failed and incomplete runs
if: always()
uses: actions/upload-artifact@v4
with:
name: flash-magma-five-flags-off-${{ github.sha }}
if-no-files-found: warn
path: |
/tmp/magma-screen/binaries.sha256
/tmp/magma-screen/flag-diff.patch
/tmp/magma-screen/config.json
/tmp/magma-screen/results/*.json
/tmp/magma-screen/results/*.time
/tmp/magma-screen/results/*.stderr
/tmp/magma-screen/results/*.stdout
93 changes: 93 additions & 0 deletions experiments/flash-magma-flag-causal-20261104/screen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
"""A bounded causal screen for the 2026-11-04 Flash high-memory magma residual.

Compares the published checker against the same source with five fast-path
switches disabled. This does not establish correctness on the rest of Arena.
"""
import argparse
import hashlib
import json
from pathlib import Path
import subprocess
import time

TARGET_SHA256 = "b8279fa9189a203c6c11b04702c27c0f99a650b37f2b0165dd260b1d14e9ef84"

def digest(path):
h = hashlib.sha256()
with path.open("rb") as source:
for b in iter(lambda: source.read(4 * 1024 * 1024), b""):
h.update(b)
return h.hexdigest()

def trial(binary, config, fixture, output, arm, tag, seconds):
stem = output / (arm + "-" + tag)
so, se, ti = [Path(str(stem) + x) for x in (".stdout", ".stderr", ".time")]
ret = {"arm": arm, "case": tag, "fixture_sha256": digest(fixture),
"binary_sha256": digest(binary)}
start = time.monotonic()
try:
with fixture.open("rb") as f, so.open("wb") as stdout, se.open("wb") as stderr:
p = subprocess.run(["/usr/bin/time", "-f",
"wall_s=%e\ncpu_user_s=%U\ncpu_system_s=%S\nrss_kb=%M",
"-o", str(ti), str(binary), str(config)],
stdin=f, stdout=stdout, stderr=stderr, check=False, timeout=seconds)
ret["rc"] = p.returncode
except subprocess.TimeoutExpired:
ret["rc"] = "TIMEOUT"
ret["elapsed_s"] = round(time.monotonic() - start, 2)
for k, val in (line.split("=", 1) for line in ti.read_text().splitlines()
if "=" in line) if ti.exists() else []:
ret[k] = float(val)
ret["stderr_tail"] = se.read_bytes()[-800:].decode(errors="replace") if se.exists() else ""
return ret

def main():
ap = argparse.ArgumentParser()
ap.add_argument("--published", type=Path, required=True)
ap.add_argument("--all-off", type=Path, required=True)
ap.add_argument("--config", type=Path, required=True)
ap.add_argument("--fixtures", type=Path, required=True)
ap.add_argument("--archive", type=Path, required=True)
ap.add_argument("--output", type=Path, required=True)
args = ap.parse_args()
args.output.mkdir(parents=True, exist_ok=True)
files = {}
for tag in ("magma-list-pair-n7", "magma-list-pair-n21"):
matches = list(args.fixtures.rglob(tag + ".ndjson"))
if len(matches) != 1:
raise SystemExit("fixture inventory incomplete for " + tag)
files[tag] = matches[0]
if digest(files["magma-list-pair-n21"]) != TARGET_SHA256:
raise SystemExit("magma n21 source SHA drift (stop, do not guess)")
report = {
"status": "INCOMPLETE", "published": digest(args.published),
"all_flags_off": digest(args.all_off), "archive_sha256": digest(args.archive),
"target_sha256": TARGET_SHA256,
"hypothesis": "Five published Flash fast-path flags may cause magma n21 memory/completeness regression",
"method": "same runner, binary compiled with matching flags; B/A matched inputs; protected full regression not attempted",
"runs": [],
}
out = args.output / "magma-causal.json"
out.write_text(json.dumps(report, indent=2) + "\n")
for index, (arm, tag) in enumerate([
("published", "magma-list-pair-n7"),
("all_off", "magma-list-pair-n7"),
("all_off", "magma-list-pair-n21"),
("published", "magma-list-pair-n21"),
]):
print("MAGMA_START", json.dumps({"index": index, "arm": arm, "case": tag}), flush=True)
result = trial(args.published if arm == "published" else args.all_off,
args.config, files[tag], args.output, arm, tag, 230)
report["runs"].append(result)
out.write_text(json.dumps(report, indent=2) + "\n")
print("MAGMA_RESULT", json.dumps(result), flush=True)
changed = [r for r in report["runs"] if r["case"] == "magma-list-pair-n21"]
report["status"] = "OBSERVED_BOUNDED_CAUSAL_SCREEN" if len(changed) == 2 else "INCOMPLETE"
if len(changed) == 2:
report["all_off_accepts_n21"] = changed[0]["rc"] == 0
report["published_accepts_n21"] = changed[1]["rc"] == 0
out.write_text(json.dumps(report, indent=2) + "\n")
print("MAGMA_SUMMARY", json.dumps(report), flush=True)

if __name__ == "__main__":
main()
14 changes: 8 additions & 6 deletions src/flash.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// @generated by experiments/flash_controller_v1.py
// Flash 1 RC1: frozen composition candidate. Qualification must precede Arena promotion.
// Diagnostic only: ablate the five promoted Flash flags together to test the
// magma-list-pair-n21 false REJECT / high-memory causal hypothesis.
// Not a release; never promotes an ACCEPT without all protected regressions.

pub(crate) const DIRECT_VAR_EVAL: bool = true;
pub(crate) const DIRECT_FRAMED_PRUNE: bool = true;
pub(crate) const DIRECT_VAR_EVAL: bool = false;
pub(crate) const DIRECT_FRAMED_PRUNE: bool = false;
pub(crate) const ORDINARY_UNFOLD_NEUTRAL: bool = false;
pub(crate) const INFER_PI_DEMAND_BYPASS: bool = true;
pub(crate) const RIGID_INDUCTIVE_NEUTRAL: bool = true;
pub(crate) const APP_HC_PREALLOC: bool = true;
pub(crate) const INFER_PI_DEMAND_BYPASS: bool = false;
pub(crate) const RIGID_INDUCTIVE_NEUTRAL: bool = false;
pub(crate) const APP_HC_PREALLOC: bool = false;

pub(crate) const PROMOTED_CAPABILITY_IDS: &[&str] = &[
"direct_framed_prune",
Expand Down
Loading