Commit e39965c
Add batched POST /chromium/configure (#244)
## Summary
- Adds **`POST /chromium/configure`**: one multipart request to batch
display sizing, Chrome policies, Chromium flags, profile archive,
extensions, and optional **`start_url`** navigation after a single
Chromium restart.
- Introduces **`cdpclient.NavigateFirstPage`** for post-ready
`Page.navigate` (flattened CDP session, waits for load /
`domcontentloaded`). Fixes concurrent WebSocket reads that caused flaky
navigate failures.
- Refactors extension upload logic into shared
**`applyExtensionZipItems`** used by configure and existing
upload-and-restart.
- E2e: **31-way powerset** over optional configure parts plus bare/JSON
`start_url` tests; local runner script and **`DETACHED=1`** headless
`run-docker.sh` for manual API use.
- **`make test`**: e2e package timeout raised to **120m** (full suite
exceeds default 10m).
## Test plan
- [x] `go vet ./...` and unit tests (`go test` excluding `/e2e`)
- [x] `./scripts/run-local-chromium-configure-powerset.sh` (31
permutations + start_url variants) against locally built headless image
- [x] Full `go test -race -timeout 120m ./e2e/` with
`E2E_CHROMIUM_HEADLESS_IMAGE` / `E2E_CHROMIUM_HEADFUL_IMAGE` pointing at
images built from this branch
Made with [Cursor](https://cursor.com)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Moderate risk: introduces a new multipart configure endpoint that
performs filesystem/policy/flag/profile mutations and changes the
Chromium restart/DevTools-readiness flow, which could affect instance
startup stability and extension handling.
>
> **Overview**
> Adds a new multipart `POST /configure` endpoint to apply *batched*
Chromium/session changes (policies, flags, extensions, profile archive,
and display sizing) with a **single stop/start cycle**, plus optional
best-effort `start_url` navigation via CDP.
>
> Refactors extension installation into shared `applyExtensionZipItems`
(with partial-install cleanup) and reworks Chromium restart logic to
explicitly `stop` then `start` via `supervisorctl`, waiting for DevTools
readiness by actively dialing the upstream.
>
> Extends `cdpclient` with `DispatchStartURL`, updates generated OpenAPI
client/server types (including structured `ChromiumConfigureError`),
adds unit + e2e coverage for multipart combinations, and increases e2e
test timeout to `120m`.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
0f63e8a. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 6218b60 commit e39965c
9 files changed
Lines changed: 2333 additions & 357 deletions
File tree
- server
- cmd/api/api
- e2e
- lib
- cdpclient
- oapi
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
Large diffs are not rendered by default.
0 commit comments