Skip to content

Pre-push runs the full test suite TWICE — unit stage + coverage stage (~9.5s duplicate) #215

Description

@yuyu04

Problem

The pre-push tier runs both stage_2.1 (unit, vitest run) and stage_2.2 (coverage, vitest run --coverage). The coverage run already executes every test, so the separate unit run re-runs the whole suite for nothing.

Measured on cladding's own repo: vitest run ~9.5s + vitest run --coverage ~10.7s ≈ 20s, of which ~9.5s is the duplicate run. Same class of redundancy as the secretlint/madge double-spawn.

Proposed fix

Share ONE coverage run across both stages via a gate-scoped memo (mirrors the spec cache F-cd0415). The unit stage triggers it and, on a GREEN run, reuses it instead of re-running.

Soundness (the critical property): reuse-pass is returned ONLY for a green coverage run, so a failing test can never surface as a unit pass. A non-green coverage run sends the unit stage to a tests-only fallback — so a coverage-threshold miss fails coverage but not unit, and a real test failure still fails both. Verified: a failing test reds BOTH stages; a passing suite greens both with one run.

Test selection (changed-files / vitest --changed) is intentionally out of scope — a gate must run the whole suite; this only removes the duplicate full run.

Measured

clad check --tier=pre-push: ~40.4s → 30.1s (−10s).

Implemented by F-97abf5db.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions