[No QA] Make the html-entities worklet patch idempotent - #98395
Open
roryabraham wants to merge 1 commit into
Open
[No QA] Make the html-entities worklet patch idempotent#98395roryabraham wants to merge 1 commit into
roryabraham wants to merge 1 commit into
Conversation
The patch added "worklet"; as a new line above "use strict";. Because that was a pure insertion, its context still matched once applied, so patch-package never recognised the patch as already applied and inserted another copy on every run. Anyone who ran npm install more than once accumulated duplicate directives in node_modules, which then leaked into the bundled GitHub Actions and failed Validate Github Actions against CI's clean install, on PRs that had nothing to do with this patch. Prepend the directive to the existing "use strict"; line instead. The removal context then stops matching once applied, so patch-package detects the patch as already applied and leaves the file alone. Both remain directives: a block comment does not interrupt the directive prologue, so "use strict" still takes effect and "worklet" is still first. Verified against a pristine html-entities@2.5.3 that three consecutive patch-package runs leave exactly one directive, exit 0, and emit no warnings (applyPatches.sh treats any warning as a failure).
Contributor
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
|
@NicolasBonet 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] |
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.
Explanation of Change
patches/html-entities/html-entities+2.5.3+001+use-worklet.patchwas not idempotent, so it re-applied on everynpm installand accumulated duplicate"worklet";directives innode_modules. This is a problem because it corruptsnpm run gh-actions-buildsuch that there's a duplicated worklet line for everynpm ithat you run between builds.The patch added the directive as a new line above
"use strict";:Because that is a pure insertion, the context line it anchors on (
"use strict";var __assign=...) still matches after the patch has been applied — just shifted down by one line. patch-package applies it again at the new offset instead of recognising it as already applied, and reports success while doing so. Every subsequentnpm installadds another copy.The fix prepends the directive to the existing
"use strict";line rather than adding a line of its own:The patch now modifies a line instead of only inserting one, so once applied its removal context no longer matches and patch-package correctly detects the patch as already applied and leaves the file alone.
The comment changes from
//to/* */because the directive now shares a line with the code that follows it.Both remain directives. A block comment does not interrupt the directive prologue, so
"use strict"still takes effect and"worklet"is still the first directive — which is whatreact-native-reanimatedrequires.Fixed Issues
$ n/a - annoying development quirk.
Tests
npm installseveral times so the patch would previously have applied more than oncenpm run gh-actions-buildgrep -c 'must be a worklet' .github/actions/javascript/proposalPoliceComment/index.jsand verify it prints1Offline tests
N/A
QA Steps
N/A
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, 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.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
N/A