Skip to content

refactor: remove ESBuildContextManager from app-event-watcher#7252

Merged
isaacroldan merged 1 commit intomainfrom
04-13-refactor_remove_esbuildcontextmanager_from_app-event-watcher
Apr 14, 2026
Merged

refactor: remove ESBuildContextManager from app-event-watcher#7252
isaacroldan merged 1 commit intomainfrom
04-13-refactor_remove_esbuildcontextmanager_from_app-event-watcher

Conversation

@isaacroldan
Copy link
Copy Markdown
Contributor

@isaacroldan isaacroldan commented Apr 13, 2026

We originally added ESBuildContextManageras a faster way to re-build UI extensions -> by keeping in memory esbuild contexts, re-builds are faster.

This was at the expense of having a custom build pipeline in the app watcher just for ui extensions. This is now causing issues because ui-extensions are not following the standard build flow and therefore not running all "build steps".

This PR removes ESBuildContextManagerand brings back ui-extensions to be compiled like the rest of extensions:

  • Simplifies the dev watcher pipeline — one build path instead of two.
  • Reduces surface area — ~375 lines of code and tests deleted.
  • Makes the watcher easier to reason about — no need to track which extensions use esbuild contexts vs. the default build path.

The benefit of this manager is negligible for small extensions (we might save single digit miliseconds)

Copy link
Copy Markdown
Contributor Author

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

@isaacroldan isaacroldan marked this pull request as ready for review April 13, 2026 10:48
@isaacroldan isaacroldan requested a review from a team as a code owner April 13, 2026 10:48
Copilot AI review requested due to automatic review settings April 13, 2026 10:48
@isaacroldan isaacroldan force-pushed the 04-13-refactor_remove_esbuildcontextmanager_from_app-event-watcher branch from 1c759aa to 514b959 Compare April 13, 2026 10:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Removes the custom esbuild-context-based build path from the app dev watcher so UI extensions go through the same “standard” build pipeline (and therefore run the same build steps) as other extension types.

Changes:

  • Deleted ESBuildContextManager and its dedicated tests.
  • Simplified AppEventWatcher to always build extensions via extension.buildForBundle().
  • Updated watcher tests to no longer mock/inject the esbuild manager and to simulate errors via the standard build path.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
packages/app/src/cli/services/dev/app-events/app-watcher-esbuild.ts Removed the custom esbuild context manager implementation.
packages/app/src/cli/services/dev/app-events/app-watcher-esbuild.test.ts Removed tests tied to the esbuild context manager behavior.
packages/app/src/cli/services/dev/app-events/app-event-watcher.ts Dropped the esbuild-manager branch and unified extension builds under buildForBundle().
packages/app/src/cli/services/dev/app-events/app-event-watcher.test.ts Updated tests to match the unified build path; removed esbuild-manager mocking.
Comments suppressed due to low confidence (5)

packages/app/src/cli/services/dev/app-events/app-event-watcher.test.ts:404

  • There’s trailing whitespace on this blank line, which will likely fail formatting/linting (Prettier/no-trailing-spaces). Please remove the spaces so it’s an empty line.
          if (needsAppReload) {

packages/app/src/cli/services/dev/app-events/app-event-watcher.test.ts:441

  • There’s trailing whitespace on this blank line, which will likely fail formatting/linting (Prettier/no-trailing-spaces). Please remove the spaces so it’s an empty line.
        // Then

packages/app/src/cli/services/dev/app-events/app-event-watcher.test.ts:478

  • There’s trailing whitespace on this blank line, which will likely fail formatting/linting (Prettier/no-trailing-spaces). Please remove the spaces so it’s an empty line.
    })

packages/app/src/cli/services/dev/app-events/app-event-watcher.test.ts:512

  • There’s trailing whitespace on this blank line, which will likely fail formatting/linting (Prettier/no-trailing-spaces). Please remove the spaces so it’s an empty line.
    })

packages/app/src/cli/services/dev/app-events/app-event-watcher.test.ts:603

  • There’s trailing whitespace on this blank line, which will likely fail formatting/linting (Prettier/no-trailing-spaces). Please remove the spaces so it’s an empty line.
          type: 'file_updated',

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@isaacroldan isaacroldan force-pushed the 04-13-refactor_remove_esbuildcontextmanager_from_app-event-watcher branch 5 times, most recently from d158b9f to 21d8851 Compare April 13, 2026 12:26
Copy link
Copy Markdown
Member

@vividviolet vividviolet left a comment

Choose a reason for hiding this comment

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

This is working but we lose the stack trace for the errorimage.pngThe new build process only shows generic errors.

There's also a slight difference in how the extension gets reloaded. I'm pretty sure this is a regression (not related to this PR). When there's a build error the extension isn't supposed to reloaded at all. With this PR we get a reload of the extension with the old code. On main we get a reload with a 500 because the script is missing. This PR improves this behaviour but we're not supposed update the assets at all if the build has failed.

image.png

See videos for comparison.

Before

Screen Recording 2026-04-13 at 9.57.33 PM.mov (uploaded via Graphite)

AfterScreen Recording 2026-04-13 at 9.56.20 PM.mov (uploaded via Graphite)

@isaacroldan isaacroldan force-pushed the 04-13-refactor_remove_esbuildcontextmanager_from_app-event-watcher branch 3 times, most recently from 574cbe7 to 085b422 Compare April 14, 2026 09:33
Co-authored-by: Claude Code <claude-code@anthropic.com>
@isaacroldan isaacroldan force-pushed the 04-13-refactor_remove_esbuildcontextmanager_from_app-event-watcher branch from 085b422 to 178908c Compare April 14, 2026 09:57
Copy link
Copy Markdown
Contributor Author

Fixed the missing stacktrace, we should look into the extra updates in a new PR

Copy link
Copy Markdown
Contributor Author

isaacroldan commented Apr 14, 2026

Merge activity

  • Apr 14, 11:12 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Apr 14, 11:12 AM UTC: @isaacroldan added this pull request to the GitHub merge queue with Graphite.

@isaacroldan isaacroldan added this pull request to the merge queue Apr 14, 2026
Merged via the queue into main with commit 330e89c Apr 14, 2026
26 checks passed
@isaacroldan isaacroldan deleted the 04-13-refactor_remove_esbuildcontextmanager_from_app-event-watcher branch April 14, 2026 11:20
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.

4 participants