For a long time, I required the entire test suite to pass on my machine before merging a change into Protos. I was building a language, its runtime and its standard library at the same time. A change to how calls execute could break a parser test, an I/O operation or a seemingly unrelated library.
In one local run under the old workflow, make check-all took 31 minutes and 40 seconds, with six Java workers and eight Protos workers. The Protos tests took 24 minutes and 20 seconds, and peak memory was about 9.7 GiB. The target has since changed. Those numbers describe that particular run.
An earlier validation run during the HMAC implementation executed 3,708 Protos cases. A later FULL run recorded 1,572 Core cases and 6,010 library cases, for 7,582 Protos cases, in addition to the Java, interoperability and native executable tests. The runs covered different scopes and give a sense of the scale the suite reached. HMAC validation · Matrix measurements
Half an hour before merging a change may sound reasonable. Repeating that every time I fix something or update a branch onto main puts validation on the critical path of each iteration. I now run focused tests locally and finish with make check-all. GitHub Actions runs exhaustive validation before the PR can enter main.
Local workers and distributed shards
--jobs controls how many cases can execute concurrently in a single invocation. Those workers share a runner’s CPU and memory. Sharding distributes the plan across runners, each with its own workers. From a prepared checkout, I can list and run the second of four shards:
bin/protos test --list-cases --shard-count 4 --shard-run 2
bin/protos test --shard-count 4 --shard-run 2 --jobs 2
The partitioning logic lives in the Test Tool itself, implemented in Protos. The tool discovers and validates an ordered plan, applies the selection filters and partitions the result in round-robin order. With positions starting at zero, position i belongs to shard i % N + 1. With four shards, the second gets positions 1, 5, 9 and so on. The index spans the whole selected plan, and partitioning preserves each case’s identity and relative order.
Each position has a unique remainder when divided by N. Given the same ordered plan and the same N, the shards are disjoint and their union covers the entire plan. --list-cases shows the selection without running test bodies. To reproduce a failure locally I can use the same revision, scope, shard count and shard index. With no sharding flags, the tool runs the entire selected plan. Sharding contract and implementation
The slowest shard sets the pace
Round robin balances the number of cases. In a run with four library shards, each had 1,502 or 1,503 cases. The fastest took 399 seconds to execute them and the slowest took 616. The slowest job took around 867 seconds end to end, including about 160 seconds spent producing the two case listings used to verify partition membership.
The phase ends when the last job the aggregator depends on finishes. Each runner also has to prepare its environment, obtain dependencies, package the CLI where needed and discover the cases. Adding shards can reduce elapsed time while increasing total runner time. The current configuration gives Core two shards, the full library suite six, and an individual library four when selected separately. Timings help diagnose and tune the pipeline. Case assignment remains deterministic. Measurements and matrix tuning
What GitHub Actions has to prove
Protos shards are one part of the matrix. JUnit has parallel partitions and a serial job for tests that require it. Separate jobs cover interoperability, compilability checks and Native Image. Native validation uses an optimized production image for executable regressions and a quick-build image for native TLS tests.
The preparation job establishes what the run must validate. An aggregator checks those requirements against evidence tied to the revision. For Protos, it verifies the expected scopes and shards, the plan’s identity, how many cases each partition listed and how many passed. A missing or duplicate result, evidence from a different revision or a shard failure makes the aggregate fail. An empty shard is valid when the plan assigns it zero cases.
With fail-fast: false, other shards can finish and upload diagnostics after one fails. I can distinguish a case failure, a problem affecting multiple partitions and a runner setup error. CI workflow · Validation and local reproduction
The PR is the gate into main
The policy changed after a real failure. Local validation passed for PERF057 and I pushed the change. CI subsequently found 15 failed assertions in structural Java tests. By then the commit was already on main.
- I run focused tests for the change and its regressions.
- I run
make check-all, which combines repository checks with a fast selection of tests. - I open a PR. GitHub Actions runs the
FULLprofile and reports the aggregate asprotos-pr-exhaustive. - GitHub requires that check to pass and the branch to be up to date with
main. With auto-merge enabled, GitHub merges the PR when the conditions are met.
Two PRs can pass independently on the same base. Once A lands, the interesting question is whether B passes with A already present. Git can apply both patches cleanly and the result can still fail at runtime. Strict branch protection requires validation of the updated candidate. Post-merge CI still checks the revision that landed on main. Incident and integration policy
The POM and changelog also caused conflicts
Finishing a change used to mean bumping the version in pom.xml and editing CHANGELOG.md. Two branches with compatible code changes could still collide on the same line in the POM and the same block in the changelog.
The POM now keeps a -SNAPSHOT version throughout the development cycle. V-SNAPSHOT becomes V when preparing a release candidate. Opening the next cycle establishes the new development version. A regular PR that needs a changelog entry adds its own Markdown file under changelog/pending/. Normative specification changes use spec/changelog/pending/. Release preparation explicitly consolidates the fragments into the corresponding changelogs.
Two commits can share a Maven version and produce different binaries. CI evidence is tied to the exact revision. For local Native Image installations, Protos distinguishes builds of the same SNAPSHOT by a digest of the checksum inventory, so the builds can coexist. Release-cycle versioning and changelog fragments
Auto-rebase updates the next PR
Updating every PR whenever main advances would start several exhaustive validation runs. Merging the first would leave the other branches behind again. The workflow processes at most one eligible PR per run, in the order auto-merge was enabled. It considers open, non-draft maintainer PRs whose branches are in the same repository.
If the branch is already current, the workflow stops. If it is behind, the workflow rechecks the base and the branch head before asking GitHub to rebase it. The request includes expectedHeadOid, the commit it expects to find. If I have pushed another commit in the meantime, GitHub can reject the update.
Just after main advances, GitHub may return UNKNOWN while it computes mergeability. The workflow polls for a limited time. It stops on a conflict or if it detects that the base or candidate changed during selection. After a successful rebase, the updated candidate must pass exhaustive CI again. GitHub applies its native auto-merge and the protection rules for main. Auto-rebase workflow
What changed in day-to-day work
When I touch the parser or a library, I can focus local iteration on the tests that give me immediate feedback. When the PR is ready, GitHub validates the whole candidate. If a shard fails, I have its scope, index and logs to reproduce it. If another PR lands in the meantime, integration waits for the next candidate to be validated against the new main.
That is what I wanted to preserve from requiring the full suite locally. Before accepting a change, I want to know the whole system works. The protected branch now enforces that check on the candidate about to be merged.
If you have split a test suite across multiple runners, I would like to hear how you verify that they cover the whole plan and what you do when one shard takes much longer than the others. Join the conversation on r/Protos or follow the project on ProtosLang on X (Twitter).