docs(sonar): a version bump moves the new-code baseline one analysis late (#93)

The analysis that first sent 1.4.0 still measured from 2026-09-27; the
next measured from the last analysis of the version before (2026-10-20).
The docs said the version did not move it at all. They now say when it
does, what that means for the merge carrying a release bump, and what
main's gate read after #91.

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 07:47:58 +07:00
1 parent 41ab1e8085
commit 0112b000ec
4 files changed
+18 -11

No files matched your search

+5 -3
View File
@@ -92,9 +92,11 @@ 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*, with the version from `package.json` — but the
first analysis to send one (`1.4.0`) kept the 2026-09-27 baseline, so read `periods` from
`api/qualitygates/project_status` after the next bump instead of assuming it moved. New code needs
went. The gate's "new code" is *previous version*, with the version from `package.json`, and a
bump takes effect **one analysis late**: the analysis that first sent `1.4.0` still measured from
2026-09-27, and the next measured from the last analysis of the version before it (2026-10-20,
`a314689`). So the merge carrying a release bump is gated on the whole previous period, and
`periods` in `api/qualitygates/project_status` says which baseline a gate used. New code needs
80 % coverage and no new issue, so a slice whose new lines no test reaches turns `main`'s gate red,
and so does a `std::fs` call inside an `async fn` (`rust:S7493`) or a tracing field named
`message` (`rust:S6677`). Dependabot PRs have no `SONAR_TOKEN` and skip the analysis.
+9 -5
View File
@@ -1439,7 +1439,7 @@ are required, every PR would have been red as well. Dependabot opened a PR for n
|---|---|
| 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`, which the previous-version period keys on — though sending the first one did not move it (below) |
| New code | `sonar.projectVersion` from `package.json`, which the previous-version period keys on — one analysis late (below) |
| 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 |
@@ -1467,15 +1467,19 @@ are required, every PR would have been red as well. Dependabot opened a PR for n
`async fn`: the tools-venv sync, Code Health's deptry report, and the four commands that write or
read a file the user chose, on what may be a network drive. They go through `tokio::fs` now.
And **new-code coverage 78.3 %** against 80 %.
- **Sending a version did not move the baseline.** The analysis that first sent `1.4.0` still
measured new code from 2026-09-27, so "new" was all of 1.4.0's audit — 4 037 lines, 849 of them
uncovered. The answer was tests rather than a setting: the restore half of `execute_rollback`, a
- **Sending a version moves the baseline one analysis late.** The analysis that first sent
`1.4.0` still measured new code from 2026-09-27, so "new" was all of 1.4.0's audit — 4 037
lines, 849 of them uncovered; the one after it measured from the last analysis of the version
before (2026-10-20). Waiting a merge would have turned the gate green by itself, and that was
not the answer: the lines were untested either way, and a release bump will gate the next
merge on its whole period exactly like this. The answer was tests: the restore half of `execute_rollback`, a
force the environment's Python cannot run, PEP 691 parsing (split out of `index::refresh`, with
L55's empty list finally under test), `user_file_error` (U25), a plan verified against another
environment, the cached half of `release::PyPiReleases`, and the store paths no test had driven
— a resolve that succeeds, a round of decisions, a rollback preview, and late answers on the
error paths. `InstallSet::only` had no caller and went. Estimated against Sonar's own per-line
data before pushing, by a script that reproduced its 78.28 % exactly: 81.2 %.
data before pushing, by a script that reproduced its 78.28 % exactly: 81.2 %. Measured on
`main` after #91: **81.2 %, gate passed, 0 open issues, every rating A**, overall 72.3 %.
- **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.
+1 -1
View File
@@ -72,7 +72,7 @@ The plan was one scripted tauri-driver run on a Windows runner — launch → le
## 3. Coverage & gates
**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 previous version's period began, which at the switch was still the first analysis (2026-09-27), so all of 1.4.0 counted. 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.
**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 last analysis of the previous version. A bump moves that one analysis late, so the first analysis to send `1.4.0` still measured from 2026-09-27 and all of 1.4.0 counted; it took tests for that code to pass (ROADMAP, "After 1.4.0"), and reached **81.2 %** with the overall figure at 72.3 %. 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 %.
+3 -2
View File
@@ -5,8 +5,9 @@
# 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) and what the previous-version period keys on. The first analysis to
# send one kept the old baseline; whether a bump moves it is to be read from the gate, not assumed.
# version lives (CLAUDE.md) and what the previous-version period keys on, one analysis late: the
# first analysis with a new version is still measured against the old period, and the next one
# from the last analysis of the version before.
sonar.organization=poli0981
sonar.projectKey=poli0981_pipdock