Skip to content

feat(ci): Run yarn-deduplicate in CI #15119

New issue

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

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

Already on GitHub? # to your account

Merged
merged 16 commits into from
Mar 17, 2025

Conversation

nwalters512
Copy link
Contributor

This PR introduces a CI step to use yarn-deduplicate to ensure that packages are maximally deduped. This makes version upgrades easier and minimizes the amount of packages that need to be installed by Yarn.

I added this to the lint job, as that seemed the best place for it. Happy to move it elsewhere if desired.

Related to #14968.

@nwalters512
Copy link
Contributor Author

@AbhiPrasad 👋 do you have any interest in merging this? I think it'll be a net positive for the project and should make it easier to keep dependencies up-to-date.

@AbhiPrasad
Copy link
Member

Hey @nwalters512 sorry for the delay! was on vacation and then a bunch of other things came up.

I agree this is a net positive, just need to find some time to set aside to merge it in and update team process stuff for us internally.

@AbhiPrasad AbhiPrasad self-assigned this Mar 4, 2025
@lforst lforst assigned lforst and unassigned AbhiPrasad Mar 5, 2025
@lforst lforst enabled auto-merge (squash) March 10, 2025 11:59
@lforst
Copy link
Contributor

lforst commented Mar 10, 2025

E2E tests do not seem to like the deduplication. Will close for now.

@lforst lforst closed this Mar 10, 2025
auto-merge was automatically disabled March 10, 2025 13:40

Pull request was closed

@lforst
Copy link
Contributor

lforst commented Mar 10, 2025

It's probably an issue with how we defined deps in our packages but not sure.

@lforst
Copy link
Contributor

lforst commented Mar 10, 2025

Nvm, seems to fail on develop too

@lforst lforst reopened this Mar 10, 2025
@nwalters512
Copy link
Contributor Author

@lforst one potential way to narrow down the issue is to dedupe dependencies one-by-one in separate PRs until we find the one that breaks the E2E tests (currently seems to just be nextjs-13). I'd be happy to open those PRs. Unfortunately, this is difficult for me to test localls, as I can't even get the E2E tests to pass locally on the develop branch.

@lforst
Copy link
Contributor

lforst commented Mar 12, 2025

@nwalters512 I'd love to merge this but I can't justify spending time on it. None of this is user facing unfortunately.

@nwalters512
Copy link
Contributor Author

@lforst understood, hence my offer to continue driving this forward myself. If you don't even want to spend time reviewing other dependency bump/dedupe PRs, I'd understand that too though.

@lforst
Copy link
Contributor

lforst commented Mar 12, 2025

@nwalters512 Oh if you manage to make the tests pass please go ahead 😄 I they pass we can merge. I just won't spend time on it any longer I think.

@nwalters512
Copy link
Contributor Author

I'll see what I can do! The fact that just changing dependencies within their semver-compatible versions can make tests fail is a bit of a red flag, so there's probably some interesting deeper issue here.

@nwalters512
Copy link
Contributor Author

First round of this is #15639, all tests pass after deduping all @babel dependencies.

Lms24 pushed a commit that referenced this pull request Mar 13, 2025
Splitting this out of #15119 in the hope that gradually deduping things
will help identify which dependency is causing the Next E2E tests to
fail in that PR.
@nwalters512
Copy link
Contributor Author

I was able to get the nextjs-13 tests passing locally for me on develop. They start failing with a timeout as soon as rollup is deduplicated:

  1) [chromium] › tests/client/pages-dir-pageload.test.ts:50:5 › should create a pageload transaction with correct name when an error occurs in getServerSideProps 

    Test timeout of 30000ms exceeded.

@nwalters512
Copy link
Contributor Author

I've narrowed it down to rollup@4.34.0. Things work with v4.33.0, and fail with v4.34.0, the next version that was published.

@nwalters512
Copy link
Contributor Author

I believe Rollup is stripping properties out of an object when it shouldn't be.

Here's the relevant code:

const getInitialPropsWrappers: Record<string, any> = {
'/_app': Sentry.wrapAppGetInitialPropsWithSentry,
'/_document': Sentry.wrapDocumentGetInitialPropsWithSentry,
'/_error': Sentry.wrapErrorGetInitialPropsWithSentry,
};

Here's how it looks when things work (old version of Rollup):

const getInitialPropsWrappers = {
  '/_app': Sentry.wrapAppGetInitialPropsWithSentry,
  '/_document': Sentry.wrapDocumentGetInitialPropsWithSentry,
  '/_error': Sentry.wrapErrorGetInitialPropsWithSentry,
};

And when things break (newest version of Rollup):

const getInitialPropsWrappers = {
  };

@nwalters512
Copy link
Contributor Author

I opened #15651 to independently upgrade to the latest version of Rollup and fix the bug that it caused in the @sentry/nextjs package.

@lforst lforst merged commit 16e40f4 into getsentry:develop Mar 17, 2025
135 checks passed
@nwalters512 nwalters512 deleted the ci-yarn-deduplicate branch March 17, 2025 15:54
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants