Skip to content

ci: sticky-disk Docker layer caching for compose-built backend images#3885

Merged
insipx merged 1 commit into
mainfrom
blacksmith-docker-builder
Jul 22, 2026
Merged

ci: sticky-disk Docker layer caching for compose-built backend images#3885
insipx merged 1 commit into
mainfrom
blacksmith-docker-builder

Conversation

@insipx

@insipx insipx commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • just backend up rebuilds the validation-service image (local.Dockerfile, full-repo context, pull_policy: never) and anvil image from scratch in every test job — no layer cache
  • New opt-in docker-builder input on setup-nix wires up useblacksmith/setup-docker-builder@v1 (buildx builder backed by a sticky-disk layer cache, scoped per Dockerfile per repo, LWW commits)
  • Enabled for the 8 jobs that start the backend (test-workspace, test-node, test-node-sdk, test-browser-sdk, test-wasm, test-android ×2, ignored-tests-tracker)

Follow-up to #3883.

Known caveat

setup-docker-builder has no per-event commit control, so PR jobs write to the shared layer cache. Blast radius is limited to test-infra images (local.Dockerfile/anvil.Dockerfile) — the released image builds from a different Dockerfile and layer caches are per-Dockerfile.

Test plan

  • First run: builder mounts, images build, cache commits
  • Second run: compose build steps hit cached layers (compare "Start backend" step time)

🤖 Generated with Claude Code

Note

Add sticky-disk Docker layer caching to CI workflows via Blacksmith builder

Adds a docker-builder input to the setup-nix composite action that provisions a Blacksmith Docker buildx builder with a 10GB sticky-disk cache on Linux runners. All affected CI workflows (Android, Node, Browser SDK, WASM, workspace, ignored-tests tracker) opt in by passing docker-builder: "true" to the action.

Macroscope summarized 3c5a7bc.

@insipx
insipx requested a review from a team as a code owner July 22, 2026 18:22
@claude

claude Bot commented Jul 22, 2026

Copy link
Copy Markdown

Claude finished @insipx's task —— View job


PR Review - July 22, 2026 18:52 UTC

  • Read changed workflow files
  • Analyze docker-builder setup implementation
  • Check for issues beyond existing feedback
  • Provide review feedback

Review Summary

The implementation is solid and addresses the stated goals. The Macroscope feedback regarding max-cache-size-mb has been properly addressed in commit 3c5a7bc with a 10GB limit.

Code Quality ✅

Positive observations:

  • Clean opt-in design via boolean input parameter .github/actions/setup-nix/action.yml:14-17
  • Consistent enablement across all 8 jobs that use just backend up
  • Proper conditional logic restricts activation to Linux runners only .github/actions/setup-nix/action.yml:68
  • Well-documented inline comments explain the mount-before-install requirement and cleanup strategy

Security ✅

Known caveat acknowledged:
The PR description correctly identifies that setup-docker-builder lacks per-event commit control, meaning PR jobs write to the shared layer cache. The author appropriately notes that blast radius is limited to test-infra images since released builds use different Dockerfiles (and caches are per-Dockerfile).

This is an acceptable tradeoff for test infrastructure optimization—untrusted PRs could only poison the validation-service/anvil layer cache, not production artifacts.

Performance ✅

The 10GB cache limit chosen by the author is well-reasoned for this use case. Validation service cargo build layers consume several GB, and too-small limits cause prune-thrash (evict → full rebuild every run).

Test Coverage

No automated test coverage for CI infrastructure changes is expected or typical. The test plan in the PR description outlines manual verification:

  • First run: builder mounts, images build, cache commits
  • Second run: compose build steps hit cached layers

Recommendation: Compare "Start backend" step times before/after to validate cache effectiveness.

Minor Observations

  1. Consistency check passed: All 8 workflows that call just backend up now have docker-builder: "true" enabled:

    • test-workspace.yml ✓
    • test-node.yml ✓
    • test-android.yml (both jobs) ✓✓
    • test-browser-sdk.yml ✓
    • test-node-sdk.yml ✓
    • test-wasm.yml ✓
    • ignored-tests-tracker.yml ✓
  2. No workflows missed: Checked that no other workflows use just backend up without the flag.

Conclusion

LGTM - No blocking issues found. The implementation is clean, well-scoped, and properly addresses the optimization goal while maintaining security boundaries.


Comment thread .github/actions/setup-nix/action.yml
@macroscopeapp

macroscopeapp Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Minor CI/CD optimization adding Docker layer caching to test workflows. No runtime or production impact - purely build performance improvement. Author owns all changed files.

You can customize Macroscope's approvability policy. Learn more.

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jul 22, 2026
just backend up rebuilds the validation-service and anvil images from
scratch every job (pull_policy: never, no layer cache). Opt-in
docker-builder input on setup-nix wires up useblacksmith/setup-docker-builder,
enabled for the 8 jobs that start the backend.
@insipx
insipx force-pushed the blacksmith-docker-builder branch from 4e7c6f0 to 3c5a7bc Compare July 22, 2026 18:51
@macroscopeapp
macroscopeapp Bot dismissed their stale review July 22, 2026 18:51

Dismissing prior approval to re-evaluate 3c5a7bc

@insipx
insipx enabled auto-merge (squash) July 22, 2026 18:51
insipx added a commit that referenced this pull request Jul 22, 2026
…lStatistics (#3886)

## Summary
`DebugInformation > should return network API statistics` failed 4×
today (PR #3883/#3885 CI + main): `expected 1n to be 0n` at the
post-`clearAllStatistics()` assert on `getIdentityUpdatesV2`. A
background identity refresh fires between clear and re-read — the same
nondeterministic call the pre-clear asserts already tolerate with lower
bounds (see comment in the test). Faster Blacksmith runners shifted the
race odds enough to make it a repeat blocker.

One-line fix: `toBe(0n)` → `toBeLessThanOrEqual(1n)` on that single
counter; all other post-clear asserts stay exact.

## Test plan
- [ ] browser-sdk test suite green in CI

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- Macroscope's pull request summary starts here -->
<!-- Macroscope will only edit the content between these invisible
markers, and the markers themselves will not be visible in the GitHub
rendered markdown. -->
<!-- If you delete either of the start / end markers from your PR's
description, Macroscope will append its summary at the bottom of the
description. -->
> [!NOTE]
> ### Tolerate background identity refresh calls in `DebugInformation`
network statistics test
> The test for `clearAllStatistics` was asserting exact zeros for all
counters after clearing, but background workers can make one additional
network call between the clear and the stat read. Counter assertions for
`apiStatistics()` and `apiIdentityStatistics()` are relaxed from
`.toBe(0n)` to `.toBeLessThanOrEqual(1n)` in
[DebugInformation.test.ts](https://github.com/xmtp/libxmtp/pull/3886/files#diff-32e813a0aed87dbacec9e1e78223bc93acc1058077f73db5c74436653ebe2f1d).
>
> <!-- Macroscope's review summary starts here -->
>
> <sup><a href="https://app.macroscope.com">Macroscope</a> summarized
0a5a3d9.</sup>
> <!-- Macroscope's review summary ends here -->
>
<!-- macroscope-ui-refresh -->
<!-- Macroscope's pull request summary ends here -->
@insipx
insipx merged commit 622cf37 into main Jul 22, 2026
40 checks passed
@insipx
insipx deleted the blacksmith-docker-builder branch July 22, 2026 18:59
@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.64%. Comparing base (3e10d5d) to head (3c5a7bc).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3885   +/-   ##
=======================================
  Coverage   85.64%   85.64%           
=======================================
  Files         426      426           
  Lines       68005    68005           
=======================================
  Hits        58245    58245           
  Misses       9760     9760           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants