Repository navigation
Cover window promotion across chromium restarts - #505
Merged
Merged
Conversation
The trailing Equal ran immediately after the Eventually that already waited for exactly one call, so it could only catch a duplicate that landed in the gap between them. Never gives it a real settle window, and covers the first url not being promoted again after it is replaced. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
robertjamesprior
marked this pull request as ready for review
November 6, 2026 17:31
Contributor
Author
|
Picked chruffins to review: reviewed the related window-promotion restart and reconnection paths in #503. |
chruffins
approved these changes
Nov 6, 2026
chruffins
left a comment
Contributor
There was a problem hiding this comment.
Reviewed the head commit. The new test covers promotion on a second devtools URL, and it fails when the loop ignores restart notifications. Ran it under -race (30x), the full server unit suite, and vet. No issues found.
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.
Summary
Adds the missing coverage that the window is promoted again on a chromium restart, not just once at boot: a restart produces a new devtools upstream URL, and
promoteWindowsLoopmust promote that URL too.Why
Promotion is keyed on the upstream URL changing, so the restart path is the whole mechanism for a browser that restarts mid-session — a profile load onto a warm browser, or a crash. A window left in normal state by a restart is exactly the state a
--window-sizechromium starts in, so a regression here puts the window back to a partially covered desktop without any client involvement.The existing tests cover
promoteWindowMaximizedagainst a single URL (happy path, refused dial, dropped transport). Nothing covered the loop reacting to a second URL.Changes
newPromotionServiceForLogsplits the log-writing step out ofnewPromotionService, so a test can keep appending to the log and signal a restart the way supervisord does.newPromotionServicekeeps its signature.fakeDevTools.maximizedCallsreads the counter the way the other assertions do.Testing
go test ./cmd/api/api/passesgo build ./...cleangofmt -lflags this file onmainas well, on thefakeDevToolscounter fields, which this change does not touch. Left as-is to keep the diff scoped.Note
Low Risk
Test-only changes with no production or security impact; low risk of false positives if loop timing flakiness appears in CI.
Overview
Adds regression coverage for
promoteWindowsLoopwhen Chromium restarts (new DevTools URL in the supervisord-style log). The test boots the loop on a first URL, appends a second listening line, and asserts each fake DevTools endpoint is asked to maximize exactly once—including an immediate promotion for the URL already current at loop start.Test helpers:
newPromotionServicenow delegates tonewPromotionServiceForLogso callers can own the log file and append restart lines;fakeDevTools.maximizedCalls()exposes the maximize counter for assertions.Reviewed by Cursor Bugbot for commit 25364f6. Bugbot is set up for automated code reviews on this repo. Configure here.