drep-ai 2.5.0

A local commit gate: runs the linters your repo configures, and sends changed code to an LLM for review
Documentation
name: rust

on:
  push:
    branches: [main, rust-rewrite]
  pull_request:

env:
  CARGO_TERM_COLOR: always

jobs:
  # fmt and clippy are byte-identical work on every OS - there is no cfg(unix)
  # or cfg(windows) in the tree - and clippy's check-only artifacts do not seed
  # the codegen build that `cargo test` needs. Running them once, here, avoids
  # paying a second full pass over the dependency tree on the macOS runner.
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5

      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy

      - uses: Swatinem/rust-cache@v2

      - name: Format
        run: cargo fmt --all --check

      # Lint levels come from [lints] in Cargo.toml, not from flags here.
      - name: Clippy
        run: cargo clippy --all-targets --all-features

  test-linux:
    name: test (ubuntu-latest)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5

      - uses: dtolnay/rust-toolchain@stable

      - uses: Swatinem/rust-cache@v2

      - run: cargo test --all-targets --all-features

  # The family Gitea instance has only the Strix Linux runner. Its macOS
  # runners belong to the separate novels instance, while GitHub supplies this
  # hosted lane. Gitea evaluates a job-level `if` only after label matching, so
  # give its guarded skip a claimable Linux label; GitHub still resolves this
  # expression to native macOS.
  test-macos:
    name: test (macos-latest)
    if: ${{ github.server_url == 'https://github.com' }}
    runs-on: ${{ github.server_url == 'https://github.com' && 'macos-latest' || 'ubuntu-latest' }}
    steps:
      - uses: actions/checkout@v5

      - uses: dtolnay/rust-toolchain@stable

      - uses: Swatinem/rust-cache@v2

      - run: cargo test --all-targets --all-features

  # Whether the tests would notice if the code were wrong. A surviving mutant is
  # a test that asserts correct behaviour without being able to distinguish it
  # from incorrect behaviour. Exits 2 when any mutant survives, which fails the
  # job. Full sweep here; the pre-commit hook scopes to the staged diff.
  mutants:
    runs-on: ubuntu-latest
    # Strix maps the label above to Debian 12 (glibc 2.36), while the verified
    # cargo-mutants 27.1.0 binary requires glibc 2.39. Override only this job
    # with Debian 13 (glibc 2.41), leaving every other family workload alone.
    container: node:22-trixie
    steps:
      - uses: actions/checkout@v5

      - uses: dtolnay/rust-toolchain@stable

      - uses: Swatinem/rust-cache@v2

      - uses: taiki-e/install-action@v2
        with:
          tool: cargo-mutants@27.1.0

      # Survivors are printed as `MISSED <file>:<line>: <mutation>` lines, so the
      # job log is already the actionable report - no artifact upload needed.
      #
      # Through the same script the pre-commit hook uses, so CI and the hook
      # cannot disagree about what counts as a failure. It owns the timeout
      # rule in particular, which neither caller had right: see the comment in
      # scripts/mutants-run.sh. No arguments means the full sweep.
      - run: ./scripts/mutants-run.sh

  msrv:
    name: msrv (1.88)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5

      # If this breaks, the MSRV in Cargo.toml is wrong - do not paper over it
      # by bumping the toolchain here. It has moved once already: `ignore`
      # 0.4.30 raised the real floor to 1.88 while open-agent-sdk still asks
      # for 1.85, and declares no `rust-version`, so the first sign was a
      # compile error in a dependency.
      - uses: dtolnay/rust-toolchain@1.88.0

      - uses: Swatinem/rust-cache@v2

      # No --all-targets: MSRV is a property of [dependencies]. Whether the dev
      # dependencies build on 1.85 has no consumer.
      - run: cargo check