From 704916ff682b25e1575c76fa6e72f85528167b37 Mon Sep 17 00:00:00 2001 From: Leo Lara Date: Thu, 11 Jun 2026 21:12:34 +0700 Subject: [PATCH] ci: gate dead-code detection with vulture Add a dead-code job to CI that runs `just deadcode`, so a regression that introduces unused code fails the build. The job pins a single Python version because vulture's analysis is version-independent. Also whitelist a justifiability fixture field that landed after the initial vulture setup, so the new gate starts green. The field is set through a constructor keyword and serialized to the fixture JSON, never read by attribute, which vulture cannot see. --- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++++ vulture_whitelist.py | 1 + 2 files changed, 27 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a843d7774..5b1420e4a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,6 +45,32 @@ jobs: - name: Run all quality checks run: just check + dead-code: + name: Dead code detection + runs-on: ubuntu-latest + steps: + - name: Checkout leanSpec + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install uv + uses: astral-sh/setup-uv@v4 + with: + enable-cache: true + cache-dependency-glob: "pyproject.toml" + + - name: Install just + uses: taiki-e/install-action@v2 + with: + tool: just + + - name: Detect dead code with vulture + run: just deadcode + test: name: Tests - Python ${{ matrix.python-version }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} diff --git a/vulture_whitelist.py b/vulture_whitelist.py index 103f7be79..f28babc46 100644 --- a/vulture_whitelist.py +++ b/vulture_whitelist.py @@ -157,6 +157,7 @@ participant_sets block_weights known_aggregated_payloads +is_justifiable # SSZ container and model field names declared inside unit tests. # Serialized by the SSZ codec or set through pydantic, never read by attribute.