ci: restore turbo cache hits on PR unit job#75
Merged
Conversation
The `actions/cache` step pointed at `node_modules/.cache/turbo`, which is turbo v1's default. Turbo v2 writes to `.turbo/cache`, so the cache path bound to an empty directory: the post-action save silently wrote nothing, no `turbo-Linux-*` key ever landed in the pool, and every run three-way-missed the restore keys (observed on PR #72 logs). Net effect: seven tasks marked `cache miss, executing` on every PR unit job, turning a YAML-only PR into a full 232s cold run. Refs: #74
typecheck and unit jobs shared the exact same cache key (turbo-Linux-<hash>-<sha>). With path now pointing at the real turbo v2 cache dir, they would race on reserveCache: typecheck finishes first (~60s) and wins the reservation, unit (~232s) hits ReserveCacheError and skips upload. Effect: pool accumulates only typecheck-flavored tarballs. Next run's unit job restores typecheck's cache, finds no matching test:ci task hash, and re-executes the full 232s suite. Split the key with a job discriminator (-typecheck / -unit) so each job saves and restores its own slice. Refs: #74
|
Note Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported. |
Contributor
📝 WalkthroughWalkthroughUpdated GitHub Actions cache configuration for Bun's Turborepo build artifacts in the CI workflow. Changed the cached directory from Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related issues
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
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.
Summary
Change
actions/cachepath fromnode_modules/.cache/turbo(turbo v1 default) to.turbo/cache(turbo v2 default) so the cache dir actually has contents to save, and add a per-job discriminator (-typecheck/-unit) to the cache key so the two concurrent jobs stop racing on the same reservation.Why
ci / unitspends ~232s on every PR, even YAML-only ones. Root cause is a two-layer cache failure that compounds: the cache path pointed at an empty directory (turbo v1 default, but we run turbo v2), so every post-step logged[warning]Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.— noturbo-Linux-*entry ever landed in the pool (verified: 37 caches, 10.3 GB, zero turbo entries). Even with the path fixed, both jobs shared the exact same cache key, so they would race onreserveCache; peractions/toolkitsource, the loser catchesReserveCacheErrorand logs it at info level without uploading.typecheck(~60s) always finishes beforeunit(~232s), so unit's cache would never enter the pool and subsequent runs would restore typecheck-flavored tarballs into unit jobs, producing task-hash misses and another full 232s run. Splitting the keys makes each job own its own slice.Related Issue
Closes #74. The issue lists three levers: turbo cache fix (this PR),
--filter=...[origin/dev](obsoleted by turbo's own content-hash skipping once cache is working), and bun / desktop-electron concurrency (independent micro-optimisation, open a fresh issue if benchmark warrants it). Note: the issue body'spassThroughEnv: ["*"]hypothesis is not the root cause — localturbo --dry=jsonwith fake GitHub runner env produces identical task hashes, confirmingpassThroughEnvis a "pass through but don't hash" allowlist, not the opposite.How To Verify
Pre-merge (local, already run):
Post-merge (CI observation — cannot be reproduced locally because
actions/cachesave/restore only runs on GitHub runners):ci / unitandci / typecheckruns: post-step should logCache saved with key: turbo-Linux-typecheck-...andturbo-Linux-unit-...(noPath Validation Error, noReserveCacheError).Cache restored from key: turbo-Linux-typecheck-.../turbo-Linux-unit-...;bun turbo test:cioutput contains>>> FULL TURBOfor unchanged tasks.gh api /repos/Astro-Han/pawwork/actions/caches | jq '.actions_caches[].key' | grep turboshould returnturbo-Linux-typecheck-*andturbo-Linux-unit-*entries.Checklist
devbranchSummary by CodeRabbit
No user-visible changes
This release contains only internal infrastructure updates to the continuous integration build pipeline. No new features, bug fixes, or user-facing functionality have been modified.