ci(ahbg): repair one-shot regeneration verification #2
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: ahbg-corpus-regenerate-once | |
| on: | |
| push: | |
| branches: | |
| - fix/ahbg-war-v3-canonical | |
| paths: | |
| - .github/workflows/ahbg-corpus-regenerate.yml | |
| permissions: | |
| contents: write | |
| jobs: | |
| regenerate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Repair transformed runner and verify corpus identity | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| python - <<'PY' | |
| import hashlib | |
| import json | |
| from pathlib import Path | |
| corpus_path = Path("ahbg/deepseek/corpus-proposal/corpus.json") | |
| corpus_raw = corpus_path.read_bytes() | |
| corpus = json.loads(corpus_raw) | |
| expected_authority = "UCNS mobius_seed band centers (libs/ucns/src/ucns/mobius_seed.py)" | |
| if corpus.get("board", {}).get("authority") != expected_authority: | |
| raise SystemExit("corpus board authority is not canonical libs/ucns") | |
| digest = hashlib.sha256(corpus_raw).hexdigest() | |
| sidecar = Path("ahbg/deepseek/corpus-proposal/CORPUS.sha256").read_text(encoding="utf-8").strip() | |
| if sidecar != digest: | |
| raise SystemExit(f"corpus sidecar mismatch: {sidecar} != {digest}") | |
| runner_path = Path("ahbg/grok/run_common_corpus.py") | |
| runner = runner_path.read_text(encoding="utf-8") | |
| if f'CORPUS_FILE_SHA256 = "{digest}"' not in runner: | |
| raise SystemExit("runner corpus digest constant is stale") | |
| bad = ''' "- This is a post-freeze common-corpus execution against the exact committed runner identity recorded above. | |
| - Baseline reciprocal-review freeze remains `cce9cec`; current war_v3 code intentionally diverges from it.",''' | |
| good = ''' "- This is a post-freeze common-corpus execution against the exact committed runner identity recorded above.", | |
| "- Baseline reciprocal-review freeze remains `cce9cec`; current war_v3 code intentionally diverges from it.",''' | |
| if bad in runner: | |
| runner = runner.replace(bad, good, 1) | |
| runner = runner.replace( | |
| ' "executed_build_sha": _current_git_value("rev-parse", "HEAD"),\n "baseline_freeze_sha": BASELINE_FREEZE_SHA,', | |
| ' "executed_build_sha": _current_git_value("rev-parse", "HEAD"),\n "baseline_freeze_sha": BASELINE_FREEZE_SHA,', | |
| ) | |
| runner_path.write_text(runner, encoding="utf-8") | |
| PY | |
| python -m py_compile ahbg/grok/run_common_corpus.py | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add ahbg/grok/run_common_corpus.py | |
| if ! git diff --cached --quiet; then | |
| git commit -m "fix(ahbg): repair corpus runner regeneration syntax" | |
| git push origin HEAD:fix/ahbg-war-v3-canonical | |
| fi | |
| - name: Verify and regenerate evidence from committed source | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| test -z "$(git status --porcelain)" | |
| cd ahbg/grok | |
| python -m unittest discover -s a0/tests -p 'test*.py' | |
| python -m unittest discover -s ahbg/tests -p 'test*.py' | |
| python -m unittest discover -s tests -p 'test*.py' | |
| python run.py | |
| python run_common_corpus.py | |
| python - <<'PY' | |
| import json | |
| from pathlib import Path | |
| result = json.loads(Path("corpus-run/calibration-family-1.0.1-proposal-1/CALIBRATION_RESULT.json").read_text(encoding="utf-8")) | |
| expected = {"survived": 35, "falsified": 0, "unresolved": 0, "blocked": 0} | |
| if result.get("summary") != expected: | |
| raise SystemExit(f"corpus standing not clean: {result.get('summary')!r}") | |
| if len(result.get("results", [])) != 35 or not all(row.get("replay_equal") is True for row in result["results"]): | |
| raise SystemExit("corpus replay/count gate failed") | |
| PY | |
| cd ../.. | |
| git add ahbg/grok/CALIBRATION_RESULT.json \ | |
| ahbg/grok/EVENTS.jsonl \ | |
| ahbg/grok/artifacts \ | |
| ahbg/grok/corpus-run/calibration-family-1.0.1-proposal-1 | |
| if ! git diff --cached --quiet; then | |
| git commit -m "chore(ahbg): regenerate evidence from committed war_v3 source" | |
| git push origin HEAD:fix/ahbg-war-v3-canonical | |
| fi |