Skip to content

feat(js_run_devserver): notify after runfiles sync - #2964

Closed
longlho wants to merge 3 commits into
aspect-build:mainfrom
longlho:agent/js-run-devserver-sync-events
Closed

feat(js_run_devserver): notify after runfiles sync#2964
longlho wants to merge 3 commits into
aspect-build:mainfrom
longlho:agent/js-run-devserver-sync-events

Conversation

@longlho

@longlho longlho commented Aug 3, 2026

Copy link
Copy Markdown

Why

js_run_devserver copies runfiles into a sandbox. iBazel's notify_changes_v1 reports workspace changes before that copy finishes, so dev servers cannot safely use those paths for HMR.

What

Adds opt-in notify_runfiles_changes support:

  • requests ibazel_notify_changes_v1
  • selectively syncs affected source runfiles while still scanning generated outputs
  • falls back to a full sync for graph or unmappable changes
  • emits JS_RUN_DEVSERVER_SYNCED after sync, with added, changed, and deleted sandbox paths plus the triggering iBazel event
  • sets JS_RUN_DEVSERVER_NOTIFY_RUNFILES_CHANGES=1 for the child process

Existing targets keep legacy behavior unless they opt in.

Test

bazel test //js/private/test/js_run_devserver:all //js/private/devserver:watch_checked_tests --test_output=errors

@longlho
longlho marked this pull request as ready for review August 4, 2026 01:00

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3f1b569eb6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +240 to +243
if (chunkString.includes('IBAZEL_BUILD_COMPLETED SUCCESS')) {
if (notifyRunfilesChanges) {
pendingBuildCompleted = chunkString
return

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fall back when iBazel omits the v1 event

When notify_runfiles_changes is enabled with an older iBazel version that recognizes ibazel_notify_changes but not ibazel_notify_changes_v1, this branch buffers every legacy success marker and returns, while syncBuild is invoked only if a structured event later arrives. No such event will arrive in that environment, so incremental outputs remain stale and the child never receives IBAZEL_BUILD_COMPLETED SUCCESS; preserve legacy synchronization, fail fast on an unsupported protocol, or add a bounded fallback instead of waiting indefinitely.

Useful? React with 👍 / 👎.

@longlho longlho closed this Sep 2, 2026
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.

1 participant