Skip to content

fix: close failed focus checkpoints before verified cleanup #531

fix: close failed focus checkpoints before verified cleanup

fix: close failed focus checkpoints before verified cleanup #531

Workflow file for this run

name: Test
on:
workflow_call:
workflow_dispatch:
schedule:
- cron: "17 3 * * *"
push:
branches: [main]
pull_request:
branches: [main]
types: [opened, synchronize, reopened, edited]
permissions:
contents: read
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
jobs:
snapshot-provenance:
name: Snapshot provenance
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Require provenance evaluation for snapshot runtime changes
if: github.event_name == 'pull_request'
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
PR_BODY: ${{ github.event.pull_request.body }}
run: >-
python .github/scripts/check_snapshot_provenance.py
--base "$BASE_SHA" --head "$HEAD_SHA" --require-decision
- name: Enforce append-only provenance outside pull requests
if: github.event_name != 'pull_request'
env:
BEFORE_SHA: ${{ github.event.before }}
HEAD_SHA: ${{ github.sha }}
REF_TYPE: ${{ github.ref_type }}
run: |
if [ "$REF_TYPE" = "tag" ]; then
BASE_SHA=$(git describe --tags --abbrev=0 "${HEAD_SHA}^" 2>/dev/null || git rev-list --max-parents=0 "$HEAD_SHA")
else
BASE_SHA="$BEFORE_SHA"
if ! git cat-file -e "${BASE_SHA}^{commit}" 2>/dev/null; then
BASE_SHA=$(git rev-list --max-parents=0 "$HEAD_SHA")
fi
fi
python .github/scripts/check_snapshot_provenance.py --base "$BASE_SHA" --head "$HEAD_SHA"
lint:
name: Lint & Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Ruff lint check
run: ruff check .
- name: Black format check
run: black --check .
- name: basedPyright check
run: python -m basedpyright --pythonpath "$(python -c 'import sys; print(sys.executable)')"
browser:
name: Frame-tree browser regression
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install browser test dependencies
run: |
pip install -e ".[dev]"
python -m playwright install --with-deps chromium
- name: Run required Chromium interaction tests
env:
PT_SNAP_REQUIRE_BROWSER: "1"
# Required mode rejects missing dependencies, skips and incomplete execution.
run: pytest -rs tests/test_fixture_provenance.py tests/test_memory_tree_browser.py
test:
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: pip-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
pip-${{ runner.os }}-${{ matrix.python-version }}-
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Verify executable fixture provenance
run: pytest tests/test_fixture_provenance.py
- name: Run non-slow compatibility tests
if: matrix.python-version != '3.13'
run: pytest -m "not slow and not nightly"
- name: Run full PR tests with coverage
if: matrix.python-version == '3.13'
run: pytest -m "not nightly" --cov --cov-report=xml --cov-report=term-missing
- name: Guard critical runtime coverage
if: matrix.python-version == '3.13'
# Separate floors prevent strong modules from masking a weak boundary.
run: |
python -m coverage report --include='*/core/snapshot_import_backend.py' --fail-under=90
python -m coverage report --include='*/simulate/simulated_caching_allocator.py' --fail-under=88
python -m coverage report --include='*/simulate/snapshot_mutator.py' --fail-under=84
- name: Upload coverage report
uses: actions/upload-artifact@v4
if: matrix.python-version == '3.13' && always()
with:
name: coverage-report
path: coverage.xml
retention-days: 30
- name: Build wheel
if: matrix.python-version == '3.13'
run: |
python -m pip install --upgrade build
python -m build --wheel
- name: Audit wheel contents against source
if: matrix.python-version == '3.13'
run: |
set -euo pipefail
WHEEL=$(python -c 'from pathlib import Path; wheels = sorted(Path("dist").glob("*.whl")); assert len(wheels) == 1, wheels; print(wheels[0])')
python .github/scripts/audit_wheel.py --wheel "$WHEEL"
- name: Clean-wheel Agent acceptance
if: matrix.python-version == '3.13'
run: |
set -euo pipefail
WHEEL=$(python -c 'from pathlib import Path; wheels = sorted(Path("dist").glob("*.whl")); assert len(wheels) == 1, wheels; print(wheels[0])')
python .github/scripts/clean_wheel_agent_acceptance.py \
--wheel "$WHEEL" \
--fixture tests/fixtures/snapshots/snapshot_with_empty_cache.pkl \
--events-per-slice 4096
dataset-acceptance:
name: Installed-wheel dataset acceptance
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.sha }}
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Verify executable fixture provenance
run: pytest tests/test_fixture_provenance.py
- name: Build wheel
run: python -m build --wheel
- name: Audit wheel contents against source
run: |
set -euo pipefail
WHEEL=$(python -c 'from pathlib import Path; wheels = sorted(Path("dist").glob("*.whl")); assert len(wheels) == 1, wheels; print(wheels[0])')
python .github/scripts/audit_wheel.py --wheel "$WHEEL"
- name: Run required installed-wheel dataset acceptance
run: |
set -euo pipefail
WHEEL=$(python -c 'from pathlib import Path; wheels = sorted(Path("dist").glob("*.whl")); assert len(wheels) == 1, wheels; print(wheels[0])')
python .github/scripts/run_dataset_acceptance.py \
--wheel "$WHEEL" --output-dir .tmp/dataset-acceptance
- name: Run required 200-seed paired differential acceptance
run: |
python .github/scripts/run_differential_acceptance.py \
--seed-count 200 --output-dir .tmp/differential-acceptance
- name: Upload dataset acceptance evidence
if: always()
uses: actions/upload-artifact@v4
with:
name: dataset-acceptance-${{ github.sha }}
path: .tmp/dataset-acceptance/
include-hidden-files: true
if-no-files-found: error
retention-days: 30
- name: Upload paired differential evidence
if: always()
uses: actions/upload-artifact@v4
with:
name: differential-acceptance-${{ github.sha }}
path: |
.tmp/differential-acceptance/*.log
.tmp/differential-acceptance/*.xml
.tmp/differential-acceptance/summary.json
.tmp/differential-acceptance/pytest-temp/**/coverage.json
.tmp/differential-acceptance/pytest-temp/**/timeline.json
.tmp/differential-acceptance/pytest-temp/**/differential-failure.json
include-hidden-files: true
if-no-files-found: error
retention-days: 30