Repository navigation
Cache the production compile's pages CSS on main - #8312
Merged
Merged
Conversation
The pages CSS is a fixed class list, so app code and views never change it, yet every compile that missed the main asset cache rebuilt it, about 73 s. Main now saves the built files to S3, keyed on the build script, its CSS input, the lockfile and the Node image. A compile with a verified entry unpacks it and skips pages_tailwind:build.
Contributor
|
Contributor
|
|
gianfrancopiana
added a commit
that referenced
this pull request
Oct 10, 2026
## What `bin/branch-specs` now maps a changed `lib/tasks/NAME.rake` to `spec/lib/tasks/NAME_spec.rb` when that spec exists. The `lib/` name mapping now matches `.rake` files and `.rb` files. A rake task without a spec still escalates as a mapping gap. ## Why The Test Relevant jobs use `bin/branch-specs` to select specs for a PR. The `lib/` name mapping matched only `.rb` files, and content attribution also matches only `.rb` files. A change to a rake task therefore escalated to the full suite, even when the rake task has its own spec. #8312 shows this. The selector reported `lib/tasks/pages_tailwind.rake` as a mapping gap, but the branch has a spec for that rake task. The `Makefile` on that PR escalates correctly, and this change keeps that behavior. Rake task specs in this repo already use the `lib/tasks/NAME.rake` to `spec/lib/tasks/NAME_spec.rb` layout. Examples are `taxonomy`, `preview_qa`, and `db_schema_parity`. ## Before/After This change affects CI test selection only. Users see no change. - Before: a change to `lib/tasks/taxonomy.rake` escalates with "mapping gap". - After: the same change selects `spec/lib/tasks/taxonomy_spec.rb`. - Before and after: a change to a rake task without a spec escalates with "mapping gap". ## Test results - `ruby spec/bin/branch_specs_test.rb`: 179 checks passed. - Without the change to `bin/branch-specs`, the new case "rake task maps to its spec/lib/tasks spec" fails with exit 3 (mapping gap). - `bundle exec rubocop bin/branch-specs spec/bin/branch_specs_test.rb`: no offenses. --- AI disclosure: Claude Opus 5.5. Co-authored-by: Gianfranco Piana <gianfrancopiana@users.noreply.github.com>
gianfrancopiana
marked this pull request as ready for review
October 10, 2026 18:03
gianfrancopiana
added a commit
that referenced
this pull request
Oct 10, 2026
## What Add regression checks that the pages CSS cache tag changes when its build script, CSS input, package lock, or rake task changes. ## Why PR #8312 added the pages CSS cache. Its tests covered restore and save behavior, but did not prove that representative build inputs invalidate the cache key. ## Before/After Before: cache-key input changes had no direct regression coverage. After: the shell harness checks each representative input independently and confirms unrelated changes keep the key stable. ## Test Results - `bash .buildkite/scripts/main_asset_cache_compile_test.sh` — 63 passed, 0 failed - Mutation controls — removing each tested input from the key produced its intended failure - `bin/test-confidence --strict` — no tests selected because the diff only changes the shell harness - Private Claude Sonnet 5.5 high-effort review — clean ## QA No manual QA needed. This is test-only coverage for the existing cache key. --- Implemented with Claude Sonnet 5.5.
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
On a main asset cache miss, the production compile unpacks the pages CSS from a cache instead of building it.
.buildkite/scripts/main_pages_tailwind_cache.sh, keys the pages CSS on its build script, its CSS input,lib/tasks/pages_tailwind.rake, the package files,docker/baseanddocker/web/compile_assets.sh.make build_productionmounts the tarball into the compile container.docker/web/compile_assets.shunpacks it and setsPAGES_TAILWIND_RESTORED, sopages_tailwind:buildskips the Tailwind build.comp-assets-*builds read the cache and never write it. Staging and preview builds mount nothing and build as before.[no-cache]commit builds the CSS and replaces the entry.Why
About half of main deploys miss the main asset cache and compile from scratch. On a miss, the pages Tailwind build takes 73–76 s, although its output never changes with app code:
scripts/build_pages_tailwind.mjsbuilds a fixed class list, and its CSS input setssource(none). PR CI already caches the same files on the same inputs (#8298).With the node_modules cache, this removes the two steps of a compile miss that do not depend on the change being deployed.
Before/After
This changes the production build only. Nothing changes for users.
Test results
bash .buildkite/scripts/main_asset_cache_compile_test.sh: 58 pass. New cases:make, and a tarball that fails its checksum is not used;comp-assets-*miss saves nothing;[no-cache]commit builds the CSS and replaces the entry;The same test runs the real
make build_productionand the realdocker/web/compile_assets.shagainst a stubdocker, with a real tarball:assets:precompile, the restored flag skips the build, and nothing is written back;pages_tailwind.tar.gz.new;comp-assets-*build creates no archive, and a failed archive write leaves no partial file.Each piece of the change, removed on its own, makes at least one case fail.
bundle exec rspec spec/lib/tasks/pages_tailwind_spec.rb: 2 pass. Without the skip in the rake task, the restored case fails.bundle exec rubocopandshellcheck -S warning: no new offenses.A real Buildkite production compile of this branch (build 25596, on a
comp-assets-*branch, no deploy) passed in 6.2 min:make build_productionmounted both cache directories into the compile container;npm run build:pages-tailwindran, in 75.9 s;tar,gzip, checksum, S3 or Rake error.That build cannot test a restore, because only main writes entries. The first main compile after the merge fills the cache, and the next miss restores it. Both log their result.
AI disclosure: Claude Opus 5.5.