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
97 changes: 97 additions & 0 deletions .github/workflows/side24-periodization-remainder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: SIDE24 periodization remainder checks

'on':
pull_request:
paths:
- 'frontiers/side24_periodization_remainder_20260929/**'
- '.github/workflows/side24-periodization-remainder.yml'
workflow_dispatch:

permissions:
contents: read

jobs:
exact-and-probe:
runs-on: ubuntu-latest
timeout-minutes: 10
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'
run: |
set -euo pipefail
python -B -S - <<'PY'
import hashlib, json, pathlib, subprocess, sys
root = pathlib.Path('frontiers/side24_periodization_remainder_20260929').resolve()
manifest = json.loads((root / 'SOURCE_FILES.json').read_text())
present = sorted(p.name for p in root.iterdir())
expected_names = sorted([e['path'] for e in manifest['files']] + ['SOURCE_FILES.json'])
if present != expected_names:
raise ValueError('packet tree differs from manifest: ' + repr(present))
for entry in manifest['files']:
path = root / entry['path']
if pathlib.PurePosixPath(entry['path']).name != entry['path'] or path.is_symlink():
raise ValueError('flat regular source required: ' + entry['path'])
data = path.read_bytes()
if len(data) != entry['bytes'] or hashlib.sha256(data).hexdigest() != entry['sha256']:
raise ValueError('source identity mismatch: ' + entry['path'])
# consumed sources must be the bytes the note binds to
for entry in manifest['consumed']:
data = pathlib.Path(entry['path']).read_bytes()
if len(data) != entry['bytes'] or hashlib.sha256(data).hexdigest() != entry['sha256']:
raise ValueError('consumed source drifted: ' + entry['path'])
Comment thread
d6g8k5htny-coder marked this conversation as resolved.
Resolved
# This key records the historical input, even after #144 merges.
# Never substitute the checkout's later, corrected #144 proof.
historical = manifest['consumed_unmerged']
required_path = 'frontiers/side24_periodization_20260929/PROOF.md'
if (not isinstance(historical, list) or len(historical) != 1
or historical[0]['path'] != required_path):
raise ValueError('historical #144 dependency is required')
for entry in historical:
commit = entry['commit']
if (not isinstance(commit, str) or len(commit) != 40
or any(c not in '0123456789abcdef' for c in commit)):
raise ValueError('full historical commit SHA required')
exists = subprocess.run(
['git', 'cat-file', '-e', commit + '^{commit}'],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL).returncode == 0
if not exists:
subprocess.run(
['git', 'fetch', '--no-tags', '--depth=1', 'origin', commit],
check=True, timeout=120)
if subprocess.check_output(['git', 'cat-file', '-t', commit]).strip() != b'commit':
raise ValueError('historical source must name a commit')
tree = subprocess.check_output(
['git', 'ls-tree', '-z', commit, '--', entry['path']])
expected_tree = ('100644 blob ' + entry['git_blob'] + '\t'
+ entry['path'] + '\0').encode()
if tree != expected_tree:
raise ValueError('historical source path/blob mismatch: ' + entry['path'])
data = subprocess.check_output(['git', 'cat-file', 'blob', entry['git_blob']])
blob = hashlib.sha1(b'blob ' + str(len(data)).encode() + b'\0' + data).hexdigest()
if (len(data) != entry['bytes']
or hashlib.sha256(data).hexdigest() != entry['sha256']
or blob != entry['git_blob']):
raise ValueError('historical source identity mismatch: ' + entry['path'])
script = str(root / 'remainder_check.py')
expected = (root / 'RESULTS.json').read_bytes()
mutants = ['M1', 'M2', 'M3']
for flags in (['-B', '-S'], ['-B', '-O', '-S']):
out = subprocess.run([sys.executable, *flags, script],
check=True, capture_output=True, timeout=300).stdout
if out != expected:
raise RuntimeError('output differs from RESULTS.json under ' + ' '.join(flags))
for m in mutants:
rc = subprocess.run([sys.executable, *flags, script, '--mutant', m],
capture_output=True, timeout=300).returncode
if rc != 1:
raise RuntimeError('mutant ' + m + ' not rejected')
print(json.dumps({'scientific_effect': 'NONE', 'mathematical_acceptance': False}))
PY
git diff --exit-code
Loading
Loading