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

feat(tasks-fs): bump up notify, fix empty file watch #7340

Merged
merged 5 commits into from
Feb 12, 2024
Merged

Conversation

kwonoj
Copy link
Contributor

@kwonoj kwonoj commented Feb 10, 2024

Description

This PR upgrades notify pkg to create a filesystem watcher.

It is due to recent issue we found in PACK-2437, the edge cases like

  • start a watcher with file have any contents
  • open editor, clear all (make file empty), save

doesn't create any file watcher event. This makes some cases turbopack does not trigger hmr even if it's desired.

One thing to note is even with upgrade its event kind is somewhat unexpected; it's not Modify event but Metadata event. I can't say why it emits in that way, but add it as workaround for now.

We had experiences of trying to upgrade & revert this pkg before, so the upgrade plan need some caution.

Plan is

  • Once PR is approved, cut turbopack before PR and bump next.js first
  • Land PR, create new turbopack release so release contains only 1 changes to notify
  • Ensure new turbopack update in next.js won't break (like upgrading front, etcs) and make it easy to revert

Closes PACK-2437.

Copy link

vercel bot commented Feb 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-vite-web 🔄 Building (Inspect) Visit Preview 💬 Add feedback Feb 12, 2024 5:31pm
rust-docs ❌ Failed (Inspect) Feb 12, 2024 5:31pm
9 Ignored Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Visit Preview Feb 12, 2024 5:31pm
examples-designsystem-docs ⬜️ Ignored (Inspect) Visit Preview Feb 12, 2024 5:31pm
examples-gatsby-web ⬜️ Ignored (Inspect) Visit Preview Feb 12, 2024 5:31pm
examples-kitchensink-blog ⬜️ Ignored (Inspect) Visit Preview Feb 12, 2024 5:31pm
examples-native-web ⬜️ Ignored (Inspect) Visit Preview Feb 12, 2024 5:31pm
examples-nonmonorepo ⬜️ Ignored (Inspect) Visit Preview Feb 12, 2024 5:31pm
examples-svelte-web ⬜️ Ignored (Inspect) Visit Preview Feb 12, 2024 5:31pm
examples-tailwind-web ⬜️ Ignored (Inspect) Visit Preview Feb 12, 2024 5:31pm
turbo-site ⬜️ Ignored (Inspect) Visit Preview Feb 12, 2024 5:31pm

Copy link
Contributor

github-actions bot commented Feb 10, 2024

🟢 Turbopack Benchmark CI successful 🟢

Thanks

Copy link
Contributor

github-actions bot commented Feb 10, 2024

⚠️ CI failed ⚠️

The following steps have failed in CI:

  • Turbopack Rust tests (mac/win, non-blocking)

See workflow summary for details

Copy link
Contributor

✅ This change can build next-swc

@kwonoj kwonoj force-pushed the bump-notify branch 2 times, most recently from 46cd943 to 34b9959 Compare February 10, 2024 00:49
@kwonoj kwonoj changed the title build(cargo): bump up dependencies feat(tasks-fs): bump up notify, fix empty file watch Feb 10, 2024
@kwonoj
Copy link
Contributor Author

kwonoj commented Feb 10, 2024

Testing against next.js seems passing at least vercel/next.js#61879

@kwonoj kwonoj marked this pull request as ready for review February 10, 2024 01:44
@kwonoj kwonoj requested review from a team as code owners February 10, 2024 01:44
@kwonoj kwonoj requested review from gsoltis and tknickman February 10, 2024 01:44
Cargo.toml Show resolved Hide resolved
.insert(PathBuf::from(&root));
batched_invalidate_path_and_children_dir
.insert(PathBuf::from(&root));
Ok(Ok(events)) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

would be nice to split this whole thing out into a new file like I had done in #2936

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, would like to do a followup pr. moving whole makes diff bit unfriendly in gh for the review esp this contains some event type changes for the subscription.

Copy link
Contributor

Choose a reason for hiding this comment

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

idk, you already have to manually compare as the diff doesn't line up at all

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah but it's still diff. for this change, unless it is explicitly required I'd like to make minimal.

@@ -264,6 +270,26 @@ impl DiskFileSystem {
self.start_watching_internal(true)
}

/**
Copy link
Contributor

Choose a reason for hiding this comment

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

use a doc comment for this

Comment on lines +319 to +320
debounced_watcher
.watcher()
.watch(&root_path, RecursiveMode::Recursive)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we also want the "cache" here and below?

debouncer.cache().add_root(&root_path, RecursiveMode::Recursive);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

but the version in this PR is too old

@kwonoj kwonoj merged commit 3b05764 into main Feb 12, 2024
46 of 48 checks passed
@kwonoj kwonoj deleted the bump-notify branch February 12, 2024 18:09
kwonoj added a commit to vercel/next.js that referenced this pull request Feb 12, 2024
<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->

### What

* vercel/turborepo#7340 <!-- OJ Kwon -
feat(tasks-fs): bump up notify, fix empty file watch -->

Bump up turbopack PR to fix hmr issues.

Closes PACK-2466
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 25, 2024
…o#7340)

### Description

This PR upgrades `notify` pkg to create a filesystem watcher. 

It is due to recent issue we found in PACK-2437, the edge cases like

- start a watcher with file have any contents
- open editor, clear all (make file empty), save

doesn't create any file watcher event. This makes some cases turbopack
does not trigger hmr even if it's desired.

One thing to note is even with upgrade its event kind is somewhat
unexpected; it's not `Modify` event but `Metadata` event. I can't say
why it emits in that way, but add it as workaround for now.


We had experiences of trying to upgrade & revert this pkg before, so the
upgrade plan need some caution.

Plan is

- Once PR is approved, cut turbopack _before_ PR and bump next.js first
- Land PR, create new turbopack release so release contains only 1
changes to notify
- Ensure new turbopack update in next.js won't break (like upgrading
front, etcs) and make it easy to revert


Closes PACK-2437.
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 29, 2024
…o#7340)

### Description

This PR upgrades `notify` pkg to create a filesystem watcher. 

It is due to recent issue we found in PACK-2437, the edge cases like

- start a watcher with file have any contents
- open editor, clear all (make file empty), save

doesn't create any file watcher event. This makes some cases turbopack
does not trigger hmr even if it's desired.

One thing to note is even with upgrade its event kind is somewhat
unexpected; it's not `Modify` event but `Metadata` event. I can't say
why it emits in that way, but add it as workaround for now.


We had experiences of trying to upgrade & revert this pkg before, so the
upgrade plan need some caution.

Plan is

- Once PR is approved, cut turbopack _before_ PR and bump next.js first
- Land PR, create new turbopack release so release contains only 1
changes to notify
- Ensure new turbopack update in next.js won't break (like upgrading
front, etcs) and make it easy to revert


Closes PACK-2437.
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 29, 2024
…o#7340)

### Description

This PR upgrades `notify` pkg to create a filesystem watcher. 

It is due to recent issue we found in PACK-2437, the edge cases like

- start a watcher with file have any contents
- open editor, clear all (make file empty), save

doesn't create any file watcher event. This makes some cases turbopack
does not trigger hmr even if it's desired.

One thing to note is even with upgrade its event kind is somewhat
unexpected; it's not `Modify` event but `Metadata` event. I can't say
why it emits in that way, but add it as workaround for now.


We had experiences of trying to upgrade & revert this pkg before, so the
upgrade plan need some caution.

Plan is

- Once PR is approved, cut turbopack _before_ PR and bump next.js first
- Land PR, create new turbopack release so release contains only 1
changes to notify
- Ensure new turbopack update in next.js won't break (like upgrading
front, etcs) and make it easy to revert


Closes PACK-2437.
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 1, 2024
…o#7340)

### Description

This PR upgrades `notify` pkg to create a filesystem watcher. 

It is due to recent issue we found in PACK-2437, the edge cases like

- start a watcher with file have any contents
- open editor, clear all (make file empty), save

doesn't create any file watcher event. This makes some cases turbopack
does not trigger hmr even if it's desired.

One thing to note is even with upgrade its event kind is somewhat
unexpected; it's not `Modify` event but `Metadata` event. I can't say
why it emits in that way, but add it as workaround for now.


We had experiences of trying to upgrade & revert this pkg before, so the
upgrade plan need some caution.

Plan is

- Once PR is approved, cut turbopack _before_ PR and bump next.js first
- Land PR, create new turbopack release so release contains only 1
changes to notify
- Ensure new turbopack update in next.js won't break (like upgrading
front, etcs) and make it easy to revert


Closes PACK-2437.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants