Skip to content

Detect runtime-added files in external extension watch paths#7493

Draft
isaacroldan wants to merge 1 commit intoremove-file-watcher-dead-codefrom
file-watcher-external-watch-roots
Draft

Detect runtime-added files in external extension watch paths#7493
isaacroldan wants to merge 1 commit intoremove-file-watcher-dead-codefrom
file-watcher-external-watch-roots

Conversation

@isaacroldan
Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Fixes #0000

WHAT is this pull request doing?

How to test your changes?

Post-release steps

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • The change is user-facing — I've identified the correct bump type (patch for bug fixes · minor for new features · major for breaking changes) and added a changeset with pnpm changeset add

Copy link
Copy Markdown
Contributor Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions Bot added the Area: @shopify/app @shopify/app package issues label May 7, 2026
@isaacroldan isaacroldan force-pushed the remove-file-watcher-dead-code branch from 6f9fc37 to 8e6d25a Compare May 7, 2026 16:07
@isaacroldan isaacroldan force-pushed the file-watcher-external-watch-roots branch from a80b152 to 423fc0b Compare May 7, 2026 16:07
Extensions can declare watch globs outside their own directory via
devSessionWatchConfig.paths (e.g. an admin extension's static_root, or a
function pointing at a shared sources tree). Today, files added there at
runtime aren't picked up: chokidar only watches the specific files
returned by globSync at start, not their parent directories.

This change:
- Computes the static prefix of every external watch glob (the longest
  leading path with no wildcards) and adds those prefixes to chokidar's
  watch list, deduped against the extension directories chokidar already
  watches recursively.
- Loosens discoverFileOwners to attribute paths by watch-pattern match
  rather than directory containment alone. Outside-dir paths are only
  attributed to extensions that explicitly opt in via
  devSessionWatchConfig, so the default '**/*' pattern doesn't pollute
  attribution for config-style extensions whose directory is the app
  root.
- Updates pathMatchesWatchPatterns to match against both the absolute
  path and the path relative to the extension directory, since
  devSessionWatchConfig patterns can be either form.
@isaacroldan isaacroldan force-pushed the remove-file-watcher-dead-code branch from 8e6d25a to c17d3cd Compare May 7, 2026 16:11
@isaacroldan isaacroldan force-pushed the file-watcher-external-watch-roots branch from 423fc0b to 054b1fe Compare May 7, 2026 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: @shopify/app @shopify/app package issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant