fix(serve): the run list notices a run appearing or disappearing - #175
Merged
Conversation
`refresh()` is the only thing that reads the run list, and it ran once per project selection plus once when the dashboard itself started a run. Every other way the set changes went unnoticed: a run started with `ratatoskr run` in a terminal never appeared, and one deleted by `ratatoskr runs rm` stayed on screen indefinitely. A reload or a project switch was the only cure. Polled rather than streamed because there is no event for "the set of runs changed". The per-run stream exists only once you know a run to subscribe to, which is precisely the thing being missed. Ten seconds, and only while the tab is visible, with an immediate read when it becomes visible again — a backgrounded dashboard costs nothing and a returning one is current at once. The selection is fixed with it. `refresh` kept the current `runId` unconditionally, so deleting the selected run left its row gone from the list while the detail pane went on showing it. It now keeps a selection that still exists and falls back to the newest when it does not. Verified against a browser held open across the change: 74 rows, delete one, 73 rows fourteen seconds later, no reload.
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.
refresh()is the only thing that reads the run list, and it ran once per project selection plus once when the dashboard itself started a run:Every other way the set changes went unnoticed. A run started with
ratatoskr runin a terminal never appeared; a run deleted byratatoskr runs rmstayed on screen indefinitely. A reload or a project switch was the only cure, which is easy to miss because the dashboard otherwise looks live — the event stream keeps updating the run you are already on.Polled, not streamed
There is no event for "the set of runs changed". The per-run stream only exists once you know a run to subscribe to, which is exactly the thing being missed, so a stream cannot carry the first news of a run.
Ten seconds, and only while the tab is visible, with an immediate read on becoming visible again. A backgrounded dashboard costs nothing, and coming back to one shows the current set at once rather than after the next tick — which is the common case, since the reason the set changed is usually something you just did in a terminal.
The selection, too
refreshkept the currentrunIdunconditionally. Deleting the selected run therefore removed its row from the list while the detail pane went on showing it — a run that no longer exists, rendered as though it did. It now keeps a selection that is still in the list and falls back to the newest when it is not.Verified
Driven with a browser held open across the change, rather than asserted about the code: 74 rows on load, one run deleted from a terminal, 73 rows fourteen seconds later, no reload. Before this, it stayed at 74.
bun run typecheckpasses.cargo fmt,cargo clippy --workspace --all-targets -D warningsandcargo test --workspaceare green — no Rust changed, but the dashboard ships from this workspace.Note there is no unit test:
web/has no test runner, so a test file there only gates typecheck and never executes. The browser check above is the verification.