Repository navigation
fix(widgets): hold builds while a dev folder is made again, and ignore folder-only change events - #644
Merged
Conversation
…e folder-only change events A build that would start while a watched dev folder is missing within the grace, or one that fails because the folder went or came back while it ran, is now held instead of reported as failed. The folder is built once when it is back, and a rebuild asked for meanwhile answers with that build; if the folder does not return within the grace, the session stops as folder-gone as before and a waiting rebuild settles with why nothing was built. The watcher no longer builds on a change event that names a folder. Windows reports one when a build first lists a folder made a moment ago (its last-access time is set), which made an extra unchanged build follow each re-arm. Files added, removed or saved are still reported under their own names. Refs #638, #611, #614
This was referenced Oct 8, 2026
… late After a folder made again is watched anew, macOS FSEvents can report the writes that made it. For a short window after the re-arm build is reported, a change build is reported only when it is news; a real save still builds and is reported. The child-process test now waits for the folder to be gone before recreating it.
Contributor
Author
|
Review attestation: ready to merge at A push to this PR makes this attestation stale; the new head needs its own review. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #638. Follows #614 (#611).
What changed
1. No failed builds while a dev folder is made again (
packages/core/src/widget-dev-engine.ts)attempt(). A build that would start while the watched folder is missing within the 2 s grace is held, not run.rebuild()(and the runtime'sPOST .../rebuild) settles with it, afteronBuildhas been called, so the runtime view already shows it. A held rebuild keeps itsrebuildtrigger.folder-gone. A waiting rebuild settles with the held failure, or withFILES_UNREADABLE"the folder was missing".watch: false) never holds, so the standalone dev host behaves as before.2. No redundant build after a re-arm (Windows)
main: the first directory listing of a freshly made subfolder makes Windows fire achangeevent that names the folder (change widgets,change widgets\main). This is the NTFS last-access update. Reading the files fires nothing, and a second listing fires nothing. The re-arm build lists the new folders, so it caused the next build, anunchangedone.changeevent whose name is an existing folder (checked withlstat). Adding, removing or saving a file is still reported under the file's own name, so real saves still build. The tests show this, including a save that adds new nested folders, and a save straight after a re-arm.The runtime source is not changed. Only the runtime test that encoded the old "rebuild during grace fails" behaviour was updated.
Docs:
docs/open-interfaces.mdanddocs/open-interfaces.vi.mddescribe the held builds and folder-only change events. The official docs (clarkcant-web) do not describe the grace or build results at this level (docs/cli.htmlonly lists stop reasons), so they are not stale.Tests
New or changed in
packages/core/test/widget-dev-engine.spec.ts:does not call a watched folder gone while it may still come back...: a rebuild during the grace waits,lastBuildis unchanged, nothing is reported, and it settles as failed only once the folder is gone.holds a build that fails because the folder went while it ran...: the folder is deleted exactly as the build reads the manifest (a deterministicreadFileSynchook). The result is no failure, and exactly["rebuild:generation"]once the folder is back.builds a folder another process makes again exactly once...: a child process doesrm -rfand then copies 500 ms later, with 4 rebuilds during the gap and acacheRoot. All 4 settle as the same generation, andbuiltis exactly["rebuild:generation"].builds a folder another process made again once, though the build's own reading makes the platform report changes: after a child-process recreate, exactly["change:generation"], and a save right after it still builds.builds a save that adds a folder, once, and a save right after it.apps/runtime/test/widget-dev-sessions.spec.ts: a rebuild during a child-process recreate now answerslive, withlastBuildok at generation 2 and generation 2 active.Evidence (Windows 11, Node 24.11)
main's engine:failed×4.ok: false, generation 1).["change:generation","change:unchanged"]. The trace shows the folderchangeevents arriving during the re-arm build.pnpm typecheck: exit 0. eslint on the changed files: exit 0.pnpm invariants: 15/15 pass.pnpm verify: exit 0, with 575 files passed and 1 skipped, and 7858 tests passed.No open PR overlaps these files. #628, which is in progress elsewhere, touches the runtime chosen-folder code. This PR does not change runtime source.