Skip to content

#624 Nightly arm64 unit-test run on a GitHub-hosted macos-15 runner - #638

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

What

A nightly (03:00 UTC) workflow that runs the Typhon.Engine suite on a GitHub-hosted macos-15 runner — Apple Silicon, i.e. a genuinely weakly-ordered arm64 target. Non-blocking, never a required check.

Why this, and not the [use-arm] Graviton token

This is not an implementation of issue #624 — it is the cheaper alternative discussed there. Two reasons that issue's premise doesn't hold up as scoped:

  1. A functional suite on arm64 cannot catch the class that motivated it. claude/rules/durability.md → SL-07 says so directly: the failure mode is a torn page carrying a valid CRC (computed over the torn bytes), so ADR-015 page-checksum validation passes on reload and nothing in the suite asserts on post-checkpoint page content under concurrent mutation. Only a reduced litmus harness turns a silent reorder into an observable signal.
  2. Graviton is not a platform Typhon ships to. Neoverse-V2 reorders more aggressively than Apple Silicon, but testing a third platform to infer risk on the second is a research instrument, not CI. Apple Silicon is the developer-laptop target that actually needs continuous coverage.

So what this buys is precise and limited: regression coverage for observable arm64 failures — deadlocks, crashes, assertion failures — on hardware developers actually use. A green run means "no observable regression on a supported platform." It is not evidence that barriers are correct.

Execution model — serial, not the gate's 8 shards

The committed shards.json is K=8, tuned for the c6id's 16 physical cores (0.5 processes/core; K=16 was measured flaky, per claude/design/Infrastructure/ci-merge-gate.md). A macos-15 runner has 3 cores, where that plan lands at ~2.7 processes/core — well past the flaky threshold, and a nightly that cries wolf gets muted.

The workflow therefore generates a single-shard plan at runtime from shard.py's own catchall_filter([]) and points SHARD_PLAN at it. That reuses the sharder's whole apparatus unchanged:

  • the catch-all filter (Category!=Quarantine & Category!=Sensitive),
  • the serial Category=Sensitive quiet pass,
  • and — the load-bearing part for a nightly — the 2-attempt retry of failures run alone. Without it a single timing flake reds the night; shard.py's own comment notes those windows are tightest on slow CI cores, which is exactly where we are.

Deriving the filter instead of hand-writing it means the nightly cannot drift if the gate ever excludes another category.

The false-green guard

Before any test runs, the job asserts the tests will execute as native arm64:

  • uname -m must be arm64 — macos-15-large is x64, one label typo away;
  • the .NET host must be arm64 too. An x64 SDK under Rosetta 2 runs with Apple's hardware TSO mode enabled, which would give the tests x86 memory ordering on ARM silicon — a green run proving nothing, with no outward sign. uname alone cannot see this, because the shell stays native.

Both failure modes produce a confident false green, so they're asserted, not logged. The check reads both Architecture: and RID: from dotnet --info, so a format change in one field can't red the nightly on its own.

Release is also deliberate beyond matching the gate: Debug constrains the JIT reordering and register allocation a missing barrier needs in order to become visible.

Why the pull_request trigger

Scheduled and workflow_dispatch triggers only exist once a workflow file is on the default branch — so this could not be tested until after it merged. The pull_request trigger is filtered to this workflow's own path, so it fires on the PR editing it and on no other. The run on this PR is the end-to-end test.

Verification so far

Off-runner, everything testable was tested locally:

  • YAML parses; every run: block passes bash -n; both embedded Python blocks parse.
  • shard.py imports cleanly and catchall_filter([]) yields (Category!=Quarantine)&(Category!=Sensitive).
  • End-to-end smoke: built Release, ran shard.py through the exact SHARD_REPO / SHARD_CONFIG / SHARD_PLAN env the workflow sets (scoped to one fixture) → 60 tests + 16 Sensitive, PASS, trx written.
  • The summary step's trx summation reproduced shard.py's own total=76 from those real trx files, and the verdict grep matched its output lines.

Not verified: an actual macos-15 run — that is what this PR is for. The suite has never run on macOS in CI, so the first run may well be red. That is the job doing its work.

Expected deltas vs the x64 baseline

Baseline is 4103 passed / 0 failed / 53 skipped. DatabaseFileLockingTests carries a [Platform("Win")] test that self-skips off Windows, so the skip count differs by at least 1. The summary renders both rows side by side so any other delta gets enumerated rather than assumed.

timeout-minutes: 90 is a guess with headroom — serial on 3 cores, wall-clock unknown. Tighten once there's a number.

Note on the merge gate

This diff touches neither src/Typhon.Engine/**, test/Typhon.Engine.Tests/** nor tools/Typhon.Workbench/**, so aws-gate and tla skip and no AWS instance boots.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LKFzE7MqQUj13s8a7q895D

nockawa and others added 2 commits August 1, 2026 10:14
Runs the Typhon.Engine suite nightly on Apple Silicon — the arm64 platform Typhon actually supports for developers, and one the x64 merge gate structurally cannot exercise (SL-07: acquire/release compile to plain mov under TSO, so conforming and violating code emit identical machine code there).

This does NOT implement the [use-arm] Graviton token #624 describes; it is the cheaper alternative discussed in that thread. Graviton is not a platform we ship to, and a functional suite on any arm64 target still cannot catch the silent class SL-07 is about — a torn page carries a valid CRC, so nothing asserts on it. What this buys is regression coverage for OBSERVABLE arm64 failures on the hardware developers use. Non-blocking, never a required check.

Execution model: the gate's committed K=8 shards.json assumes 16 physical cores (0.5 processes/core; K=16 was measured flaky). A macos-15 runner has 3 cores, where that plan would land at ~2.7 processes/core. The workflow instead generates a single-shard plan at runtime from shard.py's own catchall_filter() and points SHARD_PLAN at it — a serial workers=1 run that still inherits the Category=Sensitive quiet pass and the 2-attempt retry of failures run alone. Deriving the filter rather than hand-writing it means the nightly cannot drift if the gate ever excludes another category.

Guards against a false green before any test runs: uname -m must be arm64 (macos-15-large is x64, one label typo away), and the .NET host must be arm64 too. An x64 SDK under Rosetta 2 executes with Apple's hardware TSO mode enabled, which would give the tests x86 memory ordering on ARM silicon — a green run proving nothing, with no outward sign. uname alone cannot see that, since the shell stays native.

The pull_request trigger is filtered to this workflow's own path: scheduled and workflow_dispatch triggers only exist once a file is on the default branch, so without it this could not be tested until after it merged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LKFzE7MqQUj13s8a7q895D
… by the macos-15 nightly

The first arm64 nightly run failed eight tests. None was an arm64 defect; seven were tests whose synchronisation signal was not the thing they assert on, which resolves the convenient way on a 16-core box and does not on a 3-core one. Fixed rather than categorised — a quarantine tag would have frozen a wrong diagnosis, which is exactly what had already happened to one of them.

HighResolutionTimerServiceTests.Single_FiresAtExpectedRate and DriftPrevention_MetronomeStyle asserted a raw invocation count against an ASSUMED window. Thread.Sleep(100) is a floor, not a duration: it overshot to roughly 220ms on the runner, and the count then failed as "too many invocations" — indistinguishable, from the count alone, from a timer genuinely running fast. Both now measure the window with Stopwatch and assert the derived rate. The new upper bound is both tighter and portable: ExecuteCallbacks advances _nextTick by exactly one interval and, when behind, skips forward to within one interval of now, so a metronome provably cannot exceed elapsed/interval + the two window boundaries. A timer firing at 2.3ms in a true 100ms window still fails.

ChunksPerWorkerTests.WorkerCount1_TwoX_SingleWorkerHandlesBothChunks waited for ticksSeen, incremented by the "Tick" callback system that the query system under test runs AFTER — so the wait completed before "Single" had run and Shutdown truncated it (seen = 0 of 8). It now waits on seen itself. Its [Category("Sensitive")] is removed: the comment blamed parallel CPU load, but it failed on macOS inside the serial quiet pass, so that diagnosis was wrong and the tag was hiding the real cause. Verified green in the parallel shards under 32-way load.

ParallelQueryTests.ParallelQuery_MultiWorker_ChunksDistributedAcrossThreads used Thread.SpinWait(1000) to HOPE a sibling worker got scheduled meanwhile; with few usable cores one worker drained every chunk first and the test saw a single thread id. Replaced with a rendezvous — the first chunk blocks, releasing its core, until a second worker actually picks up work. Single-threaded dispatch still fails the assertion, on merit.

WalCommitBufferConcurrencyTests.Claim_LsnsRemainUniqueAndMonotonic_AcrossManyBufferSwaps had the only consumer in the file with no else branch, so it re-tried hot on an empty buffer and burned a core while six producers competed for the rest, starving them until their 20s claim deadline expired. Now parks on buffer.WaitForData(5) like its six siblings.

CpuSampleParserTests Parse_MergesFramesByMethod and Parse_ResolvesEngineFrameToSource saw zero frames for the burn method although samples were produced. Not root-caused: SpinHotLoop gains [MethodImpl(NoInlining)], which is correct regardless since both tests assert on a frame NAMED SpinHotLoop and RyuJIT's refusal to inline loop-bearing methods is an architecture-sensitive heuristic rather than a guarantee. A DescribeFixtureFrames() diagnostic is appended to both assertions so the next occurrence distinguishes "nothing sampled here" from "inlined into the caller" from "resolved but no PDB path", instead of printing "But was: False".

Not addressed, engine-side and left for a separate decision: WalCommitBuffer.cs:452 passes ctx.Deadline.Remaining as the wait duration to ThrowWalBackPressureTimeout. Remaining is ~0 by definition once the deadline has expired, so WalBackPressureTimeoutException can only ever report "timeout after 0ms" — it should carry elapsed wait time instead.

Full sharded suite green locally at the gate's K=8 config: 4158 tests, 0 failures.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LKFzE7MqQUj13s8a7q895D
@nockawa
nockawa merged commit c58b000 into main Aug 1, 2026
9 checks passed
@nockawa
nockawa deleted the ci branch August 1, 2026 08: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