test: cover the code host startup step and find Playwright's Chromium like cld - #495
Merged
Merged
Conversation
The startup deadline error names the last step the code host child reported, but nothing checked that wiring. A refactor that dropped the progress callback in the child, reordered the progress calls in the browser host, or stopped recording the step in the parent would fall back to "starting the code host process" or name the wrong step while CI stayed green, and the next CI stall would be as opaque as run 36785664096. The test starts the real child and Chromium, lets the runtime download hang, and fires the 45-second deadline with fake timers. It expects the error to name "loading the host runtime". Each of the three regressions above makes it fail.
…tandalone test The standalone test runs the compiled cld with a minimal environment and, since it stopped falling back to a system Chrome, relies on Playwright's own browser lookup. That lookup reads PLAYWRIGHT_BROWSERS_PATH and, on Linux, XDG_CACHE_HOME before HOME. Only HOME was passed through, so with browsers in a custom location the child failed with "Code mode could not start Chromium" although cld itself works in that environment. Forward those two variables when they are set, like CLOUD_CLI_CHROMIUM.
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
Follow-up to #493. Two test gaps around the CLI code host start:
cldtest only found Playwright's Chromium throughHOME. Since test: start the CLI code host reliably on CI runners #493 the test relies on Playwright's own browser lookup, likecldby default. That lookup readsPLAYWRIGHT_BROWSERS_PATHand, on Linux,XDG_CACHE_HOMEbeforeHOME. The test runs the compiledcldwith a minimal environment and forwarded onlyHOME. So with browsers in a custom location it failed with "Code mode could not start Chromium", althoughclditself works in that environment.Change
packages/assistant/src/cli/code-host.test.ts: a new test starts the real child and Chromium and lets the runtime download hang. It then fires the 45-second deadline with fake timers and expects the error to name "loading the host runtime". It takes about 1 s.packages/cloud-cli/src/standalone.test.ts: forwardsPLAYWRIGHT_BROWSERS_PATHandXDG_CACHE_HOMEto the child when they are set, the same way it already forwardsCLOUD_CLI_CHROMIUM.No runtime code changes. The deadline, retries, and timeouts stay as they were.
Docs
No Fibel or
cloud-devskill change: this PR only changes tests. #493 already documented the behavior that the new test covers, in the Assistant app page and thecldAssistant reference.Verification
code-host.test.ts(20 tests) passed in 4 of 5 local runs. The failing run happened while other work kept the machine's load average around 14. Its log was truncated, so the failing test is unknown. The new test passed in every isolated and parallel run, and it calls nopage.evaluate, so it cannot have caused the leftover "Target page, context or browser has been closed" error from that run.HOMEpointing to an empty directory andPLAYWRIGHT_BROWSERS_PATHset, the version onmainfails with "Code mode could not start Chromium". This branch passes.bun run checkpasses, andgit diff --checkis clean. No server code changed, so there is no integration suite to run.