fix: ruff lint, test assertions, Lean citation; update paper C9 citation #73
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: CI | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python-version: ["3.11", "3.12"] | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| # Force UTF-8 I/O on Windows (avoids CP1252 UnicodeEncodeError for Greek/math chars) | |
| PYTHONUTF8: "1" | |
| PYTHONIOENCODING: "utf-8" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install -e ".[dev]" | |
| - name: Lint | |
| run: ruff check src/ tests/ --select E,F,W --ignore E501 | |
| - name: Unit tests | |
| run: pytest -v --tb=short | |
| - name: Quick proof verification | |
| run: python verify.py --quick | |
| - name: Quick falsification audit | |
| run: python falsify.py --quick | |
| proof-verification: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install -e . | |
| - name: Algebraic core + perturbation bound | |
| run: python proof/verify_algebraic_core.py | |
| - name: Truncation error + cross-validation | |
| run: python proof/verify_truncation_and_crosscheck.py | |
| - name: Polya condition verification | |
| run: python proof/verify_debruijn_condition.py | |
| - name: Verify cross-validation passed | |
| run: | | |
| python -c " | |
| import json | |
| with open('results/truncation_crosscheck.json') as f: | |
| r = json.load(f) | |
| assert r['cross_validation_passed'], 'Cross-validation FAILED' | |
| assert r['truncation_bound_below_1e42'], 'Truncation bound too large' | |
| print('Cross-validation: PASSED') | |
| print('Truncation bound: %.2e (< 1e-42)' % r['truncation_bound']) | |
| " | |
| falsification: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install -e . | |
| - name: Run all 36 falsification attacks (7 batches) | |
| run: python falsification/run_all.py | |
| - name: External claims audit (quick) | |
| run: python falsification/audit_external.py --quick | |
| - name: Verify self-audit passes | |
| run: | | |
| python -c " | |
| import json | |
| with open('results/audit_external.json') as f: | |
| data = json.load(f) | |
| self_audit = [d for d in data if d['claim_id'] == 'self'][0] | |
| assert self_audit['n_failed'] == 0, 'Self-audit has failures' | |
| print('Self-audit: %d/%d passed' % (self_audit['n_passed'], self_audit['n_checks'])) | |
| " | |
| license-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Verify SPDX headers in Python files | |
| run: | | |
| missing=0 | |
| for f in $(find proof/ falsification/ src/ -name '*.py' 2>/dev/null); do | |
| if ! head -1 "$f" | grep -q 'SPDX-License-Identifier'; then | |
| echo "MISSING SPDX: $f" | |
| missing=$((missing+1)) | |
| fi | |
| done | |
| if [ "$missing" -gt 0 ]; then | |
| echo "ERROR: $missing files missing SPDX headers" | |
| exit 1 | |
| fi | |
| echo "All Python files have SPDX headers" | |
| - name: Verify license files exist | |
| run: | | |
| test -f LICENSE && test -f LICENSE-CODE && test -f LICENSE-PAPER | |
| echo "All license files present" |