This repository was archived by the owner on Sep 1, 2026. It is now read-only.
Repository navigation
Rebuilt build mode around fswatch package - #4326
Merged
Jake Bailey (jakebailey) merged 11 commits intoJun 17, 2026
Merged
Jake Bailey (jakebailey) merged 11 commits into
Jake Bailey (jakebailey) merged 11 commits into
Conversation
| } | ||
|
|
||
| // Extended config file directories | ||
| for _, cfgPath := range task.resolved.ExtendedSourceFiles() { |
There was a problem hiding this comment.
checkTasksForEventChanges has a similar structure to this func, but I don't think they can really be reconciled...
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors build/watch infrastructure to use the new fswatch event-driven watcher (matching the CLI watcher architecture) and centralizes shared watch logic into internal/execute/watchmanager. It also updates tsbuild watch baselines to snapshot watch registrations.
Changes:
- Added
internal/execute/watchmanagerto own directory watch reconciliation, event coalescing, and DoCycle signaling. - Switched build mode watch (
internal/execute/build) from polling to fswatch-driven event loops, and updated CLI watch mode to use the shared manager. - Updated
tsbuildWatchreference baselines to include deterministic “Watch Registrations” output; hardened incremental buildinfo access with bounds checking.
Reviewed changes
Copilot reviewed 70 out of 70 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| testdata/baselines/reference/tsbuildWatch/sample/watches-config-files-that-are-not-present.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/sample/skips-builds-downstream-projects-if-upstream-projects-have-errors-with-stopBuildOnErrors.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/sample/skips-builds-downstream-projects-if-upstream-projects-have-errors-with-stopBuildOnErrors-when-test-does-not-reference-core.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/sample/should-not-trigger-recompilation-because-of-program-emit.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/sample/should-not-trigger-recompilation-because-of-program-emit-with-outDir-specified.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/sample/reportErrors-when-stopBuildOnErrors-is-passed-on-command-line.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/sample/reportErrors-when-preserveWatchOutput-is-passed-on-command-line.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/sample/reportErrors-when-preserveWatchOutput-is-not-used.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/sample/non-local-change-does-not-start-build-of-referencing-projects.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/sample/non-local-change-does-not-start-build-of-referencing-projects-with-circular-references.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/sample/incremental-updates-in-verbose-mode.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/sample/change-builds-changes-and-reports-found-errors-message.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/sample/change-builds-changes-and-reports-found-errors-message-with-circular-references.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/sample/builds-when-new-file-is-added,-and-its-subsequent-updates.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/sample/builds-when-new-file-is-added,-and-its-subsequent-updates-with-circular-references.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/roots/when-root-file-is-from-referenced-project.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/roots/when-root-file-is-from-referenced-project-and-shared-is-first.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/reexport/Reports-errors-correctly.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/projectsBuilding/when-there-are-8-projects-in-a-solution.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/projectsBuilding/when-there-are-8-projects-in-a-solution-with---builders-3.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/projectsBuilding/when-there-are-5-projects-in-a-solution.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/projectsBuilding/when-there-are-5-projects-in-a-solution-with---builders-2.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/projectsBuilding/when-there-are-3-projects-in-a-solution.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/projectsBuilding/when-there-are-3-projects-in-a-solution-with---builders-1.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/projectsBuilding/when-there-are-23-projects-in-a-solution.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/projectsBuilding/when-there-are-23-projects-in-a-solution-with---builders-3.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/programUpdates/works-with-extended-source-files.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/programUpdates/works-when-noUnusedParameters-changes-to-false.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/programUpdates/works-correctly-when-project-with-extended-config-is-removed.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/programUpdates/when-referenced-project-change-introduces-error-in-the-down-stream-project-and-then-fixes-it.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/programUpdates/tsbuildinfo-has-error.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/programUpdates/declarationEmitErrors-when-fixing-error-files-all-files-are-emitted.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/programUpdates/declarationEmitErrors-when-file-with-no-error-changes.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/programUpdates/declarationEmitErrors-introduceError-when-fixing-errors-only-changed-file-is-emitted.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/programUpdates/declarationEmitErrors-introduceError-when-file-with-no-error-changes.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/noEmitOnError/noEmitOnError.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/noEmitOnError/noEmitOnError-with-incremental.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/noEmitOnError/noEmitOnError-with-declaration.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/noEmitOnError/noEmitOnError-with-declaration-with-incremental.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/noEmit/syntax-errors.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/noEmit/syntax-errors-with-incremental.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/noEmit/syntax-errors-with-incremental-as-modules.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/noEmit/semantic-errors.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/noEmit/semantic-errors-with-incremental.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/noEmit/semantic-errors-with-incremental-as-modules.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/noEmit/dts-errors.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/noEmit/dts-errors-without-dts-enabled.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/noEmit/dts-errors-without-dts-enabled-with-incremental.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/noEmit/dts-errors-without-dts-enabled-with-incremental-as-modules.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/noEmit/dts-errors-with-incremental.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/noEmit/dts-errors-with-incremental-as-modules.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/noEmit/does-not-go-in-loop-when-watching-when-no-files-are-emitted.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/noEmit/does-not-go-in-loop-when-watching-when-no-files-are-emitted-with-incremental.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-cts-and-mts-extensions.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/moduleResolution/handles-the-cache-correctly-when-two-projects-use-different-module-resolution-settings.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/moduleResolution/build-mode-watches-for-changes-to-package-json-main-fields.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/libraryResolution/with-config.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/libraryResolution/with-config-with-libReplacement.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/extends/configDir-template.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/demo/updates-with-circular-reference.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/demo/updates-with-bad-reference.js | Baseline updated to include watch registration snapshot output |
| testdata/baselines/reference/tsbuildWatch/configFileErrors/reports-syntax-errors-in-config-file.js | Baseline updated to include watch registration snapshot output |
| internal/execute/watchmanager/watchmanager.go | New shared watch manager (dir watches + event coalescing + run loop) |
| internal/execute/watchmanager/watchbackend.go | Watch backend abstraction, ignore logic, and watchability heuristics |
| internal/execute/watcher.go | CLI watch mode refactored to use WatchManager |
| internal/execute/tsctests/sys.go | Test sys watch-backend wiring updated for new interface |
| internal/execute/tsctests/mock_watch_backend.go | Mock backend updated to implement watchmanager.WatchBackend |
| internal/execute/incremental/buildInfo.go | Bounds-check buildinfo fileInfos access |
| internal/execute/build/orchestrator.go | Build-mode watch converted from polling ticker to event-driven watches |
| internal/execute/build/buildtask.go | Removed polling-based watch bookkeeping from build tasks |
Andrew Branch (andrewbranch)
approved these changes
Jun 16, 2026
Jake Bailey (jakebailey)
pushed a commit
to jakebailey/TypeScript
that referenced
this pull request
Aug 13, 2026
This was referenced Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With the addition of the
fswatchpackage (PR #3980) and the CLI watcher rebuild (PR #4026), we can rebuild the build mode watcher around the same event-driven architecture, which similarly results in an idle CPU usage of <1% on average in thevscoderepo.This PR also extracts shared watch infrastructure into a new
internal/execute/watchmanagerpackage, used by both the CLI watcher and build mode.