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
109 changes: 109 additions & 0 deletions .github/workflows/third-order-coefficient.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Third-order coefficient controls

'on':
pull_request:
Comment thread
d6g8k5htny-coder marked this conversation as resolved.
paths:
- 'frontiers/third_order_coefficient_20261001/**'
- '.github/workflows/third-order-coefficient.yml'
# merged sources cited in SOURCES.json (cited_only, v1.4.1): a change to any of them re-runs the identity check
- 'frontiers/three_fronts_20260924/LIFETIME_REMAINDER.md'
- 'reviews/side24_v1_coefficient_claude_20260929/RESULTS.json'
- 'coefficients/side24_v1/ENCLOSURE.json'
- 'frontiers/cusp_second_order_20261001/PROOF.md'
- 'frontiers/remainder_vanishing_20260930/PROOF.md'
- 'frontiers/candidate_third_order_20261001/PROOF.md'
- 'frontiers/elder_third_order_20261001/PROOF.md'
- 'frontiers/third_order_rate_20261001/PROOF.md'
- 'frontiers/c2_exact_20261001/NOTE.md'
- 'frontiers/c2_finite_jet_transfer_20261001/PROOF.md'
- 'frontiers/cusp_coefficient_certified_20261001/NOTE.md'
- 'frontiers/far_elder_rate_20260930/PROOF.md'
- 'frontiers/elder_cusp_parity_20261002/PROOF.md'
- 'frontiers/d1_third_order_law_20261001/PROOF.md'
- 'frontiers/candidate_parity_rate_20261001/PROOF.md'
workflow_dispatch:

permissions:
contents: read

jobs:
exact-controls:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
persist-credentials: false
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
with:
python-version: '3.11.16'
- name: Verify sources, replay both modes, reject mutants
env:
PYTHONDONTWRITEBYTECODE: '1'
GH_TOKEN: ${{ github.token }}
GH_REPOSITORY: ${{ github.repository }}
run: |
set -euo pipefail
python -B -S - <<'PY'
import base64, hashlib, json, os, pathlib, subprocess, sys, urllib.parse, urllib.request
root = pathlib.Path('frontiers/third_order_coefficient_20261001').resolve()
manifest = json.loads((root / 'SOURCES.json').read_text())
present = sorted(p.name for p in root.iterdir())
expected_names = sorted([e['path'] for e in manifest['files']] + ['SOURCES.json'])
if present != expected_names:
raise ValueError('packet tree differs from manifest: ' + repr(present))
for entry in manifest['files']:
path = root / entry['path']
if path.is_symlink():
raise ValueError('symlink: ' + entry['path'])
data = path.read_bytes()
if len(data) != entry['bytes'] or hashlib.sha256(data).hexdigest() != entry['sha256']:
raise ValueError('packet file identity mismatch: ' + entry['path'])
for entry in manifest['consumed'] + manifest['cited_only']:
Comment thread
d6g8k5htny-coder marked this conversation as resolved.
data = pathlib.Path(entry['path']).read_bytes()
framed = b'blob ' + str(len(data)).encode() + b'\0' + data
if len(data) != entry['bytes'] or hashlib.sha256(data).hexdigest() != entry['sha256'] or hashlib.sha1(framed).hexdigest() != entry['git_blob']:
raise ValueError('merged source drifted: ' + entry['path'])
if manifest.get('consumed_unmerged'):
raise ValueError('this packet declares no unmerged dependency')
# cited unmerged sources (comparison only) are bound to their recorded commit, path and blob through the
# repository API (v1.2, Codex P2 on v1.1): the recorded head must resolve, the recorded path in that head's tree
# must be a file with the recorded blob id and size, and the blob's bytes must have the recorded sha256
api = 'https://api.github.com/repos/' + os.environ['GH_REPOSITORY']
def get_json(url):
req = urllib.request.Request(url, headers={'Authorization': 'Bearer ' + os.environ['GH_TOKEN'],
'Accept': 'application/vnd.github+json'})
with urllib.request.urlopen(req, timeout=60) as resp:
return json.load(resp)
for entry in manifest.get('cited_unmerged', []):
commit = get_json(api + '/commits/' + entry['head'])
if commit.get('sha') != entry['head']:
raise ValueError('recorded head does not resolve: ' + entry['head'])
node = get_json(api + '/contents/' + urllib.parse.quote(entry['path']) + '?ref=' + entry['head'])
if (node.get('type') != 'file' or node.get('path') != entry['path'] or node.get('sha') != entry['git_blob']
or node.get('size') != entry['bytes']):
raise ValueError('recorded head/path does not map to the recorded blob: ' + entry['path'])
blob = get_json(api + '/git/blobs/' + entry['git_blob'])
if blob.get('encoding') != 'base64':
raise ValueError('unexpected blob encoding for ' + entry['path'])
data = base64.b64decode(blob['content'])
framed = b'blob ' + str(len(data)).encode() + b'\0' + data
if len(data) != entry['bytes'] or hashlib.sha256(data).hexdigest() != entry['sha256'] or hashlib.sha1(framed).hexdigest() != entry['git_blob']:
raise ValueError('cited unmerged source differs from its pinned blob: ' + entry['path'])
print(json.dumps({'cited_unmerged_bound': entry['path'], 'git_blob': entry['git_blob'], 'head': entry['head']}))
script = str(root / 'c2_check.py')
expected = (root / 'RESULTS.json').read_bytes()
for flags in (['-B', '-S'], ['-B', '-O', '-S']):
out = subprocess.run([sys.executable, *flags, script], check=True, capture_output=True, timeout=900).stdout
if out != expected:
raise RuntimeError('output differs from RESULTS.json under ' + ' '.join(flags))
for m in manifest['mutants']:
rc = subprocess.run([sys.executable, *flags, script, '--mutant', m], capture_output=True, timeout=900).returncode
if rc != 1:
raise RuntimeError('mutant ' + m + ' not rejected')
rc = subprocess.run([sys.executable, *flags, script, '--mutant', 'M9'], capture_output=True, timeout=900).returncode
if rc != 2:
raise RuntimeError('unknown mutant label not rejected with exit 2')
print(json.dumps({'scientific_effect': 'NONE', 'mathematical_acceptance': False}))
PY
git diff --exit-code
Loading
Loading