Skip to content

perf(ci): select affected tests and reduce build and deployment overhead - #1031

Merged
athvin merged 13 commits into
mainfrom
perf/ci-speed
Nov 9, 2026
Merged

athvin merged 13 commits into
mainfrom
perf/ci-speed

Conversation

@athvin

@athvin athvin commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Closes #648

Post-merge is part of this pull request. The ledger below records whether
the follow-up work actually happened. /land-pr closes it.

What

Reduce CI setup overhead, select affected Rust suites, and avoid unchanged observability upgrades. Add release compiler caching and an opt-in archive-build experiment.

Why

Recent runs spent 1–3½ minutes per job deleting SDKs and up to 8m43 downloading nextest. Ordinary UI changes also ran backend integration suites.

Proof

Full make check passed; the CI regression suites, workflow lint, and shell-budget checks pass. All 15 required hosted contexts passed (Rust, frontend); both image builds passed. The API image completed in 3m44 with a populated compiler cache. The final documentation-only commit also passed (Rust, images); its warm API image build completed in 3m23.

Risk & rollback

Selection errors can hide coverage; unknown inputs select the full gate and required aggregates reject classification failures and unexpected skips. Revert this PR to restore prior scheduling. Deployment health/migration/cutover checks remain in place.

Post-merge ledger

Closed by: Codex · session Codex:01a1bef1-8627-7c21-8a86-6c4743d8906f on Mac-26 · 2026-11-09T09:34:56+00:00

  • main is green with this change on it — 4998a58a7971543384f5d3cfa15ef1654c5cf26f contains both changes. Rust run 42590148101, frontend 42590148224, infra 42590148650, images 42590148445, devcontainer 42590148323, and deploy 42590174746 all succeeded. Original merge ce3fd01b also passed Rust 42586199942, frontend 42586200014, infra 42586199982, devcontainer 42586199900 and images 42586200002.
  • images — Original images run 42586200002 succeeded. Cold main dependency cooking took 26m33, application compilation 2m01, with zero cache read/write errors. Actions cache API confirms new sccache/ objects on refs/heads/main. The fix-only image run 42590148445 correctly skipped both builds and reused these images.
  • deploy converged — Deploy run 42590174746 succeeded for both environments and logs deploying 4998a58a7971543384f5d3cfa15ef1654c5cf26f. At verification of that deployment, both services selected dev green / prod blue. The serving API processes emitted er-server listening at 09:04:35.648292 UTC (dev pod web-api-green-78d6f787fc-5prb4) and 09:03:58.074266 UTC (prod pod web-api-blue-5b6b4f7c49-4w4j2); both containers in both pods are ready with zero restarts. The original dev attempt 42590105679 stopped before application cutover on the diagnosed Fluent Bit label mismatch; fix(ci): recognize the deployed Fluent Bit instance label #1038 fixed it.
  • the push-only surface no pull request can pre-test — final deploy 42590174746 succeeded; latest kind nightly 42575735163 succeeded. Drift 42570659369 was already red before this change: Cloudflare provider checksum download returned HTTP 504 before drift evaluation. No cluster-object inputs changed. First scheduled benchmark/scale runs remain part of follow-up Measure CI and deployment latency over 20 post-rollout runs #1036.
  • the board card reached Done automatically — re-tune the CI gate now that compute is free and runners are 4-vCPU #648 closed by PullRequest perf(ci): select affected tests and reduce build and deployment overhead #1031; Product Roadmap status Done, verified through issue timeline/project fields.
  • follow-ups — Measure CI and deployment latency over 20 post-rollout runs #1036 owns 20 post-rollout timing samples, later main compiler-cache hit measurements, larger-sample deployment timings, and the first scheduled benchmark/scale results. The subsequent real deployment skip is now verified below.
  • what was learned is written down — .claude/skills/ci-and-supply-chain/references/build-cost.md records the measurements, rejected archive experiment, compiler pin/cache design, and observed Fluent Bit chart label. This ledger records the live rollout evidence.

Specific to this change

  • Live observability verification — deploy logged observability: reconciled and verified at 09:04:00 UTC and created ConfigMap er-observability-applied. A subsequent probe ran the exact wrapper against live AWS/Helm/Kubernetes reads with all mutation calls replaced by a failing guard; it printed observability: unchanged and healthy; skipping reconciliation without invoking the guard.

  • Main compiler-cache writes verified through zero write errors and new main-scoped cache objects; subsequent hit rates and 20-run median/p95 measurements are deferred — Measure CI and deployment latency over 20 post-rollout runs #1036.

  • Completed the observation window — no further failures after the diagnosed dev failure at 09:01:35 UTC through 09:34:56 UTC. The subsequent marketing release also passed all main checks and deployed successfully.

  • Subsequent real release — marketing merge 8c9111b0 retains both changes and passed Rust 42593494870, frontend 42593494701, infra 42593494824, devcontainer 42593494793 and images 42593494737. Deploy 42593707865 succeeded for dev and prod and logged observability: unchanged and healthy; skipping reconciliation at 09:29:24 UTC (15-second step). The web image job took 1m27; merge-to-prod was 3m47 (09:26:53–09:30:40), one warm frontend-release sample rather than a percentile. Live services now select dev blue / prod green; ready API processes emitted er-server listening at 09:29:58.946332 UTC and 09:29:17.836392 UTC respectively, with zero container restarts.

Context — plan, discoveries, measurements, files

Plan

  • Cache checksum-pinned CI tools; clean disk only below the reserve.
  • Select changed crates and reverse dependents; retain frontend contract coupling.
  • Preserve required contexts and reject failed classification.
  • Select main changes since its last successful workflow ancestor.
  • Keep scale/benchmark jobs nightly/manual.
  • Add release compiler caching and healthy observability fingerprint reuse.
  • Add attempt-specific timing reports and five-pair archive experiment.
  • Complete local and hosted gates; measure archive experiment before adoption.
  • After rollout, compare 20 relevant runs against the five-minute targets.

Discoveries

ECR trusts a branch-based OIDC subject. Attaching the protected R2 cache environment to its job would break authentication, so release compilation uses branch-scoped GHA cache via BuildKit secrets; Rust CI remains on R2. Archive reuse was rejected: five comparisons had identical test identities and all 45 jobs passed, but including producer/transfer time made it 7.33% slower.

Measurements

python3 scripts/ci/archive-verdict.py 42575743751: baseline median 464s, archive median 498s; do not adopt. Experiment run.

First implementation run: disk cleanup 0s; pinned tool setup 1–2s; er-match test job 3m20. This is not an overall five-minute claim. Repeated warm-run results and release cache behavior still need post-merge measurements.

rust run 42577766444: 8m54, longest job pg m-z 7m56, comprising 137s compilation + 306.31s test execution; disk cleanup 0s, tool installation 2s. The final er-match job was 2m47. The complete backend gate is still over five minutes: affected-suite selection avoids unrelated work, but it does not make a full integration pass fit the target. The remaining slow tests cover mass updates, merge/unmerge, master protection, record suppression, and the complete pipeline; they remain correctness gates.

The API image's warm validation took 3m44, with dependency cooking 57.15s (100% Rust/C/C++/assembler cache hits, zero cache errors) and the application build 1m11. The earlier cold attempt cooked in 24m23 and then rebuilt Rust dependencies in 8m56 after switching from Rust 1.99.0 to floating stable 1.99.1. Pinning the compiler consistently prevents that rebuild. These are PR image measurements, not a deployed production percentile. Main must populate its own branch-scoped cache.

Two image attempts failed downloading sccache inside Docker (HTTP 504); image builds now use the verified CI archive through a named context. The final Rust audit also needed one retry because the unchanged third-party cargo-deny action downloaded an invalid archive. No correctness test failed in those runs.

Selection examples

Using the real Cargo metadata graph: an er-server source change selects one affected application package and the server tier; an er-match source change selects three affected application packages and both integration tiers; a lockfile change selects all 32 packages. Every Rust change also selects the er-errors, er-schema, and er-entity-gen repository-wide guard suites, which inspect source files without Cargo dependency edges. Ordinary UI changes skip Rust compilation; embedded API contracts and generated entity bindings retain their backend checks.

Files

@athvin athvin added ci:archive-experiment Run the opt-in paired Rust archive experiment and removed ci:archive-experiment Run the opt-in paired Rust archive experiment labels Nov 9, 2026
@athvin
athvin marked this pull request as ready for review November 9, 2026 08:18
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.

re-tune the CI gate now that compute is free and runners are 4-vCPU

2 participants