Repository navigation
ci: serialize local CI runs per checkout and fix load-only test flakes - #705
Merged
Merged
Conversation
java-reactor (NoClassDefFoundError) and the Rust api_contract corpus (404 on the approve route) failed because two scripts/ci-local.sh runs shared one checkout: one run's `mvn clean` deleted the classes the other's tests loaded, and cargo treats a generated path crate at the same workspace-relative path as one build, so one run's probe linked the other corpus's code. ci-local now claims the checkout (a pid + start-time file in the worktree's git dir) and a second run refuses, naming the first; scripts/test-ci-checkout-claim.sh pins it in gates. The Rust test harness also holds an exclusive lock on the shared gen-check target for each generated workspace's lifetime, so parallel tests in one binary and concurrent cargo test processes cannot run each other's probes. conformance: typescript failed on the eject-contract depth test's 60s limit: it built one TypeScript program per ejectable generator. It now builds one program for all owned copies and scans each copy through it (98.8s -> 14.2s at load ~200).
…3.26
The 1.3.1 lockfile regen moved mysql2 from 3.24.6 to 3.26.1, which no longer
fetches the server's RSA key for caching_sha2_password over a non-TLS
connection. MySQL 8.4 authenticates root that way, so every connection to the
test container was refused (PUBLIC_KEY_RETRIEVAL_NOT_ALLOWED) and all seven
MySQL files in ts-slow timed out at the 180s readiness deadline on every main
push since. The container URL now carries allowPublicKeyRetrieval=true, which
every consumer (bare URL or { uri }) picks up; the risk the default guards
against does not apply to a throwaway server on 127.0.0.1.
The readiness timeout now reports the last connect error: it printed only the
server log, which showed a ready server and hid the client-side refusal.
The integration suite's reaper-kill test starts `ci-local.sh --integration-only --only python` from inside a full run so it can kill it. The one-run-per-checkout claim refused that nested run, so its sidecar never started and the test failed on every full run. The claiming run now exports its claim as MO_CI_CLAIM_HOLDER; a run that inherited exactly the live claim runs without taking or releasing it. A run started from anywhere else does not carry the variable and is still refused. scripts/test-ci-checkout-claim.sh pins the export, the nested case and the refusal of a run carrying some other claim.
# Conflicts: # scripts/ci-local.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
scripts/ci-local.shnow claims its checkout through a pid-and-start-time file in the worktree's git directory. A second run in the same checkout refuses and names the first. A stale claim from a killed run is replaced. A run started by the claimant inherits the claim throughMO_CI_CLAIM_HOLDER.scripts/test-ci-checkout-claim.shtests this and runs in thegateslane.generated_workspaceholds an exclusive lock on the shared target directory for the life of the returnedWorkspace, so parallel workspaces take turns.copy_treenow reads and writes file bytes instead of usingfs::copy. The per-testBUILDmutex inrender_helper_conformance.rsis removed.allowPublicKeyRetrieval=trueto its URL and reports the last connect error on readiness timeout.CONTRIBUTING.mddocuments the one-run-per-checkout rule and the lock-removal step.Intentional rider: MySQL integration tests on main
Not a load flake, but in this PR on purpose: main's
ts-slowlane failed on every push from 2026-12-03 (5 local-ci runs checked, e.g. run 47084122616). The 1.3.1 lockfile regen moved mysql2 from 3.24.6 to 3.26.1, which refusescaching_sha2_passwordpublic-key retrieval over non-TLS, so every connection to the throwaway MySQL 8.4 container was refused and all 7 MySQL test files timed out at the 180s readiness deadline. It reproduced locally with no load. The container URL now carriesallowPublicKeyRetrieval=true(a throwaway server on 127.0.0.1), and the readiness timeout reports the last connect error, which the server log alone had hidden.Full-parallel local CI evidence
Before (2026-12-01):
scripts/ci-local.shrunning 8 lanes at once failedjava-reactor(NoClassDefFoundError),conformance: rust(api_contract 404 on the approve route) andconformance: typescript(the eject-contract depth test over its 60s limit); each was green rerun alone. Cause for Java and Rust: two ci-local runs in one checkout rebuildingserver/javaandserver/rustunder each other. Cause for TypeScript: one compiler program per ejectable generator (98.8s -> 14.2s at load ~200 after the fix).After, flagless
scripts/ci-local.sh --strict-toolchains, 8 lanes at once on a 32-core machine at load average ~26:java-reactor,conformance: rust,conformance: typescriptand every other lane green, exceptintegration-tests (ts)(reaper-kill's nested ci-local was refused by the new checkout claim; fixed in this PR byMO_CI_CLAIM_HOLDER) andinstall size budget(staledist/in a reused worktree; a clean rebuild measured 36146236 bytes, identical to main)java-reactor(9m17s),conformance: rust(6m57s),conformance: typescript(7m40s) andintegration-tests (ts)green, the last including all 7 MySQL files. The C# lane and the showcase check failed in seconds on danglingobj/links into a cleared RAM scratch directory (environment); rerun after restoring them:conformance: csharp,export surface (csharp),integration-tests (csharp)and the showcase check greenThe 7 MySQL files alone, under mysql2 3.26.1 against real MySQL 8.4 containers: 410 pass, 0 fail. The review round's later changes (atomic stale-claim takeover, TZ-pinned start time, byte copies in the Rust test harness) landed after runs 5 and 6; the checkout-claim test covers the first two, and hosted CI covers the rest.
Validation took 2 no-mistakes runs: the first opened this PR, and the second pushed the merge of main after #704 conflicted in
ci_cleanup.Validation
Risk Assessment
✅ Low: The changes are confined to CI scripts, test harnesses and a docs paragraph, and tracing the claim takeover, nested-run, workspace-lock and shared compiler-program paths found no new material defect beyond items already decided in earlier rounds.
Testing
Drove the checkout-claim fix live through the real ci-local.sh in a throwaway repo; all 17 checks passed, covering refusal under a live claim, stale-claim takeover, the TZ-pinned start-time comparison, and claim release on exit. The Rust mtime/serialization, MySQL and java-reactor fixes were not driven live (heavy build or container outside budget), so the intent to fix those load-only lanes is not yet demonstrated. Evidence is the script output above; no artifact file written. Scratch dirs removed; worktree clean.
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
scripts/ci-local.sh --affected --strict-toolchainsscripts/test-ci-checkout-claim.sh with DEV_SCRATCH set to a throwaway dir: runs the real scripts/ci-local.sh in a throwaway git repo with a stand-in cargo. Exit 0, all checks passed.Covered: free checkout claimed; live claim refused; refusal leaves claim in place; live claim refused from another TZ; nested run inherits claim; stale claim replaced (pid reused or process gone); two runs after one stale claim, only one wins; ci-local.sh refused while live claim exists (exit 2) and runs no lane; claimed run reaches lane; second concurrent run refused; claim file removed after claimed run exits.Baseline: configuredscripts/ci-local.sh --affected --strict-toolchainspassed at this target commit (not re-run).✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.