Commit 9f499fb
authored
fix(ci): use content-based eslint cache strategy for reliable CI hits (#33327)
## **Description**
Follow-up to #33304 (rolling `.eslintcache` restore/save in CI). That PR
restored the cache correctly, but measured CI job durations showed zero
improvement — `yarn lint` stayed at ~13 minutes on every run, cache or
no cache.
Root cause: ESLint's `--cache` defaults to `--cache-strategy metadata`,
which validates cache entries by file **mtime + size**, not content. CI
does a fresh `actions/checkout` on every run, which gives every file a
brand-new mtime — so every cache entry fails validation and ESLint falls
back to fully re-linting the entire repo, even though the restored cache
was complete and correct.
Verified locally with a controlled reproduction:
| Scenario | `metadata` (default) | `content` |
|---|---|---|
| Warm run, file untouched | 2.0s | — |
| Warm run, after `touch` (new mtime, same content) | **24.1s (full
re-lint)** | **1.8s (cache hit)** |
Switching to `--cache-strategy content` validates by content hash
instead, which survives fresh checkouts — the exact scenario CI cache
restoration produces. This makes the caching added in #33304 actually
effective.
## **Changelog**
CHANGELOG entry: null
## **Related issues**
Fixes:
## **Manual testing steps**
N/A — CI-only configuration change with no in-app behavior to verify.
Validated locally with a controlled cold/warm/touched-mtime comparison
(see description). Follow-up validation: compare `lint` job duration on
this PR's CI run and subsequent `main` runs against the ~13 min baseline
from #33304.
## **Screenshots/Recordings**
### **Before**
N/A
### **After**
N/A
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
#### Performance checks (if applicable)
- [x] I've tested on Android
- [x] I've tested with a power user scenario
- [x] I've instrumented key operations with Sentry traces for production
performance metrics
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
Made with [Cursor](https://cursor.com)1 parent 887370f commit 9f499fb
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
| 22 | + | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
0 commit comments