← Back to Pull requests

Run the matrix generator from a cached Swift package build #359

Closed
unknown closed this pull request without merging on Nov 17, 2026 23:20 UTC
View on GitHub
unknown unknown commented on Nov 17, 2026 17:29 UTC
Author

Run the matrix generator from a cached Swift package build

Every generate job compiled generate-matrix.swift before it could print a matrix, costing ~33s. If we make use of GitHub actions caches to cache the matrix generation binary we can speed this up. This also changes the matrix generation to use a Swift Package which allows for a tidier code structure.

Changed:
Moved the generator into the matrix-generator package as the generate-matrix executable, with its tests.
Added the generate-matrix composite action, which restores the built generator from actions/cache and builds it only on a miss.
Keyed the cache on the runner, the runner image version (or swift --version where there is none), and a hash of the package sources.
Switched the generate step of package_test.yml, toolchain_matrix.yml and benchmarks.yml to the action.
Moved the benchmark command and environment composition into its own step ahead of the action.
Located the built executable from the tests on both macOS and Linux.
Made the default-agreement test check that a workflow forwards some input, not that emptying the inputs changed it.

Performance:

Measured on GitHub-hosted ubuntu-26.04 runners, one run each, from the first step of the action to the end of its post step.

The previous step compiled the script on every run and took about 33 seconds.
A cache miss takes about 36 seconds. Building the generator is 32 of them, and 18 of those are SwiftPM starting up on a runner that has not run Swift yet. Running it takes 2.4, and saving the cache 1.2.
A cache hit takes about 5 seconds. Restoring the generator is 0.8, running it 4.4, and building is skipped.
Naming the toolchain with swift --version took 9.5 and 20.1 seconds on a fresh runner, so a hit spent most of its time producing its key. The image version takes 0.05.
A repository pays one miss per change to the generator, and a pull request's first run builds again after it merges, because a cache saved by a pull request is only visible to it.

Result:
A generate job that hits the cache is about 28 seconds faster, and one that misses is about 3 seconds slower.
The generate jobs of one run share the build: a job that saves it is followed by jobs that restore it.

Diff: 283 lines (+212 / -71) across 3 files Reviewer: FranzBusch Review duration: 350m
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 283 lines diff across 3 files
0.40
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.338
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #359"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 39.7% (MEDIUM) · Higher = larger blast radius
39.7%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 15.7% · Safe to merge
15.7%