refactor: Split server activity state from stale-project tracking#1474
Open
RandomByte wants to merge 5 commits into
Open
refactor: Split server activity state from stale-project tracking#1474RandomByte wants to merge 5 commits into
RandomByte wants to merge 5 commits into
Conversation
The server banner collapsed the dev server's lifecycle into one Status line whose `stale` value conflated two orthogonal things: what the server is doing (activity) and which projects are up-to-date. This meant a project that went stale but was never requested held the banner on `stale` forever. Split the two dimensions on the logger side: - Serve logger: replace `stale(changedProjects)` with `stale(staleProjects)`, emitting `serve-stale`. The stale set is reported independently of the activity state, so it can update while the server stays `ready`. - InteractiveConsole: `serve-stale` records the stale set without an activity transition; drop the STALE activity handling. - Build state + render: remove the STALE activity state; the READY line appends a `· N projects stale` count when any project is stale.
…cking
BuildServer exposed a single `#serverState` scalar and derived it partly by
aggregating per-project build status via `#getStaleProjectNames()`: any non-fresh
project (including a dependency that is merely INITIAL, never requested, with a
stale cache) forced the state to STALE. Under lazy building nobody rebuilds an
unrequested project, so the server wedged on `stale` and never returned to
`ready`, even though every resource was still servable on request.
Separate the two dimensions:
- Activity (`#serverState`): remove STALE. The resting state is IDLE ("ready");
SETTLING stays (it is tied to the file-watcher settle windows).
- Stale set: `#emitStale()` reports the stale-project set to the ServeLogger,
de-duplicated against the last set. Called from the reconcile close, the eager
source-change path, watcher recovery, and the no-initial-build startup.
`#reconcileServerState` no longer falls back to STALE: fully-fresh and
stale-remaining both resolve to IDLE plus a stale-set report; background
validation still runs first when INITIAL projects may be cache-clean. Build
triggering is unchanged; only how state is presented.
The reconciler already computes the stale set; #emitStale swept #projectBuildStatus again for the same result. Let it accept a pre-computed set and pass the reconciler's, halving the scans on that path. Other call sites still recompute.
RandomByte
force-pushed
the
refactor/server-stale-state
branch
from
July 23, 2026 15:59
018b57b to
21b5e85
Compare
The Serve#stale() parameter was named changedProjects, framing the input as a diff of what changed. The method reports the full current stale set, so staleProjects names it for what it is. The serve-stale event payload key and the InteractiveConsole writer state (setStale, render, the build-state field) follow suit, matching the sibling event keys pendingProjects and validatingProjects.
RandomByte
marked this pull request as ready for review
July 24, 2026 08:21
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.
Problem
The server banner mixed two separate things into one
#serverStatevalue: what the server is doing (activity) and which projects are up-to-date (staleness). Any non-fresh project forced the whole server tostale, including a dependency that is merelyINITIAL, never requested, with a stale cache. Under lazy building nobody rebuilds an unrequested project, so the server got stuck onstaleand never returned toready, even though every resource was still servable on request.Change
BuildServer's#serverState) dropsSTALE. The resting state isIDLE, rendered asready.#reconcileServerStatesettles onIDLEwhether projects are fully fresh or stale-remaining; background validation still runs first whenINITIALprojects may be cache-clean.#emitStale(), de-duplicated against the last set so the several emission sites (reconcile, eager source-change, watcher recovery, startup) don't re-emit an unchanged signal.Serve#stale(staleProjects)replacesstale(changedProjects).InteractiveConsolerecords the set onserve-staleand re-renders without an activity transition; thereadyline appends a dimmed· N projects stalecount. The standalonestalerender state is removed.