ci(sonar): CI-based SonarQube Cloud analysis, with Rust and TypeScript coverage (#85)

Automatic analysis could not build, so it never analysed the Rust two
thirds of the code and imported no coverage; it also sent no project
version, leaving the previous-version new-code period anchored to the
first analysis. sonar.yml runs on Windows, produces cargo-llvm-cov and
vitest LCOV plus clippy's JSON, and scans with sonarqube-scan-action
v8.3.0 (pinned), passing the version from package.json. The token
reaches the scan step alone; the job is skipped without one (Dependabot,
forks) and refuses a dispatch off main, which this plan cannot analyse.

Unblocks the required audits, red on main since 2026-10-21:
rustls-webpki 0.103.16, webpki-root-certs 1.0.11, clipboard-win 5.4.3,
zod 4.6.7. Dependabot groups vitest with @vitest/*.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
poli0981andClaude Opus 5.5 authored and GitHub committed 2026-10-25 06:38:10 +07:00
1 parent a3146895a0
commit 4a617722d6
15 files changed
+439 -20

No files matched your search

+5
View File
@@ -65,6 +65,11 @@ updates:
groups:
tauri:
patterns: ['@tauri-apps/*']
# @vitest/coverage-v8 peers `vitest` at its exact version, so the two must move in one PR —
# majors included, which is why this group names no update-types: a vitest major bumped
# alone fails `npm ci` with ERESOLVE, as the typescript one below would.
vitest:
patterns: ['vitest', '@vitest/*']
npm-minor-patch:
update-types: [minor, patch]
labels: [dependencies, frontend]
+1
View File
@@ -17,6 +17,7 @@ on:
- CI / Node
- CI / Integration
- Security scan
- SonarCloud
types: [completed]
permissions:
+148
View File
@@ -0,0 +1,148 @@
# SonarQube Cloud, CI-based. sonar-project.properties says what is analysed, and why this replaced
# automatic analysis: that could not build, so it saw no Rust and imported no coverage.
#
# **One Windows job**, for the reason ci-rust.yml is on Windows: the Rust suite exercises the PEP 514
# registry and the `py` launcher, so coverage measured on Linux would be coverage of a different
# program. Scanning on the runner that produced the reports also means both LCOV files name paths
# the scanner can resolve, with nothing rewritten in between.
#
# **The token reaches one step.** Producing the reports runs third-party code — every crate's build
# script, every npm package's — so SONAR_TOKEN is in no environment but the scanner's, the same
# reasoning that keeps release.yml's write token away from its build.
#
# **No token, no analysis.** Dependabot's pull requests are given Dependabot secrets only, and a
# fork's none, so on those `secrets.SONAR_TOKEN` is empty and the job is skipped instead of failing
# on a missing token. Adding SONAR_TOKEN as a Dependabot secret as well brings their PRs back in.
#
# Not a required check. The quality gate is still reported as SonarCloud's own check on the PR, and
# `sonar.qualitygate.wait` makes this job fail with it — which is what lets a red gate on `main`
# reach Discord through notify-ci-failure.yml, where this workflow is listed by name.
name: SonarCloud
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: sonar-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
# ci-rust.yml's, so the clippy run below matches the fingerprints in the cache it restores.
RUSTFLAGS: -D warnings
jobs:
token:
name: token present
runs-on: ubuntu-latest
timeout-minutes: 2
outputs:
present: ${{ steps.check.outputs.present }}
steps:
# `secrets` cannot be read in an `if:`, so its presence is turned into an output here. Only
# the emptiness test sees the value; nothing is checked out and nothing else runs.
- name: Check
id: check
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
if [ -n "$SONAR_TOKEN" ]; then
echo "present=true" >> "$GITHUB_OUTPUT"
else
echo "present=false" >> "$GITHUB_OUTPUT"
echo "::notice::No SONAR_TOKEN for this run (a Dependabot or fork pull request); the analysis is skipped."
fi
analyze:
name: coverage · analysis
needs: token
# A dispatch from any branch but `main` would be a *branch* analysis, which this organization's
# plan does not offer: the report uploads, and then the gate check fails with "not allowed to
# access data from non main branches" (tried 2026-10-25). Pull requests and `main` are the two
# analyses there are.
if: >-
needs.token.outputs.present == 'true' &&
(github.event_name != 'workflow_dispatch' || github.ref == 'refs/heads/main')
runs-on: windows-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v7
with:
# Full history: new code is decided by blame, and a shallow clone has none to give.
fetch-depth: 0
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: '24'
cache: npm
- name: Install frontend dependencies
run: npm ci
- name: TypeScript coverage
run: npm run test:coverage
# Restore only, from ci-rust.yml's key. The registry and clippy's build are reused from it;
# the instrumented build lands in target/llvm-cov-target and is rebuilt every run, because
# saving a fourth multi-GB cargo cache would evict the three the required checks depend on.
- name: Restore cargo cache
uses: actions/cache/restore@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', 'rust-toolchain.toml') }}
restore-keys: ${{ runner.os }}-cargo-
# For the toolchain rust-toolchain.toml pins, which installs itself on the first cargo call;
# adding the component there instead would make every contributor download it.
- name: Add llvm-tools
run: rustup component add llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@1168f6810a3cb30a3514bf5756a3b7f0422c6df8 # v2.87.28
with:
tool: cargo-llvm-cov
- name: Rust coverage
run: cargo llvm-cov --workspace --locked --lcov --output-path target/lcov-rust.info
# The same invocation as ci-rust.yml's gate, as JSON. That job is what fails on a finding;
# this one only records it, so a red clippy still leaves a report for the scanner to import.
- name: Clippy report
shell: pwsh
run: |
cargo clippy --workspace --all-targets --locked --message-format=json -- -D warnings |
Out-File -Encoding utf8NoBOM target/clippy.json
exit 0
# package.json is one of the five places the version lives, and a tag cannot be pushed while
# they disagree (release.yml), so any of them would do. Checked against a version's shape
# because it is spliced into the scanner's argv below, in the step that holds the token.
- name: Project version
id: version
shell: pwsh
run: |
$v = (Get-Content package.json -Raw | ConvertFrom-Json).version
if ($v -notmatch '^\d+\.\d+\.\d+(-[0-9A-Za-z.]+)?$') { throw "package.json version '$v' is not a version" }
"version=$v" >> $env:GITHUB_OUTPUT
- name: Scan
uses: SonarSource/sonarqube-scan-action@d209202bc7d53ff1cc128f7f907dac145c9d6ae9 # v8.3.0
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.projectVersion=${{ steps.version.outputs.version }}
-Dsonar.qualitygate.wait=true
+2
View File
@@ -8,6 +8,8 @@ node_modules/
dist/
dist-ssr/
.vite/
# `npm run test:coverage` (vitest's LCOV, read by sonar.yml).
/coverage/
*.tsbuildinfo
# Tauri build output
+8 -1
View File
@@ -78,7 +78,7 @@ failed package never aborts a batch (skip-and-continue, then a `"13 successful,
reusable Rust or Tauri workflow**, its notifiers are **Discord-only**, dependency bumps are
**Dependabot** (not Renovate), and its CodeQL reusable *lists* no Rust but passes `languages`
straight to codeql-action, which analyses Rust and Actions without a build — `codeql.yml` asks for
both. So `ci-rust.yml`, `release.yml` and `security-scan.yml` are project-local; `ci-node.yml`,
both. So `ci-rust.yml`, `release.yml`, `security-scan.yml` and `sonar.yml` are project-local; `ci-node.yml`,
`codeql.yml` and the notifiers are callers. Every caller needs an explicit `permissions:` block —
callers without one default to `none` — and a write permission belongs on the job that needs it,
not the workflow.
@@ -89,6 +89,13 @@ nothing, and `main` was red from 2026-09-23 for three weeks with no one told. St
question with `gh run list --branch main`, and remember that `security-scan.yml` exists for the
case no PR will catch: an advisory against something already merged.
**SonarQube Cloud is CI-based since 2026-10-25** — `sonar.yml` and `sonar-project.properties`;
automatic analysis is off in the project's settings and must stay off, or the CI analysis is
refused. Automatic analysis never analysed a line of Rust and imported no coverage, which is why it
went. The gate's "new code" is *previous version*, and the version comes from `package.json`, so a
release bump starts a new period; new code needs 80 % coverage, so a slice whose new lines no
test reaches turns `main`'s gate red. Dependabot PRs have no `SONAR_TOKEN` and skip the analysis.
## Current state
**M1 and M2 complete** (IPC bridge 2026-07-30; Installed+Updates, the mutation spine
Generated
+8 -8
View File
@@ -680,9 +680,9 @@ checksum = "1c133bc6a41be0d194c306b5506d15e6feeea7b1d6604bd3f8310dfb2ca96486"
[[package]]
name = "clipboard-win"
version = "5.4.1"
version = "5.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bde03770d3df201d4fb868f2c9c59e66a3e4e2bd06692a0fe701e7103c7e84d4"
checksum = "052af7878466feccda12ba7a6a67d019d712f296809559b47c12c8cc196d3a9a"
dependencies = [
"error-code",
]
@@ -917,7 +917,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d045de693cb712d0b22c6a64be5b953f67b3ce00ab5ad3dd5d8b441886ab8e1a"
dependencies = [
"quote",
"syn 3.0.9",
"syn 2.0.119",
]
[[package]]
@@ -3876,9 +3876,9 @@ checksum = "eec689c0bc40ff2458a5977b6619cb718087084a18e02a131c599b62d05e1a5f"
[[package]]
name = "rustls-webpki"
version = "0.103.15"
version = "0.103.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2"
checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281"
dependencies = [
"aws-lc-rs",
"ring",
@@ -4888,7 +4888,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
dependencies = [
"fastrand",
"getrandom 0.4.3",
"getrandom 0.3.4",
"once_cell",
"rustix",
"windows-sys 0.61.2",
@@ -5718,9 +5718,9 @@ dependencies = [
[[package]]
name = "webpki-root-certs"
version = "1.0.9"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b96554aa2acc8ccdb7e1c9a58a7a68dd5d13bccc69cd124cb09406db612a1c9b"
checksum = "e49d0e65abc00c142e8f9428da991da9f1a250c39be97459901eb12b9b49f62a"
dependencies = [
"rustls-pki-types",
]
+7 -5
View File
@@ -11,15 +11,16 @@
| `ci-integration.yml` | project-local | PR touching what its end-to-end steps run through (the path list is in the file), nightly, Mondays, dispatch | Windows runner, Python 3.10 and 3.14: the disposable-venv suite (TESTING L2); Mondays and dispatch only, the fixture-drift re-capture against the newest pip and uv |
| `codeql.yml` | caller → ops `reusable-codeql.yml` | PR, push main, weekly | `languages: '["javascript-typescript", "rust", "actions"]'` |
| `security-scan.yml` | **project-local** | daily, dispatch | `cargo audit` and `npm audit` against `main` (SECURITY §7) |
| `sonar.yml` | **project-local** | PR, push main, dispatch (`main` only) | `token present` (`ubuntu-latest`) → `coverage · analysis` (`windows-latest`): vitest and `cargo llvm-cov` LCOV, clippy's JSON, then `sonarqube-scan-action` with `sonar.projectVersion` from `package.json` and `sonar.qualitygate.wait`. Skipped when the run has no `SONAR_TOKEN` (Dependabot and fork PRs), and for a dispatch from any branch but `main` — the plan analyses `main` and PRs only. `sonar-project.properties` holds the scope |
| `release.yml` | **project-local** | tag `v*`; dispatch (`tag`, `dry_run`) | `Build · checksum` (`windows-latest`, read-only) → `Attest · draft` (`ubuntu-latest`); see §3 |
| `announce-release.yml` | caller → ops `announce-release.yml` | release published; dispatch (re-runs) | Discord release announcement |
| `notify-ci-failure.yml` | caller → ops `notify-ci-failure.yml` | `workflow_run` completed for `CI / Rust`, `CI / Node`, `CI / Integration`, `Security scan` — **by name** | Discord CI-failure notification |
| `notify-ci-failure.yml` | caller → ops `notify-ci-failure.yml` | `workflow_run` completed for `CI / Rust`, `CI / Node`, `CI / Integration`, `Security scan`, `SonarCloud` — **by name** | Discord CI-failure notification |
**`notify-ci-failure.yml` names its workflows, and a new workflow is added to it by its exact `name:`.** `workflows: ['*']` — the ops repo's own caller example — is not a wildcard to `workflow_run`: it matched nothing, so `main` stayed red from 2026-09-23 with every failure unreported. The reusable reports only failures on the default branch, and skips by name any workflow that has a dedicated notifier (CodeQL, Dependabot, deploy, Pages, release), which is why `CodeQL` and `Release` are not listed: listing them would only create skipped runs. A failed `Release` run therefore reaches no Discord channel; whoever pushed the tag has to watch it.
**Ops-repo audit (2026-07-27; CodeQL and the notifier re-read 2026-10-17) — why the table looks like this:**
- The reusable suite covers assembly, c-cpp, chrome-extension, desktop-csharp, go, jvm, macos-swift, php, python, r, ruby and web-react. **There is no Rust reusable and no Tauri reusable**, and only `reusable-desktop-csharp.yml` uses a Windows runner — hence `ci-rust.yml`, `release.yml` and `security-scan.yml` are project-local.
- The reusable suite covers assembly, c-cpp, chrome-extension, desktop-csharp, go, jvm, macos-swift, php, python, r, ruby and web-react. **There is no Rust reusable and no Tauri reusable**, and only `reusable-desktop-csharp.yml` uses a Windows runner — hence `ci-rust.yml`, `release.yml` and `security-scan.yml` are project-local. There is no SonarQube reusable either (re-checked 2026-10-25), so `sonar.yml` is project-local too.
- `reusable-web-react.yml` has **no `working-directory` input** (it runs `npm ci` at the repo root — hence `package.json` lives at the root with Vite's `root: './ui'`, see ARCHITECTURE §2) and **no `npm audit` step**, hence the extra local job.
- `reusable-codeql.yml` *documents* csharp, python, javascript-typescript, ruby, c-cpp, java-kotlin, go and swift, but hands `languages` straight to `codeql-action`, with `build-mode: none` for anything outside its autobuild list — so `rust` and `actions` run through it unchanged. This bullet said **CodeQL has no Rust analyzer**, so Rust's coverage came from clippy and `cargo audit` alone; the premise stopped being true in 2025, and `codeql.yml` now asks for both. Only the JavaScript/TypeScript analysis is a required check (§2).
- Portfolio notifications are **Discord-only**, driven by the ops repo's `.github/scripts/discord_notify.py`. There is no multi-platform `notify.py`.
@@ -38,7 +39,7 @@ permissions: { contents: read }
permissions: { contents: read }
# build: { contents: read }
# publish: { contents: write, id-token: write, attestations: write }
# ci-rust.yml / ci-integration.yml / security-scan.yml
# ci-rust.yml / ci-integration.yml / security-scan.yml / sonar.yml
permissions: { contents: read }
```
@@ -62,7 +63,7 @@ permissions: { contents: read }
**`CI / Integration` is deliberately excluded, and this is the trap worth remembering:** its `pull_request` trigger is `paths:`-filtered, so on a docs-only or UI-only PR it never starts — and a required check that never starts stays *pending forever*. Requiring it would deadlock exactly the PRs it has no opinion about. `Re-capture against the latest engines` runs on no PR at all (Mondays and dispatch only) and is excluded for the same reason. The bare `CodeQL` check belongs to the `github-advanced-security` app rather than Actions and is left out too.
**Four more run on every PR and are not in the payload** — `cargo deny`, `tauri lockstep`, and CodeQL's `analyze / Analyze (rust)` and `analyze / Analyze (actions)` — all added in 1.4.0, after the five above were set (re-read 2026-10-17; the payload is unchanged). Until they are added, a red one is advice rather than a gate, which matters most for `tauri lockstep`: its whole purpose is to stop one half of a Tauri bump merging alone. `Security scan` runs on no PR and can never be required.
**Four more run on every PR and are not in the payload** — `cargo deny`, `tauri lockstep`, and CodeQL's `analyze / Analyze (rust)` and `analyze / Analyze (actions)` — all added in 1.4.0, after the five above were set (re-read 2026-10-17; the payload is unchanged). Until they are added, a red one is advice rather than a gate, which matters most for `tauri lockstep`: its whole purpose is to stop one half of a Tauri bump merging alone. `Security scan` runs on no PR and can never be required. SonarQube Cloud is not required either, in either form: `SonarCloud Code Analysis` is reported by the SonarCloud app, which the payload's `app_id` pin would not accept, and `sonar.yml`'s `coverage · analysis` is *skipped* on every PR without a token — Dependabot's — and a skipped job satisfies a requirement, so requiring it would gate exactly the PRs it never looks at.
**Two required contexts are named by the ops repo, not by this one.** `analyze / Analyze (javascript-typescript)` and `lint · typecheck · test · build / build` come from `poli0981/.github`'s reusables. If either job is renamed upstream, every PipDock PR deadlocks with no obvious cause and no failing check to point at — the fix is to update the protection payload, not the code.
@@ -72,7 +73,8 @@ Dependency updates use **Dependabot** (`.github/dependabot.yml`) — the portfol
- **Cooldowns.** A release must be 3 days old before cargo or npm proposes it (14 for a major), and 7 for Actions and the tool pins. Most yanked or compromised releases are pulled inside that window, and nothing here needs a dependency the day it ships.
- **Tauri moves in lockstep.** The `tauri` crate and `@tauri-apps/api` must share a minor or the app refuses to start, and Dependabot bumps Cargo and npm in separate PRs, each green on its own. So each ecosystem groups its Tauri packages (`tauri`, `tauri-*`; `@tauri-apps/*`) ahead of its catch-all group, and `ci-node.yml`'s `tauri lockstep` job fails either PR until its counterpart lands beside it, comparing the core and each plugin with its npm package on `Cargo.lock` and `package-lock.json` — what is built, not what the manifests ask for. **A multi-ecosystem group was considered and not used:** it would put both halves in one PR, but what it does to the dependencies outside its patterns is undocumented, and a wrong guess would silently stop every other update.
- **TypeScript is held below 6.1** (`ignore: typescript >=6.1.0`): typescript-eslint 8.71 peers `typescript >=4.8.4 <6.1.0`, so a 6.1 bump fails `npm ci` with ERESOLVE before a single check runs. Remove it once typescript-eslint widens its range.
- **TypeScript is held below 6.1** (`ignore: typescript >=6.1.0`): typescript-eslint 8.71 peers `typescript >=4.8.4 <6.1.0`, so a 6.1 bump fails `npm ci` with ERESOLVE before a single check runs. Remove it once typescript-eslint widens its range (8.72 still peers `<6.1.0`, re-read 2026-10-25, with TypeScript at 7.0).
- **Vitest moves as one** (group `vitest`: `vitest`, `@vitest/*`, every update type). `@vitest/coverage-v8`, which `sonar.yml` needs, peers `vitest` at its exact version, so a bump of either alone fails `npm ci` the way the TypeScript one would.
- **Labels.** PRs are labelled `dependencies` plus `rust`, `frontend`, `ci` or `code-health`, and the labels must exist in the repository or Dependabot opens its PRs without them (§5).
## 3. Release pipeline (tag `v*`)
+44 -1
View File
@@ -1416,9 +1416,52 @@ starting a slice**: several are cheaper inside a slice that touches the same fil
| — | `plan.confirm` | "Confirm (1 changes)" — the count is not pluralised | Copy, both catalogues |
| — | cache manager | The log folder is not one of its targets | The log is new; worth a row once someone asks |
| X12 | `ci-integration.yml` | The `#[ignore]` tests never run in CI | Each needs a fixture the runner can provide — an index, a hang |
| — | CI | SBOM, an installer smoke test, coverage, `cargo machete`, actionlint/zizmor, dependency review, typos and link checks | Each its own decision; none is free on a Windows runner |
| — | CI | SBOM, an installer smoke test, `cargo machete`, actionlint/zizmor, dependency review, typos and link checks | Each its own decision; none is free on a Windows runner. Coverage left this row on 2026-10-25 (below) |
| — | `pipdock-cli/src/run.rs` (4 %), `src-tauri/src/commands.rs` (0 %) | The two large coverage holes `sonar.yml` measured: the CLI driving a real interpreter, and the IPC surface. L2 exercises the first and only a running app the second, so neither is measured | Each needs a seam — an engine `run.rs` can be handed, a `tauri::test` harness — and is its own slice. The gate asks 80 % of *new* lines, so neither blocks anything until it is touched |
| — | `screenshot/` | The eight screenshots predate About and 1.4.0's window | Retake with a release, by hand |
## After 1.4.0 — SonarQube Cloud from CI — **2026-10-25**
No version. The owner switched automatic analysis off, set `SONAR_TOKEN`, and asked for CI-based
analysis on the newest scanner, with Dependabot, the audits and the code scanners brought up to
date on the way.
**Where it started.** Automatic analysis had measured 11 602 lines — CSS, JS, Python, TypeScript,
YAML — and **not one of Rust**: it cannot build, so two thirds of the code had never been analysed
and no coverage could be imported. It had also never sent a project version, so the *previous
version* new-code period was still the first analysis (2026-09-27) and grew with every merge.
Separately, `Security scan` had been red on `main` every day since 2026-10-21 — rustls-webpki
(RUSTSEC-2026-0382), webpki-root-certs (-0383), a yanked clipboard-win, and zod
(GHSA-mrhx-c7xc-m3w5, through eslint-plugin-react-hooks) — and since `cargo audit` and `npm audit`
are required, every PR would have been red as well. Dependabot opened a PR for none of the four.
| What | Now |
|---|---|
| Analysis | `sonar.yml`: one Windows job — vitest and `cargo llvm-cov` LCOV, clippy's JSON, `sonarqube-scan-action` v8.3.0 pinned by commit, `sonar.qualitygate.wait` so a red gate on `main` reaches Discord |
| Scope | `sonar-project.properties`: everything tracked, tests split out, fixtures and binaries excluded, coverage excluded only where no test here can execute the code, with the reason beside each |
| New code | `sonar.projectVersion` from `package.json`, so a release bump starts a period |
| The token | In the scanner step's environment alone; a job with no token (Dependabot, forks) is skipped, not failed |
| Audits | The four bumps above, and nothing ignored |
| Dependabot | A `vitest` group, because `@vitest/coverage-v8` peers vitest exactly; the `rfd` and `typescript` ignores re-checked and both still needed |
**What running found that reading did not:**
- **Coverage, measured for the first time:** Rust 71.6 % of 15 364 lines, TypeScript 68.4 % of
1 569; SonarQube Cloud's combined figure is **71.3 % of 16 327**. TESTING §3 had promised
thresholds since the first draft that nothing had measured. The two big holes are a backlog row.
- **The plan analyses `main` and pull requests, and nothing else.** A dispatch on the branch, to see
every Rust finding before merging, uploaded its report and then failed the gate check with
"Organization is not allowed to access data from non main branches". A PR analysis reports only
the lines it changes, so the full Rust picture exists only once `main` is analysed; the dispatch
is now refused off `main`.
- **Every tracked image and font was read as UTF-8 text** by the secrets sensor, one warning each,
once `sonar.sources=.` replaced automatic analysis's own scoping.
- **The scanner's signature check works on a Windows runner.** v8 verifies the CLI's OpenPGP
signature by default, and Git for Windows' `gpg.exe` does it; no `skipSignatureVerification`.
- **Cost:** eight to eleven minutes on a Windows runner beside the required checks, three of them restoring
ci-rust.yml's cache read-only. Saving a cache of its own was rejected: the repository is at 8.6 of
its 10 GB, and a fourth Windows cargo cache would evict the ones the required checks restore.
## Standing risks
| Risk | Mitigation |
+2 -1
View File
@@ -82,7 +82,8 @@ pip-audit runs **from a venv of its own** in freeze-file mode: `Engine::freeze`
- **`cargo deny`** checks licences, sources and bans on every PR (`deny.toml`, since 1.4.0). Its licence allowlist — each entry GPL-3.0-compatible — turns THIRD-PARTY-NOTICES' "all bundled licenses are GPL-3.0-compatible" from a sentence into a test for every crate the Windows target resolves, transitive ones included; widening the list is a licensing decision, not a CI fix. Only crates.io may supply a crate — no git dependency, no other registry — and wildcard version requirements are refused. Advisories stay `cargo audit`'s, so there is one ignore list rather than two to keep in step. The npm half of the build has no equivalent licence check.
- `Cargo.lock` and `package-lock.json` committed; builds are `--locked`.
- **The environments PipDock builds for itself install a pinned tree.** Since 1.4.0 `tools/tools-constraints.txt` pins every package beneath the four tools, for the Code Health and the Security-tab venvs alike, so a broken or compromised release of `requests`, `rich` or `msgpack` no longer reaches every user on their next sync (CODE-HEALTH-SPEC §2). The pins are versions, not hashes; `--require-hashes` is in ROADMAP's Audit backlog.
- **Workflows** pin third-party actions by commit — `taiki-e/install-action`, `softprops/action-gh-release`, and `actions/attest-build-provenance` too — while GitHub's own `actions/*` use major tags and the ops repo's reusables `@main`. A write permission sits on the job that needs it, not on the workflow (RELEASE-CI §1).
- **Workflows** pin third-party actions by commit — `taiki-e/install-action`, `softprops/action-gh-release`, `SonarSource/sonarqube-scan-action`, and `actions/attest-build-provenance` too — while GitHub's own `actions/*` use major tags and the ops repo's reusables `@main`. A write permission sits on the job that needs it, not on the workflow (RELEASE-CI §1). A secret sits on the *step* that needs it: `sonar.yml` builds and tests — every crate's build script, every npm package's — before it scans, so `SONAR_TOKEN` is in the scanner step's environment alone, and the version spliced into the scanner's argv is checked against a version's shape first.
- **SonarQube Cloud** analyses every PR and `main` from CI (`sonar.yml`, since 2026-10-25) rather than by automatic analysis, which never saw the Rust code and could import no coverage. Its quality gate is not a required check (RELEASE-CI §2); a red gate on `main` fails the workflow and reaches Discord.
- CodeQL enabled via the ops-repo caller with the established permissions block, over **`javascript-typescript`, `rust` and `actions`**. This bullet said `javascript-typescript` only, because "CodeQL has no Rust analyzer" — which stopped being true in 2025, and the reusable hands any language straight to `codeql-action`. `actions` analyses the workflows themselves: write permissions at workflow level and unpinned third-party actions, the class of mistake SonarCloud had been finding by hand. Only the JavaScript/TypeScript analysis is a required check, so Rust's blocking static analysis is still clippy `-D warnings` plus `cargo audit` in `ci-rust.yml`.
- Third-party licenses tracked in `legal/THIRD-PARTY-NOTICES.md`, which names the **direct** dependencies the manifests declare and is reconciled against them by hand at each release. It is not generated: an earlier revision of both documents claimed `cargo about`/`license-checker` produced it into a `licenses/` directory, and no such config, directory or release step has ever existed. The complete resolved graph is `Cargo.lock` and `package-lock.json`, both committed. Generating the inventory is tracked as a Post-1.0 item; until it lands, the claim here matches what is done — and `cargo deny` checks the Rust licences without writing the inventory.
+3 -1
View File
@@ -72,7 +72,9 @@ The plan was one scripted tauri-driver run on a Windows runner — launch → le
## 3. Coverage & gates
**No coverage is measured.** This section set targets — core ≥ 85 % line coverage (`cargo llvm-cov`), classifiers and plan module ≥ 95 % — that nothing has ever measured: `cargo llvm-cov` is not wired anywhere, and coverage is in ROADMAP's Audit backlog. Until it is, the guarantee is §1's rule — a test that failed first — rather than a percentage.
**Coverage is measured since 2026-10-25, and gated only on new code.** `sonar.yml` runs `cargo llvm-cov --workspace` and `npm run test:coverage` (vitest's v8 provider) on Windows and hands both LCOV files to SonarQube Cloud, whose quality gate asks **80 % of new lines** covered — new meaning since the version in `package.json` last changed. The first measurement, of `main` at 1.4.0: **Rust 71.6 %** of 15 364 lines, **TypeScript 68.4 %** of 1 569. The two large holes are honest rather than unmeasured: `pipdock-cli/src/run.rs` (4 %) is the CLI driving a real interpreter, which L2 exercises and L1 cannot, and `src-tauri/src/commands.rs` (0 %) is the IPC surface, reached only by a running app. `sonar-project.properties` excludes from coverage only what no test here can execute (tooling, spikes, `probe.py`, generated bindings, the two entry points) and says why for each.
This section once set targets — core ≥ 85 % line coverage, classifiers and plan module ≥ 95 % — that nothing measured until then. They are not the gate; the gate is new code, and §1's rule — a test that failed first — is still the guarantee a percentage cannot give. By file, `errors/catalog.rs` is at 99.5 % and `plan/` at 85–99 %.
**Required on every PR** (RELEASE-CI §2 has the exact payload): `fmt · clippy · test` — fmt, clippy `-D warnings`, and `cargo test --workspace`, which is L1, L4 and the Tauri crate's tests; `lint · typecheck · test · build / build` — ESLint, `tsc`, L3 and `vite build`; `cargo audit`; `npm audit`; and CodeQL's JavaScript/TypeScript analysis. `cargo deny`, `tauri lockstep` and CodeQL's Rust and Actions analyses run on every PR and are not required.
+2
View File
@@ -54,6 +54,8 @@ export default tseslint.config(
// walks into them and the type-aware rules crash on files outside the tsconfig program.
ignores: [
'dist/**',
// `npm run test:coverage` output; an HTML reporter there ships its own scripts.
'coverage/**',
'target/**',
'src-tauri/target/**',
'src-tauri/gen/**',
+107 -3
View File
@@ -30,6 +30,7 @@
"@types/react": "^19.3.0",
"@types/react-dom": "^19.3.0",
"@vitejs/plugin-react": "^6.1.2",
"@vitest/coverage-v8": "^5.0.5",
"eslint": "^10.13.0",
"eslint-plugin-react-hooks": "^7.1.1",
"eslint-plugin-react-refresh": "^0.5.7",
@@ -340,6 +341,16 @@
"node": ">=6.9.0"
}
},
"node_modules/@bcoe/v8-coverage": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-1.0.2.tgz",
"integrity": "sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=18"
}
},
"node_modules/@bramus/specificity": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/@bramus/specificity/-/specificity-2.4.2.tgz",
@@ -2172,6 +2183,58 @@
}
}
},
"node_modules/@vitest/coverage-v8": {
"version": "5.0.5",
"resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-5.0.5.tgz",
"integrity": "sha512-4KpkGdIrSqBihx/JyP/e+S+IKB98etg1XDQiLAxksLfcShnwi1VReGeOT9NI43hLHbknosKp/1CCLn9Zgcs8mg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@bcoe/v8-coverage": "^1.0.2",
"@vitest/istanbul-lib-coverage": "^1.0.2",
"@vitest/istanbul-lib-report": "^1.0.2",
"ast-v8-to-istanbul": "^1.0.7",
"magicast": "^0.5.5",
"obug": "^3.0.0",
"std-env": "^4.3.0",
"tinyrainbow": "^3.2.0"
},
"funding": {
"url": "https://opencollective.com/vitest"
},
"peerDependencies": {
"@vitest/browser": "5.0.5",
"vitest": "5.0.5"
},
"peerDependenciesMeta": {
"@vitest/browser": {
"optional": true
}
}
},
"node_modules/@vitest/istanbul-lib-coverage": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@vitest/istanbul-lib-coverage/-/istanbul-lib-coverage-1.0.2.tgz",
"integrity": "sha512-9J/JMwOf9AoJhAywhrn7ScKTL38hsWQP/qPG60OtaAFcQ5OXPwKsxZFlbnuCKmZ61m8/lGgHYnFpdyQZUvG/iA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=22"
}
},
"node_modules/@vitest/istanbul-lib-report": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@vitest/istanbul-lib-report/-/istanbul-lib-report-1.0.2.tgz",
"integrity": "sha512-gUsfXZJbzPamoIY5TvHFiMMoXESBrUMo+xqaj+rYrWI69+EnvRlYBlP96ZnHPY4vX8kyUpgAnFUCg5wZG/HkDQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@vitest/istanbul-lib-coverage": "1.0.2"
},
"engines": {
"node": ">=22"
}
},
"node_modules/@vitest/mocker": {
"version": "5.0.5",
"resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.0.5.tgz",
@@ -2305,6 +2368,25 @@
"node": ">=12"
}
},
"node_modules/ast-v8-to-istanbul": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/ast-v8-to-istanbul/-/ast-v8-to-istanbul-1.0.7.tgz",
"integrity": "sha512-kFL68AG6ajd8fg248zwM9GQrUWEp79gsmjum34OEXjs4yHuUMZfYKwOLW9GMmB4oNvVrj+EAGxsP7ye2UR9UlA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@jridgewell/trace-mapping": "^0.3.31",
"estree-walker": "^3.0.3",
"js-tokens": "^10.0.0"
}
},
"node_modules/ast-v8-to-istanbul/node_modules/js-tokens": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-10.0.0.tgz",
"integrity": "sha512-lM/UBzQmfJRo9ABXbPWemivdCW8V2G8FHaHdypQaIy523snUjog0W71ayWXTjiR+ixeMyVHN2XcpnTd/liPg/Q==",
"dev": true,
"license": "MIT"
},
"node_modules/balanced-match": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz",
@@ -3548,6 +3630,18 @@
"@jridgewell/sourcemap-codec": "^1.5.5"
}
},
"node_modules/magicast": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/magicast/-/magicast-0.5.5.tgz",
"integrity": "sha512-UicdXN8zQ3JHlxVq+28afMXPr1z7WNY6+7EJnzTdQWkTAlMLF5fNCCKxJHBQwGaNGR11581EiQmQzx73+MvszA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/parser": "^7.29.7",
"@babel/types": "^7.29.7",
"source-map-js": "^1.2.1"
}
},
"node_modules/mdn-data": {
"version": "2.27.1",
"resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.27.1.tgz",
@@ -4080,6 +4174,16 @@
"url": "https://github.com/sponsors/SuperchupuDev"
}
},
"node_modules/tinyrainbow": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.2.0.tgz",
"integrity": "sha512-LgO3D9yZJjApUiuUfl9iFAwrtaX4+lok3wJIqttGoKCHlWUqHqbQpnxCf82L8FjgKsh4iGo78hqJwgL8F6To2A==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/tldts": {
"version": "7.4.9",
"resolved": "https://registry.npmjs.org/tldts/-/tldts-7.4.9.tgz",
@@ -4834,9 +4938,9 @@
}
},
"node_modules/zod": {
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz",
"integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==",
"version": "4.6.7",
"resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz",
"integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==",
"dev": true,
"license": "MIT",
"funding": {
+2
View File
@@ -22,6 +22,7 @@
"lint": "eslint .",
"typecheck": "tsc --noEmit",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"test:watch": "vitest",
"tauri": "tauri"
},
@@ -47,6 +48,7 @@
"@types/react": "^19.3.0",
"@types/react-dom": "^19.3.0",
"@vitejs/plugin-react": "^6.1.2",
"@vitest/coverage-v8": "^5.0.5",
"eslint": "^10.13.0",
"eslint-plugin-react-hooks": "^7.1.1",
"eslint-plugin-react-refresh": "^0.5.7",
+82
View File
@@ -0,0 +1,82 @@
# SonarQube Cloud - CI-based analysis, run by .github/workflows/sonar.yml.
#
# Automatic analysis (the SonarCloud GitHub App scanning on its own) was switched off for this:
# it cannot run a build, so it never analysed a line of Rust - two thirds of the code - and it
# could import no coverage at all. It also sent no project version, so the "previous version"
# new-code period stayed anchored to the first analysis (2026-09-27) and "new code" only ever grew.
# The workflow passes `sonar.projectVersion` from package.json, which is one of the five places the
# version lives (CLAUDE.md), so a release bump is what starts a new period.
sonar.organization=poli0981
sonar.projectKey=poli0981_pipdock
sonar.projectName=pipdock
sonar.sourceEncoding=UTF-8
# --- Scope ------------------------------------------------------------------------------------
# Everything tracked, as automatic analysis saw it, with tests split out. Untracked build output
# (target/, node_modules/, dist/, coverage/) is already out: files .gitignore names are never
# indexed. Test patterns appear twice, as sources' exclusions and as tests' inclusions, because
# the two sets must be disjoint or the scanner refuses to index a file twice.
sonar.sources=.
sonar.tests=.
sonar.test.inclusions=\
ui/src/**/*.test.ts,\
ui/src/**/*.test.tsx,\
ui/src/test/**,\
crates/*/tests/**
# Images and fonts are tracked too, and the secrets sensor read every one as UTF-8 text and warned
# about each of them; nothing in them is code.
sonar.exclusions=\
ui/src/**/*.test.ts,\
ui/src/**/*.test.tsx,\
ui/src/test/**,\
crates/*/tests/**,\
**/*.png,\
**/*.ico,\
**/*.icns,\
**/*.woff2
# Fixtures are data, not code: captured engine output, and sample Python projects that are broken
# on purpose so that Code Health has something to find.
sonar.test.exclusions=\
crates/*/tests/fixtures/**,\
crates/*/tests/snapshots/**
# --- Coverage -----------------------------------------------------------------------------------
# Rust from cargo-llvm-cov and TypeScript from vitest's v8 provider, both LCOV. Clippy's JSON is
# imported as external issues; `-D warnings` in ci-rust.yml keeps it empty on any green build, so
# what it adds is the finding on the line, in the PR, when that build is red.
sonar.rust.lcov.reportPaths=target/lcov-rust.info
sonar.rust.clippyReport.reportPaths=target/clippy.json
sonar.javascript.lcov.reportPaths=coverage/lcov.info
# What no test in this repository can execute, so a 0% here would measure nothing:
# * xtask, scripts/ and the root *.config files are developer tooling, run by hand;
# * spikes/ are the research scripts the adapters were built from (spikes/README.md);
# * probe.py runs inside the user's interpreter - the Rust suite parses canned output, and only
# ci-integration.yml runs it for real;
# * generated.ts is `cargo run -p xtask -- bindings` output, and the two entry points mount what
# the tests render directly.
sonar.coverage.exclusions=\
xtask/**,\
scripts/**,\
spikes/**,\
*.config.ts,\
*.config.js,\
crates/pipdock-core/examples/**,\
crates/pipdock-core/src/probe.py,\
src-tauri/build.rs,\
src-tauri/src/main.rs,\
ui/src/main.tsx,\
ui/src/ipc/generated.ts
# Regenerating the bindings rewrites dozens of near-identical type declarations at once, which
# would read as new duplication on the next analysis without anyone having copied anything. Test
# files never count toward duplication, but the Rust sensor computed theirs anyway and logged a
# warning per file saying it would be dropped.
sonar.cpd.exclusions=\
ui/src/ipc/generated.ts,\
crates/*/tests/**
# --- Languages ----------------------------------------------------------------------------------
# probe.py's floor and ceiling (ARCHITECTURE section 10: managed Pythons 3.10-3.14).
sonar.python.version=3.10,3.11,3.12,3.13,3.14
+18
View File
@@ -67,5 +67,23 @@ export default defineConfig({
setupFiles: [fileURLToPath(new URL('./ui/src/test/setup.ts', import.meta.url))],
include: ['ui/src/**/*.test.{ts,tsx}'],
root: fileURLToPath(new URL('.', import.meta.url)),
// Off unless asked for (`npm run test:coverage`): sonar.yml imports the LCOV, and nothing
// else reads it, so the plain `npm test` the ops-repo reusable runs stays as fast as it was.
coverage: {
provider: 'v8',
// `lcovonly`: `lcov` adds an HTML report beside the file Sonar reads.
reporter: ['text-summary', 'lcovonly'],
reportsDirectory: 'coverage',
include: ['ui/src/**/*.{ts,tsx}'],
// Tests and their harness are not code under test. `generated.ts` is emitted by
// `cargo run -p xtask -- bindings` and is types alone; `main.tsx` mounts <App/> into the
// real DOM, which is what App.test.tsx renders instead.
exclude: [
'ui/src/**/*.test.{ts,tsx}',
'ui/src/test/**',
'ui/src/ipc/generated.ts',
'ui/src/main.tsx',
],
},
},
})