Repository navigation
Measure the condition gate on Windows, macOS and Linux on demand - #1211
Conversation
A figure for a whole package on Windows or macOS could only be taken by hand on a machine of that system: the internal/toolutil figures quoted in #1206 came from a Windows virtual machine, and none could be taken on macOS. .github/workflows/conditions.yml takes them when dispatched, and on nothing else. It runs scripts/coverage-conditions.sh through bash on each runner named, exactly as the CI legs and make coverage-conditions run it, so every figure is the one the gate computes on that system. The packages default to every package whose built files differ between two of the platforms .goreleaser.yml builds (cmd/server, internal/toolutil and internal/tools/packages today), the gate is all or beyond:linux/amd64, and the systems are any of windows-latest, macos-latest and ubuntu-latest. The plan and the job summary are a new command, cmd/measure_conditions: one row per package and runner with gobco's figure, every condition not evaluated both ways with its file and line, and why a run that could not measure could not. Each run's raw output and record are uploaded as an artifact. No figure fails the workflow; a run that cannot measure fails its own job and says why. To tell the two apart, the script now exits 3 when its gate holds a condition, a status no other failure uses. Every caller that only asks whether a run passed reads any non-zero status as before. Closes #1210
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (34)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughThis change adds a manually dispatched condition-coverage workflow and the ChangesCondition coverage measurement
Priority: ⬇️ Low Estimated code review effort: 4 (Complex) | ~60 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
actor Operator
participant ConditionsWorkflow
participant MeasureConditionsPlan
participant CoverageScript
participant ArtifactStorage
participant MeasureConditionsSummarize
Operator->>ConditionsWorkflow: Dispatch with package, runner, and gate inputs
ConditionsWorkflow->>MeasureConditionsPlan: Plan package-runner matrix
MeasureConditionsPlan-->>ConditionsWorkflow: Return matrix
ConditionsWorkflow->>CoverageScript: Run coverage script for each matrix entry
ConditionsWorkflow->>ArtifactStorage: Upload run record and raw output
ConditionsWorkflow->>ArtifactStorage: Download available measurement artifacts
ConditionsWorkflow->>MeasureConditionsSummarize: Summarize plan and downloaded records
MeasureConditionsSummarize-->>ConditionsWorkflow: Write Markdown coverage summary
Merge Risk: ⚪ Minimal · up to The workflow is mergeable after normal checks. Its first manual cross-platform dispatch remains to be completed after it reaches the default branch. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The workflow adds optional measurements without granting repository-write permissions or weakening existing gates. Input validation limits runner selection and shell-facing values. Remaining uncertainty concerns report freshness after interrupted reruns, rather than demonstrated access to production systems. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|



The condition gate (gobco, through
scripts/coverage-conditions.sh) runs on Linux before I commit, and since #1206 the Windows and macOS legs of CI gate only the files those systems alone build. A figure for a whole package on Windows or macOS still had to be taken by hand: theinternal/toolutilfigures I quoted in #1206 came from a Windows virtual machine, before 20 more conditions landed inerrors.go, and I had no way to take them on macOS at all..github/workflows/conditions.ymlmeasures it on demand. It is triggered byworkflow_dispatchand by nothing else, takes the packages, the gate (allorbeyond:linux/amd64) and the systems (windows-latest,macos-latest,ubuntu-latest), and fans out over package by system. Each run isscripts/coverage-conditions.shthrough bash, exactly as the CI legs andmake coverage-conditionsrun it, so every figure is the gate's own on that system. An empty package list means every package whose built files differ between two of the platforms.goreleaser.ymlbuilds, found by listing the module under each of them, which today iscmd/server,internal/toolutilandinternal/tools/packages.The summary job writes one table into the job summary: package, system, gobco's figure as covered of total, how many conditions were not evaluated both ways and how many of those the gate held, then every such condition with its file and line (a condition written across lines is joined onto one, so it stays one row), then why any run that could not measure could not. Each run's raw gobco output and its record are uploaded as an artifact. No figure fails the workflow; a run that cannot measure at all (a package go cannot load, a failing test, a 0/0 report, a runtime crash) fails its own job and says why in one annotation. The measuring step removes setup-go's problem matcher before the script prints anything: it would file every condition gobco names as an error annotation, so a run that measured would look failed, and past GitHub's ten per step the step's own annotation would be dropped.
To tell a held figure from no figure,
scripts/coverage-conditions.shnow exits 3 when its gate holds a condition, a status no other failure uses: every other one exits 1 or 2 (go runreports any failure of gobco as 1). The CI step, the Makefile target andscripts/check-spec-conditions.shread any non-zero status as a failure, as before, and the script's Python tests now pin 3 for the gate.The plan and the table are a new command,
cmd/measure_conditions, rather than shell in the workflow.planvalidates the inputs (only the three hosted runners, a package path in the characters this module's directories use, a gate the script reads) and prints the matrix;summarizereads the records wherever download-artifact puts them, joins them to the plan, and refuses a record that disagrees with the plan or with its own status rather than tabulating a guess. Its tests hold the workflow file to the record format they read. It is at 100% of statements, 174/174 conditions under gobco, and 108 mutants killed with none lived or not covered under gremlins.The workflow holds
contents: readand nothing more, everyuses:is pinned to the SHAci.ymlalready pins, and no step resolves code at run time.make check-supply-chainpasses, and so does actionlint 1.7.7 with shellcheck on it.docs/development/testing/README.mdsays how to dispatch it and that its figures are measured, not inferred.docs/development/cmd-utilities.md,CLAUDE.md, the Copilot instructions and the testing reference name the new command, and the testing reference records its measured coverage rather than n/a.GitHub offers a workflow for dispatch only once its file is on the default branch, so this pull request cannot run it. The first dispatch happens after the merge, for
cmd/serverandinternal/toolutilon all three systems, and it is what the issue's last acceptance line asks for:gh workflow run conditions.yml -f packages="./cmd/server ./internal/toolutil" -f systems="windows-latest macos-latest ubuntu-latest" -f gate=all. I will link that run on the issue, and reopen it if the run does not produce the table.Closes #1210