mirror of
https://github.com/kilyabin/psysonic.git
synced 2026-07-22 14:35:41 +00:00
ci: make hot-path coverage gates required PR checks (#921)
* ci: make hot-path coverage gates required PR checks Remove continue-on-error from frontend and Rust coverage jobs now that the hot-path lists have stabilized; update docs and script headers. * docs: note hard coverage gates in changelog and credits (PR #921) * chore: drop credits entry for CI-only PR #921 Contributor credits are for user-visible work, not infra toggles.
This commit is contained in:
@@ -3,13 +3,8 @@
|
|||||||
# Mirrors `.github/hot-path-files.txt` for the Rust crates. Each entry is a
|
# Mirrors `.github/hot-path-files.txt` for the Rust crates. Each entry is a
|
||||||
# workspace-relative path; the gate script (`scripts/check-frontend-hot-path-
|
# workspace-relative path; the gate script (`scripts/check-frontend-hot-path-
|
||||||
# coverage.sh`) reads `coverage/coverage-summary.json` produced by
|
# coverage.sh`) reads `coverage/coverage-summary.json` produced by
|
||||||
# `vitest run --coverage` and warns when a listed file drops below the floor.
|
# `vitest run --coverage` and fails the frontend-tests coverage job when a
|
||||||
#
|
# listed file drops below the floor.
|
||||||
# Soft today (warnings only — the workflow carries `continue-on-error: true`).
|
|
||||||
# Flip to a hard PR-blocker by removing `continue-on-error` from the
|
|
||||||
# `frontend-tests` workflow at the start of M4 in the pre-refactor testing
|
|
||||||
# plan (2026-05-11), once Phase 1–3 characterization tests have proven the
|
|
||||||
# gate stable on a handful of real PRs.
|
|
||||||
#
|
#
|
||||||
# Curation rule (mirrors the backend list): a file belongs here when its
|
# Curation rule (mirrors the backend list): a file belongs here when its
|
||||||
# hot-path code dominates the file and ≥70 % is a reasonable floor. Files
|
# hot-path code dominates the file and ≥70 % is a reasonable floor. Files
|
||||||
|
|||||||
@@ -20,8 +20,7 @@
|
|||||||
#
|
#
|
||||||
# Each line is a path relative to the workspace root (so `src-tauri/...`).
|
# Each line is a path relative to the workspace root (so `src-tauri/...`).
|
||||||
# `#` for comments. CI runs cargo-llvm-cov + this gate; PRs that drop
|
# `#` for comments. CI runs cargo-llvm-cov + this gate; PRs that drop
|
||||||
# any listed file below the threshold get a warning annotation today
|
# any listed file below the threshold fail the rust-tests coverage job.
|
||||||
# and (after watching it run cleanly) eventually a hard fail.
|
|
||||||
|
|
||||||
# ── psysonic-syncfs ──────────────────────────────────────────────────
|
# ── psysonic-syncfs ──────────────────────────────────────────────────
|
||||||
src-tauri/crates/psysonic-syncfs/src/cache/fs_utils.rs
|
src-tauri/crates/psysonic-syncfs/src/cache/fs_utils.rs
|
||||||
|
|||||||
@@ -61,12 +61,7 @@ jobs:
|
|||||||
|
|
||||||
coverage:
|
coverage:
|
||||||
name: vitest --coverage (baseline + hot-path file gate)
|
name: vitest --coverage (baseline + hot-path file gate)
|
||||||
# Two-layer gate: the script exits 1 when any listed file drops below the
|
|
||||||
# threshold (warning annotations show in the PR checks panel), but
|
|
||||||
# `continue-on-error: true` keeps it from BLOCKING merges. Drop the flag
|
|
||||||
# to flip the gate hard once we've watched a few PRs run cleanly.
|
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
continue-on-error: true
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v6
|
- uses: actions/setup-node@v6
|
||||||
@@ -78,7 +73,7 @@ jobs:
|
|||||||
- run: npm ci
|
- run: npm ci
|
||||||
- name: vitest run --coverage
|
- name: vitest run --coverage
|
||||||
run: npx vitest run --coverage
|
run: npx vitest run --coverage
|
||||||
- name: hot-path file coverage soft gate
|
- name: hot-path file coverage gate
|
||||||
run: bash scripts/check-frontend-hot-path-coverage.sh
|
run: bash scripts/check-frontend-hot-path-coverage.sh
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -59,13 +59,7 @@ jobs:
|
|||||||
|
|
||||||
coverage:
|
coverage:
|
||||||
name: cargo llvm-cov (baseline + hot-path file gate)
|
name: cargo llvm-cov (baseline + hot-path file gate)
|
||||||
# Layered: the gate script exits 1 when any hot-path file drops below
|
|
||||||
# threshold (see scripts/check-hot-path-coverage.sh) — the failure is
|
|
||||||
# visible in the PR's checks panel. `continue-on-error: true` keeps it
|
|
||||||
# from BLOCKING merges. Drop continue-on-error to flip the gate to a
|
|
||||||
# PR-blocker once we've watched a few PRs run cleanly.
|
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
continue-on-error: true
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: install Linux build dependencies
|
- name: install Linux build dependencies
|
||||||
@@ -89,7 +83,7 @@ jobs:
|
|||||||
mkdir -p target/llvm-cov
|
mkdir -p target/llvm-cov
|
||||||
cargo llvm-cov --workspace --lcov --output-path lcov.info
|
cargo llvm-cov --workspace --lcov --output-path lcov.info
|
||||||
cargo llvm-cov --workspace --json --output-path target/llvm-cov/cov.json
|
cargo llvm-cov --workspace --json --output-path target/llvm-cov/cov.json
|
||||||
- name: hot-path function coverage soft gate
|
- name: hot-path file coverage gate
|
||||||
run: bash scripts/check-hot-path-coverage.sh
|
run: bash scripts/check-hot-path-coverage.sh
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -172,6 +172,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## Changed
|
## Changed
|
||||||
|
|
||||||
|
### CI — hot-path coverage gates block merges
|
||||||
|
|
||||||
|
**By [@cucadmuh](https://github.com/cucadmuh), PR [#921](https://github.com/Psychotoxical/psysonic/pull/921)**
|
||||||
|
|
||||||
|
* Frontend and Rust `coverage` jobs no longer carry `continue-on-error`; listed hot-path files must stay at ≥70% line coverage or the PR fails.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Linux — session GDK, WebKitGTK mitigations, and Wayland text
|
### Linux — session GDK, WebKitGTK mitigations, and Wayland text
|
||||||
|
|
||||||
**By [@cucadmuh](https://github.com/cucadmuh), PR [#731](https://github.com/Psychotoxical/psysonic/pull/731)**
|
**By [@cucadmuh](https://github.com/cucadmuh), PR [#731](https://github.com/Psychotoxical/psysonic/pull/731)**
|
||||||
|
|||||||
+1
-1
@@ -117,7 +117,7 @@ Workflows are path-filtered (see the YAML for exact `paths` / `paths-ignore`):
|
|||||||
- **Frontend** (`src/**`, lockfile, Vitest/Vite/tsconfig, etc.): `npm test` (Vitest), `npx tsc --noEmit`, then a coverage run.
|
- **Frontend** (`src/**`, lockfile, Vitest/Vite/tsconfig, etc.): `npm test` (Vitest), `npx tsc --noEmit`, then a coverage run.
|
||||||
- **Rust** (`src-tauri/**`): `cargo test --workspace --all-targets`, `cargo clippy --workspace --all-targets -- -D warnings`, then coverage.
|
- **Rust** (`src-tauri/**`): `cargo test --workspace --all-targets`, `cargo clippy --workspace --all-targets -- -D warnings`, then coverage.
|
||||||
|
|
||||||
Hot-path coverage gates are currently **soft** (warnings only — the workflow carries `continue-on-error: true`). They will be flipped to required when the floors stabilise; see the headers in [`frontend-hot-path-files.txt`](.github/frontend-hot-path-files.txt) and [`hot-path-files.txt`](.github/hot-path-files.txt) for the current state of each list.
|
Hot-path coverage gates are **required** on pull requests: the `coverage` jobs in [`frontend-tests.yml`](.github/workflows/frontend-tests.yml) and [`rust-tests.yml`](.github/workflows/rust-tests.yml) fail when any listed file drops below the floor. See the headers in [`frontend-hot-path-files.txt`](.github/frontend-hot-path-files.txt) and [`hot-path-files.txt`](.github/hot-path-files.txt) for curation rules and thresholds.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#
|
#
|
||||||
# Hot-path file coverage gate — frontend, soft mode.
|
# Hot-path file coverage gate — frontend.
|
||||||
#
|
#
|
||||||
# Mirrors `scripts/check-hot-path-coverage.sh` for the Rust workspace. For
|
# Mirrors `scripts/check-hot-path-coverage.sh` for the Rust workspace. For
|
||||||
# each source file listed in `.github/frontend-hot-path-files.txt`, verifies
|
# each source file listed in `.github/frontend-hot-path-files.txt`, verifies
|
||||||
# that line coverage is at least $THRESHOLD %. Emits GitHub Actions warning
|
# that line coverage is at least $THRESHOLD %. Emits GitHub Actions warning
|
||||||
# annotations for files below the floor; exits 1 when any file is below, but
|
# annotations for files below the floor and exits 1 when any file is below.
|
||||||
# the wrapping CI job carries `continue-on-error: true` so it doesn't block
|
|
||||||
# merges yet (drop that flag once we've watched a few PRs run cleanly).
|
|
||||||
#
|
#
|
||||||
# Why files instead of per-function: v8 coverage's per-function data is
|
# Why files instead of per-function: v8 coverage's per-function data is
|
||||||
# fragile under React Compiler / Vite minification — file-level line
|
# fragile under React Compiler / Vite minification — file-level line
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#
|
#
|
||||||
# Hot-path file coverage gate — soft mode.
|
# Hot-path file coverage gate.
|
||||||
#
|
#
|
||||||
# For each source file listed in `.github/hot-path-files.txt`, verifies
|
# For each source file listed in `.github/hot-path-files.txt`, verifies
|
||||||
# that line coverage is at least $THRESHOLD %. Emits GitHub Actions
|
# that line coverage is at least $THRESHOLD %. Emits GitHub Actions
|
||||||
# warning annotations for files below the floor; never sets a non-zero
|
# warning annotations for files below the floor and exits 1 when any
|
||||||
# exit code (soft gate).
|
# file is below.
|
||||||
#
|
#
|
||||||
# Why files instead of per-function: cargo-llvm-cov's per-function
|
# Why files instead of per-function: cargo-llvm-cov's per-function
|
||||||
# region data is unreliable for async state-machines (most regions live
|
# region data is unreliable for async state-machines (most regions live
|
||||||
@@ -104,14 +104,6 @@ echo "Checked: $TOTAL hot-path file(s)"
|
|||||||
echo "Below threshold: $BELOW"
|
echo "Below threshold: $BELOW"
|
||||||
echo "Not found: $NOT_FOUND"
|
echo "Not found: $NOT_FOUND"
|
||||||
|
|
||||||
# Two-layer gate:
|
|
||||||
# - This script exits 1 when any hot-path file regresses below the
|
|
||||||
# threshold. That gives an unambiguous CI signal in the workflow log.
|
|
||||||
# - The `coverage` job in `.github/workflows/rust-tests.yml` carries
|
|
||||||
# `continue-on-error: true`, so the failing exit is visible in the
|
|
||||||
# PR's checks panel but does NOT block merges yet.
|
|
||||||
# - Flip to a hard PR-blocker by removing `continue-on-error` from the
|
|
||||||
# workflow once we've watched a few PRs run cleanly.
|
|
||||||
if [[ "$BELOW" -gt 0 ]]; then
|
if [[ "$BELOW" -gt 0 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
+3
-3
@@ -207,9 +207,9 @@ wrappers when the hook reads from a provider.
|
|||||||
hot-path gate consumes.
|
hot-path gate consumes.
|
||||||
- `.github/frontend-hot-path-files.txt` lists the files held to ≥70% line
|
- `.github/frontend-hot-path-files.txt` lists the files held to ≥70% line
|
||||||
coverage by `scripts/check-frontend-hot-path-coverage.sh`.
|
coverage by `scripts/check-frontend-hot-path-coverage.sh`.
|
||||||
- CI runs both. The gate is soft today (`continue-on-error: true`) —
|
- CI runs both. The gate is a **required PR check** — the `coverage` job in
|
||||||
it flips to a hard PR-blocker at the start of M4 in the pre-refactor
|
`frontend-tests` fails when any listed file drops below the floor. Mirrors
|
||||||
testing plan. Mirrors the backend rust-tests rollout.
|
the backend rust-tests rollout.
|
||||||
|
|
||||||
## Process isolation
|
## Process isolation
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user