name: full-pytest

# Post-merge validation — runs the full pytest suite on every push to main.
# PRs are gated by the faster smoke workflow (smoke.yml); this catches
# anything outside the smoke suite within minutes of merge.
#
# Quarantined tests are excluded via the conftest.py QUARANTINE registry.
# The intent is a ratchet: once a test is removed from the registry it
# must keep passing on this gate.
#
# See:
#   conftest.py — the QUARANTINE registry (one entry per quarantined test)
#   docs/test-debt-quarantine.md — cluster diagnoses + removal policy

on:
  push:
    branches: [main]

permissions:
  contents: read

concurrency:
  group: full-pytest-${{ github.ref }}
  cancel-in-progress: true

jobs:
  pytest:
    name: full pytest (-m "not quarantine" -n 2)
    runs-on: ubuntu-latest
    timeout-minutes: 45

    steps:
      - name: checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 1

      - name: set up uv
        uses: astral-sh/setup-uv@v5
        with:
          python-version: '3.11'
          enable-cache: true

      - name: install dependencies
        run: |
          uv pip install -e ".[dev]" pyyaml

      - name: pytest (parallel, quarantine excluded)
        env:
          PYTHONPATH: ${{ github.workspace }}
          CORE_SHOWCASE_SKIP_BUDGET: "1"
        run: |
          uv run pytest -m "not quarantine" -n 2 --tb=short -q --maxfail=10

      - name: report quarantine size (informational)
        if: always()
        env:
          PYTHONPATH: ${{ github.workspace }}
        run: |
          uv run python -c "
          import sys
          sys.path.insert(0, '.')
          from conftest import QUARANTINE
          print(f'::notice title=Quarantine size::{len(QUARANTINE)} tests currently quarantined. Goal: shrink this number.')
          "
