Repository navigation
[NoQA] Key ESLint cache on lint deps only and drop stale catch-all fallback - #97551
Conversation
|
|
This reverts commit 29bb524.
|
@DylanDylann Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 84ee947d76
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| shell: bash | ||
| run: jq 'del(.version, .packages[""].version)' package-lock.json > normalized-package-lock.json | ||
| run: | | ||
| jq '{packages: (.packages | to_entries | map(select(.key | test("eslint|^node_modules/(typescript|ts-api-utils)$"))) | from_entries)}' package-lock.json > lint-deps-lock.json |
There was a problem hiding this comment.
Include hoisted linter transitive deps in the key
When only a hoisted transitive ESLint dependency changes, this selector can leave lint-deps-lock.json unchanged; for example node_modules/eslint depends on espree, but the resolved node_modules/espree entry does not match this regex. Because the restore key then has the same prefix as the previous run, GitHub cache restore can reuse the previous ESLint cache and unchanged files are not re-linted under the new parser/rule dependency. Please hash the dependency closure of the selected lint packages rather than only package keys containing eslint plus the two exact TypeScript entries.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not sure about this one. It's true the slice only matches package paths containing eslint (plus typescript/ts-api-utils), so a standalone bump of a hoisted transitive dep like espree wouldn't change the cache key, and the previous cache would be reused under the new parser.
But I think a transitive bump that changes lint semantics without any accompanying direct dep/config change is rare.
There are a few ways to handle it, with different cost/coverage trade-offs:
- Extend the regex with the parser chain (
espree,acorn) — the only transitives where a silent behavior change seems plausible. Cheap, no extra complexity:test("eslint|espree|acorn|^node_modules/(typescript|ts-api-utils)$") - Hash the full dependency closure of the selected lint packages. Airtight, but it pulls in high-churn shared utils (
debug,semver,minimatch,ajv, ...) whose routine bumps would force frequent unnecessary full cold re-lints (each one is a long run even on the 8vcpu runner), and requires a jq graph walk in the workflow. - Accept the residual risk as-is — the slice is already a big correctness improvement over the old catch-all fallback, which reused stale caches on every lint config/dep change.
WDYT?
There was a problem hiding this comment.
@TMisiukiewicz @VickyStash Sounds like the option 1 addresses this to some extent without too much overhead so I think we could do that
There was a problem hiding this comment.
updated the branch with option 1
|
@mountiny Do we require C+ on this PR? |
|
I'll be OOO next week (back Aug 10) 🌴 |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.4.50-0 🚀
|
|
🚀 Deployed to production by https://github.com/arosiclair in version: 9.4.50-3 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
The ESLint cache restore step had a catch-all
${{ runner.os }}-eslint-fallback key. When a lint config or lint dependency changed (e.g. bumpingeslint-config-expensify), the exact key missed but the catch-all restored a cache built under the old rules. Since ESLint only re-lints files whose content or config hash changed (plugin source innode_modulesis not part of that hash), files that were clean under the old rules were never re-evaluated under the new rules, and new violations silently passed CI.This PR:
package-lock.jsonhash with a lint-deps slice. Ajqstep extracts only lint-affecting packages frompackage-lock.json. The cache key hashes this slice together witheslint.config.mjsandconfig/eslint/**, so unrelated dependency bumps no longer bust the cache, while lint config/dependency changes do.${{ runner.os }}-eslint-restore key. A lint config/dep change now gets a clean cold lint instead of restoring a stale cache. Normal PRs still restore via the config-hash prefix key, so there is no speed regression for regular PRs.Fixed Issues
$ #96660
PROPOSAL: N/A
Tests
As experiment i've tried to downgrade
eslint-config-expensify.Cache correctly wasn't found, and a full cold lint has run (run):
Offline tests
N/A
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
N/A
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari