Skip to content

#624 Nightly macOS: run the gate's own shard plan sequentially, on a RAM disk - #640

Merged
nockawa merged 2 commits into
mainfrom
ci
Aug 1, 2026
Merged

nockawa merged 2 commits into
mainfrom
ci

Conversation

@nockawa

@nockawa nockawa commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #638. Two problems with that first revision, both fixed by separating how much runs at once from what runs.

Selection — the nightly was running tests the gate deliberately skips

The nightly handed shard.py a custom single-shard catch-all plan instead of the gate's shards.json. That silently ran 32 extra tests: NUnit runs [Explicit] tests when it reads the filter as naming them, and a 2-term category filter qualifies where the gate's 305-term one does not. So a change made purely for concurrency reasons quietly changed the test set.

Those tests say why that is wrong on a 3-core hosted runner, in their own attributes:

[Explicit("Stress test — spawns 16-32 threads, run manually to avoid thread pool saturation in parallel CI")]
[Explicit("Performance benchmarks — run manually")]

Fix: a new SHARD_CONCURRENCY knob in shard.py caps how many shards run at once without touching the plan. The nightly now runs the gate's shards.json with SHARD_CONCURRENCY=1 — nightly and gate selection are identical by construction, not by two mechanisms that have to be kept in agreement.

SHARD_CONCURRENCY defaults to len(shards), so the gate and every local run are unchanged. Verified by re-running the default path against the modified script: 8 shards, 8 at a time, 4158 tests, green.

Dead end worth recording: NUnit's ExplicitMode runsettings knob was tried first and had no effect at any value. If someone reaches for it later — its default is Strict, which only stops Explicit tests being mixed with non-Explicit ones, and the value the docs recommend for CI is None. Neither changed the count here.

I/O — test databases move to a RAM disk

The suite roots every database directory at Path.GetTempPath() (58 files, including TestBase and AllocatorTestBase), and .NET resolves that through TMPDIR on Unix. So one env var moves all test I/O — main database file and WAL alike — off the runner's disk. Same lever the self-hosted c6id gate pulls with TMPDIR=/nvme in run-gate.sh.

Why: two runs of identical code took 113 s and 616 s, with the 500 s concentrated in fsync-heavy reopen tests (WAL_*_SurvivesReopen, WalSegmentReclaimReopen, UowRegistry overflow pages), while the same commit runs in 90 s on a developer machine. Hosted-runner disk throughput is the variable, not the engine.

Sized at 2 GiB against a measured ~32 MiB suite footprint (the GiB-scale temp dirs on a dev box belong to benchmarks and AOT POCs, not this suite). The job summary prints df so it can be right-sized from data rather than guessed at twice.

Verified locally

  • Sequential gate plan: 4191 → 4158 tests, green, 107 s.
  • Absent: OlcBTreeStressTests, OlcBTreeRaceStressTests, SpatialPerfTests, SubscriptionStressTests, ConcurrencyTracingStressTests, DagSchedulerCpuTests, RawValueHashMapScaleRepro.
  • Mixed-class check: the three [Explicit] benchmarks in DagSchedulerLatencyTests are excluded while its plain test still runs.
  • Default gate path re-run against the modified shard.py: unchanged, green.
  • YAML, every shell block and both embedded Python blocks parse.

Not verifiable off-runner: the RAM-disk step itself (hdiutil / diskutil are macOS-only). The run on this PR is that test.

Still open, unchanged by this PR

  • WalCommitBuffer.cs:452 passes ctx.Deadline.Remaining as the wait duration to ThrowWalBackPressureTimeout. Remaining is ~0 by definition once the deadline has expired, so the exception can only ever report "timeout after 0ms" — it should carry elapsed wait time.
  • 4 non-[Explicit] tests run under a plain catch-all filter but not under the gate's K=8 plan (SeqlockCounterSlotReuseTests.SlotReuseUnderCachePressure_…, WalSegmentReclaimReopenTests ×2, PagedHashMapTests.Stress_Torture_32Threads_AllOperations). Selection parity means the nightly now misses them too. Not root-caused; a gate coverage hole in its own right.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LKFzE7MqQUj13s8a7q895D

nockawa and others added 2 commits August 1, 2026 12:42
…RAM disk

Two problems with the first revision, both fixed by separating "how much runs at once" from "what runs".

Selection. The nightly handed shard.py a custom single-shard catch-all plan instead of the gate's shards.json, and that silently ran 32 tests the gate deliberately skips. NUnit runs [Explicit] tests when it reads the filter as naming them, and a 2-term category filter qualifies where the gate's 305-term one does not — so a change made purely for concurrency reasons quietly changed the test SET. The tests in question say why that is wrong on this runner: "spawns 16-32 threads, run manually to avoid thread pool saturation in parallel CI" and "Performance benchmarks — run manually". Thread-saturating stress tests on a 3-core hosted runner measure the runner.

The fix is a new SHARD_CONCURRENCY knob in shard.py that caps how many shards run at once WITHOUT touching the plan. The nightly now runs the gate's shards.json with SHARD_CONCURRENCY=1, so nightly and gate selection are identical by construction rather than by two mechanisms that have to be kept in agreement. Default is len(shards), so the gate and every local run are byte-identical to before — verified by re-running the default path against the modified script: 8 shards, 8 at a time, 4158 tests, green.

NUnit's ExplicitMode runsettings knob was tried first and had no effect at any value. Worth knowing if someone reaches for it later: its default is Strict, which only stops Explicit tests being MIXED with non-Explicit ones, and the value the docs recommend for CI is None — neither changed the count here.

I/O. Test databases now live on a 2 GiB RAM disk via TMPDIR. The suite roots every database directory at Path.GetTempPath() — 58 files do, including TestBase and AllocatorTestBase — and .NET resolves that through TMPDIR on Unix, so one env var moves the main database file and the WAL alike off the runner's disk. Same lever the self-hosted c6id gate pulls with TMPDIR=/nvme. Two runs of identical code took 113s and 616s, with the 500s concentrated in fsync-heavy reopen tests, while the same commit runs in 90s on a developer machine: hosted-runner disk throughput is the variable. 2 GiB against a measured ~32 MiB suite footprint; the summary prints df so it can be right-sized from data rather than guessed at twice.

Verified locally: sequential gate plan 4191 -> 4158 tests, green, 107s, with OlcBTreeStressTests, OlcBTreeRaceStressTests, SpatialPerfTests, SubscriptionStressTests, ConcurrencyTracingStressTests, DagSchedulerCpuTests and RawValueHashMapScaleRepro all absent, and the three [Explicit] benchmarks inside the mixed DagSchedulerLatencyTests excluded while its plain test still runs. The RAM-disk step itself is macOS-only and could not be exercised off-runner.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LKFzE7MqQUj13s8a7q895D
`hdiutil attach -nomount` pads its output to a fixed width ("/dev/disk6          "), and diskutil will not resolve a device path with trailing whitespace. It fails with "Unable to find disk for /dev/disk6" — where the padding is invisible in the message, so the error reads like the device does not exist rather than like a quoting bug.

Caught by the run on PR #640, which is what the pull_request path filter on this workflow exists for: the RAM-disk step is macOS-only and cannot be exercised off-runner.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LKFzE7MqQUj13s8a7q895D
@nockawa
nockawa merged commit 455dc74 into main Aug 1, 2026
9 checks passed
@nockawa
nockawa deleted the ci branch August 1, 2026 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant