Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: Pin express to 5.0.0-alpha.8 #4918

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

Merged
jsjoeio merged 2 commits into coder:main from edvincent:main
Mar 1, 2022
Merged

fix: Pin express to 5.0.0-alpha.8 #4918

jsjoeio merged 2 commits into coder:main from edvincent:main
Mar 1, 2022

Conversation

Copy link
Contributor

@edvincent edvincent commented Feb 26, 2022
edited
Loading

Fixes #4900

Since express@5.0.0-beta.1 was released on 2022年02月14日, any new install was bumped to use that version. That's because the way semver's caret works, and how beta > alpha. And it just so happens that there's a breaking change in there apparently.

When developing, the yarn.lock file is used, which itself was pinning to express@5.0.0-alpha.8 which led to everything working well.

But when a package gets published, the lockfile gets ignored by yarn publish (see the missing yarn.lock in https://unpkg.com/browse/code-server@4.0.2/). That being said, even if present, it would still be irrelevant, because when installing code-server globally, it's still considered of a dependency of a global package. And the lockfiles from dependencies also get ignored when installing them. (See this Libraries vs Applications section for the reasons why).


I ran the release manually, and then installed the release.tar.gz package - and it all worked as expected 🎉

jsjoeio reacted with heart emoji
@edvincent edvincent requested a review from a team February 26, 2022 03:15
Copy link
Contributor Author

Thoughts on extending the CI to not only run the end-to-end tests on the binary, but ### also on the npm version? Happy to give it a go, but it might extend the duration of the CI?

And I would mean doing it from installing the NPM package from release.tar.gz rather than the instance exposed by yarn watch - which I believe is what @code-asher was reporting in this commit?

Copy link
Contributor

@jsjoeio jsjoeio 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 so much for going the extra mile and explaining why we need this!

Copy link
Contributor

jsjoeio commented Feb 28, 2022

But when a package gets published, the lockfile gets ignored by yarn publish (see the missing yarn.lock in https://unpkg.com/browse/code-server@4.0.2/).

TIL! I don't think myself or @code-asher realized this.

That's because the way semver's caret works, and how beta > alpha.

I guess that bit us in the butt here. Well, won't make that mistake again. Thank you for all the links as well.

Copy link
Contributor

jsjoeio commented Feb 28, 2022

Thoughts on extending the CI to not only run the end-to-end tests on the binary, but ### also on the npm version? Happy to give it a go, but it might extend the duration of the CI?

And I would mean doing it from installing the NPM package from release.tar.gz rather than the instance exposed by yarn watch - which I believe is what @code-asher was reporting in this commit?

I guess that would have prevented this bug, right? Hmm...I mean I'm open to it since it would hopefully mean less bugs. Thoughts @code-asher?

Copy link
Contributor

@jsjoeio jsjoeio left a comment

Choose a reason for hiding this comment

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

The change itself looks good but moving to "Request changes" so we know we need to update the yarn.lock file for this to be ready to go 👍

image

Copy link
Member

Makes sense to me, we could run tests on the NPM artifact before publishing it perhaps.

jsjoeio and edvincent reacted with thumbs up emoji

Copy link
Contributor Author

The change itself looks good but moving to "Request changes" so we know we need to update the yarn.lock file for this to be ready to go 👍

Ah damn - the automation didn't run for me (as I was a first-time contributor), and I guess something is different on the way it builds it. Let me see if I can try to amend the PR for that too.

I guess that would have prevented this bug, right? Hmm...I mean I'm open to it since it would hopefully mean less bugs. Thoughts @code-asher?

Yes, it would have caught it :) Let me give it a go (always been curious how this Github Actions/Worfklows work, sounds like a perfect use-case to learn), but I'll track that in a different PR/Issue to not block this here.

Makes sense to me, we could run tests on the NPM artifact before publishing it perhaps.

You mean before publishing the NPM artifact, or before publishing any new version? As in, likely you want to prevent the binaries to be released too if the artifacts don't work? To avoid inconsistencies?

Also - rather than at publishing time, wouldn't a check that always runs (even when not publishing) would help catching the issue as early as possible? Rather than realizing at publishing and struggling to pin-point when was the regression introduced? Not sure when they run today.

jsjoeio reacted with thumbs up emoji

Copy link
Member

code-asher commented Feb 28, 2022
edited
Loading

I meant just before publishing the NPM artifact since the standalone releases use --frozen-lockfile so the dependencies will be the same there whether we test them at commit time or release time.

But yeah maybe testing earlier would be better. Maybe we can just remove --frozen-lockfile and that will be enough? Or perhaps test once with --frozen-lockfile and once without? I wish the lock file was used for end users...we essentially have two fundamentally different versions of a release because of this.

jsjoeio reacted with thumbs up emoji

Copy link
Member

code-asher commented Feb 28, 2022
edited
Loading

Actually we could just pin all the versions without using ^ and friends right (do what was done here to all the dependencies)? Not sure how much harder that would make updates though.

jsjoeio reacted with thumbs up emoji

Copy link
Contributor Author

I wish the lock file was used for end users...we essentially have two fundamentally different versions of a release because of this.

Yes, that's also the only thing I kept thinking after digging the reasons why.

Actually we could just pin all the versions without using ^ and friends right? Not sure how much harder that would make updates though.

Well, that would just mean that rather than updating the lockfile, you'd only need to update the package.json...

The main problem/side-effect would likely be the release size. Pinning all the versions wouldn't allow the dependencies to be folded down based on the best version for you OR your dependencies... Basically anywhere where "deduped" is written in https://editor.mergely.com/WfQ5xHTn/ might be a brand new package to bring (and its own dependencies, too), as there no guarantee that the version you want to bring would match your dependencies' criteria.

Let me dig around and see if there's a better way to fix the problem across the package.

jsjoeio reacted with heart emoji jsjoeio reacted with eyes emoji

Copy link

codecov bot commented Mar 1, 2022
edited
Loading

Codecov Report

Merging #4918 (8fa1fd6) into main (b3cf4c3) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@ Coverage Diff @@
## main #4918 +/- ##
=======================================
 Coverage 69.96% 69.96% 
=======================================
 Files 29 29 
 Lines 1655 1655 
 Branches 364 364 
=======================================
 Hits 1158 1158 
 Misses 423 423 
 Partials 74 74 

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b3cf4c3...8fa1fd6. Read the comment docs.

@jsjoeio jsjoeio self-assigned this Mar 1, 2022
@jsjoeio jsjoeio added bug Something isn't working dependencies Pull requests that update a dependency file labels Mar 1, 2022
Copy link
Contributor

@jsjoeio jsjoeio left a comment

Choose a reason for hiding this comment

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

Copy link
Contributor

jsjoeio commented Mar 1, 2022

I'm going to update your branch then I can merge! @edvincent really means a lot that you reported this bug, dug in and opened a PR - very rare to see that happen. Thanks so much!

edvincent reacted with heart emoji

Copy link
Contributor Author

FWIW - Downloaded the artifact from the CI run (https://github.com/coder/code-server/actions/runs/1913341110) and installed it locally. All working as expected 🎉

ubuntu@ip-172-26-6-3:~$ grep "express" package-lock.json
 "express": "5.0.0-alpha.8",
 "express": {
 "resolved": "https://registry.npmjs.org/express/-/express-5.0.0-alpha.8.tgz",

I'm going to update your branch then I can merge! @edvincent really means a lot that you reported this bug, dug in and opened a PR - very rare to see that happen. Thanks so much!

My pleasure. As I was saying, happy to give back to the project, been really helpful to have this and really enjoy the in-browser experience - so fixing problems is the least I could do.

(And selfishly, been learning a lot of stuff too, so enjoyed contributing.)

jsjoeio reacted with hooray emoji jsjoeio reacted with heart emoji

@jsjoeio jsjoeio merged commit 1465d8d into coder:main Mar 1, 2022
TinLe pushed a commit to TinLe/code-server that referenced this pull request Apr 23, 2022
Co-authored-by: Joe Previte <jjprevite@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
1 more reviewer

@jsjoeio jsjoeio jsjoeio approved these changes

Reviewers whose approvals may not affect merge requirements
Labels
bug Something isn't working dependencies Pull requests that update a dependency file
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

[Bug]: Can't run the NPM release - shows 404

AltStyle によって変換されたページ (->オリジナル) /