name: Lean Check
on: [push, pull_request]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install Lean
        uses: leanprover/lean-action@v1
      - name: Check for non-TODO sorries
        run: |
          SORRY_COUNT=$(grep -rn "^  sorry$\|^  sorry$\|^sorry$" formal/SilverSight/ Core/ || true | wc -l)
          if [ "$SORRY_COUNT" -gt 0 ]; then
            echo "WARNING: Found $SORRY_COUNT non-TODO sorries"
          fi
          echo "OK: $(grep -rn 'TODO(lean-port)' formal/ --include='*.lean' || true | wc -l) TODO(lean-port) markers known"
      - name: Check for admit
        run: |
          ADMIT_COUNT=$(grep -rn "^  admit$\|^admit$" formal/SilverSight/ Core/ || true | wc -l)
          if [ "$ADMIT_COUNT" -gt 0 ]; then
            echo "ERROR: Found $ADMIT_COUNT admit markers"
            exit 1
          fi
          echo "No bare admits"
