Repository navigation
feat(studio-server): stamp a project hf-ids without holding the event loop - #7004
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Verdict: APPROVE · 0 blocker · 0 important · 0 nits · head 03f338a2
The refactor keeps what the sync pass writes: hashAfterStamp's early return is the old condition turned around. Yielding between files only gives other code a chance to edit a file after its hash is taken. The worst outcome is a stale record entry, which just means that file is parsed again next time. stampFileHfIds still only writes when the file is unchanged, and walkDir lists the folder once up front, so a file deleted mid-pass reads as null and is skipped.
Checks
hfIdPersist*tests: 12/12 on 3 runs.- 'fails without the fix' holds. With the
setImmediateyield replaced byawait Promise.resolve(),lets the event loop run between files of a projectfails withexpected -1 to be greater than 0. It passes with the yield. - Nothing calls the async function yet:
cli/src/server/studioServer.ts:445still uses the sync pass, as the body says. - CI: no failures at review time; some jobs still running.
Contributor
Edit accuracy: accurate 271 (base branch 271), smooth 101 of thoseThe gate passes. Quarantined, measured but not gated (0) Unstable (4)
|
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 2, 2026
Merged
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.
A host can stamp a project's hf-ids without freezing its event loop.
stampProjectHfIdsreads, parses and stamps every HTML file in one synchronous run. For a desktop app that is its main thread: a 40-page project (about 330 KB of HTML) took 627 ms to stamp, with nothing else able to run. The newstampProjectHfIdsAsyncruns the same pass and yields to the event loop after each file. Both are driven by one generator (stampPass), so the record, the hash skip and the per-file stamp stay in one place; the synchronous function is unchanged in what it writes.Design: none (an async entry beside the sync one)
fails without the fix:
lets the event loop run between files of a projectWhat I measured
studio-serverhelper tests pass; typecheck clean.What I did NOT exercise
walkDir) is still one synchronous listing.Size
3 files, about +90 -25.