Repository navigation
ci: run integration suite on x86_64 only, not aarch64 - #1291
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis PR scopes CI integration tests and coverage to x86_64-linux via a new ChangesCI Test Systems Configuration
🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Code Review
This pull request proposes a design to speed up CI by running integration tests and coverage checks only on the canonical x86_64-linux architecture, while continuing to build OCI images for all architectures. It also fixes a critical bug in the cache package where a missing ds.wg.Done() call on early-return paths (such as context cancellation) caused c.Close() to hang indefinitely, and adds a regression test for this scenario. Feedback on the changes suggests replacing a developer-specific absolute path in the tasks documentation with a relative path to ensure portability.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
pkg/cache/cache_test.go (2)
4232-4235: 💤 Low valueMake error handling more explicit.
The error return value is completely ignored using
_. While this may be intentional since the test focuses on cleanup rather than success, consider making it more explicit by assigning to a named variable (e.g.,getNarErr) or adding a comment explaining why the error is ignored.✨ Suggested improvement
nu := nar.URL{Hash: entry.NarHash, Compression: entry.NarCompression} - _, _, r, _ := c.GetNar(ctxA, nu) + // GetNar will return context.Canceled, but we're testing the cleanup path + _, _, r, getNarErr := c.GetNar(ctxA, nu) + _ = getNarErr if r != nil { r.Close() }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/cache/cache_test.go` around lines 4232 - 4235, The test currently calls c.GetNar(ctxA, nu) and discards the error return with `_`, which hides potential failures; change the call to capture the error into a clearly named variable (e.g., getNarErr) and either assert/handle it or add an inline comment explaining why the error is intentionally ignored, while still closing r when non-nil (referencing GetNar, ctxA, nu, and r to locate the call).
4237-4245: 💤 Low valueAdd clarifying comment about background download behavior.
The comment explains that the download goroutine reaches the upstream server, but doesn't explain why this happens when the caller's context was pre-cancelled. Consider adding a brief explanation that the download runs in a background goroutine with a detached context (not the caller's cancelled context), which is why it completes successfully.
📝 Suggested comment addition
// Wait for the download goroutine to reach the upstream server. At this - // point getNarFromUpstream will succeed, the cleanup goroutine will be added - // to backgroundWG, and it will eventually call ds.wg.Wait() — blocking - // forever if ds.wg.Done() was never called. + // point getNarFromUpstream will succeed (the download runs in a background + // goroutine with a detached context, unaffected by the caller's cancelled + // context), the cleanup goroutine will be added to backgroundWG, and it + // will eventually call ds.wg.Wait() — blocking forever if ds.wg.Done() was + // never called. select { case <-serverReceivedNar:🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/cache/cache_test.go` around lines 4237 - 4245, Add a brief clarifying comment above the select that waits on serverReceivedNar explaining that although the caller's context was pre-cancelled, the download runs in a background goroutine with a detached/new context (not the caller's cancelled context), so getNarFromUpstream will still be invoked and the cleanup goroutine is registered on backgroundWG (and will call ds.wg.Wait()); this explains why serverReceivedNar is signaled even when the original caller cancelled. Reference the existing symbols serverReceivedNar, getNarFromUpstream, backgroundWG and ds.wg.Wait in the comment to make the behavior explicit.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/ci.yml:
- Line 26: Replace the mutable reusable-workflow ref used in the CI workflow by
pinning to a specific commit SHA instead of the branch ref
`user/wnasreddine/ncps-ci-got-slow-again`; locate the `uses:
kalbasit/gh-actions/.github/workflows/ci.yml@user/wnasreddine/ncps-ci-got-slow-again`
entry and change the ref portion to the corresponding commit SHA (e.g.,
`@<commit-sha>`), then once the dependency is finalized repin it to the stable
tag or branch (e.g., `@main` or a release tag).
---
Nitpick comments:
In `@pkg/cache/cache_test.go`:
- Around line 4232-4235: The test currently calls c.GetNar(ctxA, nu) and
discards the error return with `_`, which hides potential failures; change the
call to capture the error into a clearly named variable (e.g., getNarErr) and
either assert/handle it or add an inline comment explaining why the error is
intentionally ignored, while still closing r when non-nil (referencing GetNar,
ctxA, nu, and r to locate the call).
- Around line 4237-4245: Add a brief clarifying comment above the select that
waits on serverReceivedNar explaining that although the caller's context was
pre-cancelled, the download runs in a background goroutine with a detached/new
context (not the caller's cancelled context), so getNarFromUpstream will still
be invoked and the cleanup goroutine is registered on backgroundWG (and will
call ds.wg.Wait()); this explains why serverReceivedNar is signaled even when
the original caller cancelled. Reference the existing symbols serverReceivedNar,
getNarFromUpstream, backgroundWG and ds.wg.Wait in the comment to make the
behavior explicit.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7efc30f6-aaf1-4bc8-a5a2-162dc5d0c9ef
📒 Files selected for processing (8)
.github/workflows/ci.ymlopenspec/changes/speed-up-ci/.openspec.yamlopenspec/changes/speed-up-ci/design.mdopenspec/changes/speed-up-ci/proposal.mdopenspec/changes/speed-up-ci/specs/flake-check-topology/spec.mdopenspec/changes/speed-up-ci/tasks.mdpkg/cache/cache.gopkg/cache/cache_test.go
When canStream=true, ds.wg.Add(1) is called before the select that waits for ds.start. Two early-return paths never called ds.wg.Done(): 1. ctx.Done() fires before ds.start closes — GetNar returns ctx.Err() without launching the streaming goroutine whose defer does the Done. 2. ds.getError() returns non-nil after ds.start closes — same issue. Both paths leave ds.wg permanently > 0, causing the cleanup goroutine (pullNarIntoStore.func3, tracked by backgroundWG) to block forever at ds.wg.Wait(), which in turn blocks c.Close() indefinitely. On slower aarch64 runners the race is reliably triggered by the stress test (cancelA fires before ds.start closes), explaining the 20-minute timeout seen in CI.
CI ran the full `nix flake check` (Garage/Postgres/MySQL/Redis cohorts) on both x86_64-linux and aarch64-linux. The aarch64 leg, on slower ARM runners, was both the long pole (~26m vs ~17m) and the dominant failure (recurring Postgres-cohort timeout), forcing repeated PR reruns. The integration suite is architecture-independent, so the aarch64 run added cost and flakiness without signal. Pass `test_systems: '["x86_64-linux"]'` to the shared workflow so the integration suite + coverage run on x86_64 only. The aarch64 leg still builds and pushes its OCI image, so the multi-arch manifest is unchanged. Depends on kalbasit/gh-actions#8 (adds the test_systems input); that PR must land first. Tracked by OpenSpec change speed-up-ci. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Validate the test_systems change end-to-end on this PR's CI before kalbasit/gh-actions#8 merges. MUST be reverted to @main before merging (tracked as speed-up-ci task 2.7). Co-Authored-By: Claude Opus 4.8 <[email protected]>
Revert the temporary gh-actions feature-branch pin now that test_systems was validated end-to-end on CI (aarch64 leg 25.7m-fail -> 2.7m-pass). Apply the flake-check-topology delta to the main spec and archive the completed change. Merge order: kalbasit/gh-actions#8 must land before this PR so @main carries the test_systems input. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
This change is part of the following stack: Change managed by git-spice. |
cb6a139 to
b9aab99
Compare
Drop the machine-specific absolute path from the archived change notes. Addresses review feedback on #1291. Co-Authored-By: Claude Opus 4.8 <[email protected]>
## Why After #1291, the `x86_64-linux` build leg (~17m) is CI's bottleneck, and the **"Flake check" step is 16.3m of it** (measured, run 26661047200). dd9622c split flake-check into 5 cohort derivations, each of which recompiles the race+coverage-instrumented test binaries from scratch — Go's build cache isn't shared across Nix sandboxes. The **4 backend cohorts compile byte-identical binaries** (cgo `mattn/go-sqlite3` under `-race`, ~2 min apiece on CI's 4-core runners), so 3 of those compiles are pure waste that core contention can't parallelize away (this is dd9622c's 8m→14m regression). ## What Add a `_ncps-test-cache` derivation that compiles **both** cohort test sets exactly once (`go test -run '^$'`, runs zero tests so no backend is needed) and exports the populated `GOCACHE`. Each cohort seeds a writable copy of that cache before its `go test`, turning compilation into a cache hit. Cohort isolation, per-cohort `cover.out`, the merged Codecov profile, the race detector, and `t.Skip` gating are all unchanged. Two Nix-specific details (documented in the code): - `disallowedReferences = [ ]` — the cache legitimately references the Go toolchain. - `dontFixup = true` — patchelf/strip would rewrite cached objects and invalidate Go's content hashes. - Cohorts copy the cache preserving mode then `chmod -R u+w` — `--no-preserve=mode` would strip the `covdata` helper's +x bit and break coverage. ## Verification - `_ncps-test-cache` builds (821M cache). - **cmd cohort passes reusing the cache** — confirmed compile reuse (a pre-fix run failed only on fork/exec of the *cached* `covdata` binary, proving compilation was served from cache, not rebuilt). - The postgres cohort's local `TestSchemaEquivalence` failure is environmental: it fails identically with this change stashed, and the cohort passes in CI on this branch. This PR's own CI run will give the real before/after x86-leg number. OpenSpec: `flake-check-topology` spec gains "Race+coverage test binaries are compiled once and shared". Co-authored-by: Claude Opus 4.8 <[email protected]>
## Summary The release workflow (`v*.*.*` tag builds) called `build.yml` **without** `test_systems`, so it re-ran the full `nix flake check` + coverage on **both** x86_64 and aarch64 — including the slower, flaky aarch64 Postgres path that the CI workflow (#1291) already learned to avoid. - `releases.yml`: pass `test_systems: '["x86_64-linux"]'` to the shared build workflow. The integration suite + coverage now run on x86_64 only; the aarch64 leg still **builds and pushes** its OCI image, so the multi-arch manifest is unchanged. `run_flake_check` stays at its default (`true`) so releases still gate on the full suite. - Mirrors the CI workflow's scoping. - `flake-check-topology` spec: the "Integration cohorts validated on a single CI architecture" requirement now covers **both** `ci.yml` and `releases.yml`, with a new release-tag scenario. Independent of the fan-out PR (#1293); branched off `main`. Relies on the `test_systems` input already on `kalbasit/gh-actions@main` (merged in #8). ## Test plan - [x] `actionlint .github/workflows/releases.yml` — exit 0 - [x] `task fmt` clean; pre-commit hooks pass - [ ] Confirm on the next release tag that the aarch64 leg builds the image but skips `nix flake check` --------- Co-authored-by: Claude Opus 4.8 <[email protected]>
Why CI got slow and flaky
CI averages ~20 min, often exceeds 30, and fails roughly half of runs — so a PR takes several attempts to merge. Root cause (measured on run
26653285682):buildmatrix legx86_64-linuxaarch64-linuxThe shared
buildjob fans out over["x86_64-linux","aarch64-linux"]and runs the entirenix flake check— all integration cohorts (Garage/Postgres/MySQL/Redis) — on both legs. The aarch64 leg runs on slower ARM runners where the Postgres cohort times out, making it both the long pole and the dominant failure. Integration tests are architecture-independent, so the aarch64 run buys no signal — only wall clock and flaky reruns.What this does
Passes
test_systems: '["x86_64-linux"]'to the sharedkalbasit/gh-actionsworkflow sonix flake check+ coverage run on x86_64 only. Theaarch64-linuxleg still builds and pushes its OCI image (the lean, test-freepackages.ncps), so the multi-arch manifest is unchanged — it just no longer re-runs the integration suite.Depends on kalbasit/gh-actions#8 (adds the
test_systemsinput). Since this repo consumesgh-actions/.github/workflows/ci.yml@main, #8 must merge first — until then this PR'ssharedjob will fail with an unknown-input error. Re-run CI here after #8 lands.Scope / non-goals
Per the OpenSpec change
speed-up-ci: this kills the flakiness and removes the ~26-min aarch64 critical path. It does not rework the dd9622c per-backend cohort split (the secondary8m→14m flake-check regression) — that's a deferred, separate lever toward the eventual ~5-min target.OpenSpec:
openspec/changes/speed-up-ci/.