Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump corepack to fix freezes #11126

Merged
merged 8 commits into from
Dec 20, 2024
Merged

bump corepack to fix freezes #11126

merged 8 commits into from
Dec 20, 2024

Conversation

jakecoffman
Copy link
Member

What are you trying to accomplish?

There was some kind of freeze in Corepack that was reproducible if you gave it a registry that would 404:

$ script/dependabot update npm_and_yarn a/b --debug
$ export COREPACK_NPM_REGISTRY=https://npm.pkg.github.com/
$ corepack install npm@8 --global --cache-only
Internal Error: Server answered with HTTP 404 when performing the request to https://npm.pkg.github.com/npm; for troubleshooting help, see https://github.com/nodejs/corepack#troubleshooting
    at ClientRequest.<anonymous> (/usr/lib/node_modules/corepack/dist/lib/corepack.cjs:42205:23)
    at Object.onceWrapper (node:events:633:26)
    at ClientRequest.emit (node:events:518:28)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:702:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:118:17)
    at TLSSocket.socketOnData (node:_http_client:544:22)
    at TLSSocket.emit (node:events:518:28)
    at addChunk (node:internal/streams/readable:561:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
    at Readable.push (node:internal/streams/readable:392:5)

☝️ The process would not exit from there. It just hangs.

I noticed our version was out of date, so bumping it fixed the problem.

Anything you want to highlight for special attention from reviewers?

How will you know you've accomplished your goal?

We should be able to also verify that it fixes the issue in production with a live test.

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

@jakecoffman jakecoffman requested a review from a team as a code owner December 13, 2024 20:21
@jeffwidman
Copy link
Member

Related:

@jakecoffman
Copy link
Member Author

Some interesting Corepack related failures in the Specs. I don't have the time to track those down. Anyone is welcome to pick this up before I can get to it.

@jakecoffman jakecoffman marked this pull request as draft December 13, 2024 20:30
@jakecoffman
Copy link
Member Author

@jeffwidman nice, seems like there's now multiple reasons to bump Corepack!

@@ -71,6 +72,18 @@ def initialize(version)
super(T.must(version))
end

sig { params(version: VersionParameter).returns(VersionParameter) }
def clean_version(version)
Copy link
Contributor

@kbukum1 kbukum1 Dec 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Tip:
Corepack's newer versions, when installing dependencies locally, may attempt to add the packageManager field to the package.json. Instead of returning the expected version, Corepack sometimes outputs a warning message that includes the version, leading to a malformed version string. This method cleans the version string by extracting the correct semantic version (x.y.z) from the warning or input, ensuring compatibility with Dependabot and related processes.

@kbukum1 kbukum1 marked this pull request as ready for review December 20, 2024 19:21
@kbukum1
Copy link
Contributor

kbukum1 commented Dec 20, 2024

Some interesting Corepack related failures in the Specs. I don't have the time to track those down. Anyone is welcome to pick this up before I can get to it.

Yes. When corepack installing locally it is expecting to have packageManager field and returning warning instead of the version. So I am cleaning up the version to return version instead of the warning which is causing malformed version error.

Copy link
Member

@rickreyhsig rickreyhsig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the updates! The changes look good overall. It would be great to confirm that everything works as expected with the new version handling logic.

@@ -62,6 +62,7 @@ def self.semver_for(version)

sig { override.params(version: VersionParameter).void }
def initialize(version)
version = clean_version(version)
@version_string = T.let(version.to_s, String)
version = version.gsub(/^v/, "") if version.is_a?(String)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 67 is also cleaning a version string; can we consolidate?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is also moved.

@kbukum1 kbukum1 merged commit 2c7a4a0 into main Dec 20, 2024
86 checks passed
@kbukum1 kbukum1 deleted the bump-corepack branch December 20, 2024 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants