Skip to content

Run every web e2e on the DOM terminal renderer in headless Chromium - #429

Merged
yansfil merged 4 commits into
mainfrom
ci/headless-webgl-off
Oct 5, 2026
Merged

yansfil merged 4 commits into
mainfrom
ci/headless-webgl-off

Conversation

@yansfil

@yansfil yansfil commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Related: #422

Summary

headless Chromium은 software compositing이라 xterm WebGL canvas가 바뀌는 프레임마다 page main thread에서 동기 ReadPixels로 250-500ms 멈춥니다. #405는 pane-focus-ordering.spec.ts에만 이를 껐고, 나머지 web e2e는 같은 비용을 냈습니다.
web/playwright.config.ts에서 --disable-webgl을 한 번 켜 web e2e 전체가 shell의 DOM renderer fallback을 쓰게 하고, #405의 spec별 설정을 지웠습니다. 제품 코드는 바뀌지 않습니다.
web e2e 중 WebGL renderer를 시험하는 spec은 없습니다(probe는 parsed buffer를 읽고, 선택자는 .xterm .xterm-helper-textarea .xterm-screen뿐).

Review

  • 판단해 주세요: web e2e에서 new WebglAddon() 성공 경로가 더 이상 실행되지 않습니다. desktop(Electron)만 WebGL을 실행합니다. 괜찮은지 봐 주세요.
  • 조심해서 볼 파일: web/playwright.config.ts - 모든 spec의 browser 인자. docs/TESTING.md - spec이 다시 WebGL을 켜는 방법(파일 최상위 test.use({ launchOptions })가 config 값을 통째로 대체함)을 적었습니다.
  • desktop: 범위 밖입니다. Electron은 GPU 경로가 다르고(macOS는 실제 GPU, Linux nightly는 xvfb-run), 같은 문제가 있는지는 측정하지 않았습니다. desktop/e2e/terminal-links.spec.ts:368 격리는 이 변경으로 풀리지 않습니다(다른 경로).
  • @flaky: 이 PR은 새 @flaky를 달지도, 기존 것을 떼지도 않습니다. 아래 이유로 agent-tab-groups:35(Flaky e2e: agent-tab-groups split stops a shown pane's output in the area that lost the keyboard #303)는 그대로 둡니다. 해제하려면 부하에서 N회 연속 통과 같은 별도 근거가 필요하고, 이 PR의 측정은 변경 전에도 실패하지 않아 그 근거가 못 됩니다.

Evidence

  • 확인한 것: 같은 machine(load avg 약 30-60, 다른 세션과 공유), 변경 전/후 같은 명령, 실패 0건:
    • 후보 spec tab-strip-fit + agent-tab-groups x3 반복, 18 tests: 549s -> 193s.
    • 전체의 1/8 (--shard=1/8, 16 tests): 219s -> 160s, 둘 다 통과.
    • yes 4개 부하에서 agent-tab-groups:35 + tab-strip-fit:62 x5 반복, 10 tests: 512s -> 183s, 둘 다 10/10 통과. agent-tab-groups:35 개별 시간 10-14s -> 7-9s.
    • headless Chromium에서 getContext("webgl2"): 기본 true, --disable-webgl false.
    • web typecheck, lint, check-no-workstation-identity.sh 통과. 리뷰 subagent가 WebGL/launchOptions 의존 spec이 없음을 확인했고, 제안한 문서 보강 2건을 반영했습니다.
  • 확인하지 못한 것:
    • 전체 128 tests 전후 시간: load 50-100에서 한 번에 한 시간 이상이라 1/8 shard로 대신했습니다.
    • R3 후보(agent-tab-groups:35, tab-strip-fit:61/62)의 CI 실패는 로컬에서 변경 전에도 재현되지 않아, 이 변경이 그 실패를 없앴는지는 모릅니다. 시간 단축(2.7-2.8배)만 확인했습니다. tab-strip-fit은 이 base에서 @flaky가 아니고 #416이 따로 추적합니다. CI 결과를 보고 판단해야 합니다.
    • Windows와 Linux lane은 로컬로 돌리지 않았습니다.

Headless Chromium composites in software, so each xterm WebGL frame is read
back synchronously on the page's main thread, 250 to 500 ms per frame. The
focus ordering spec already opted out; the Playwright config now does it for
the whole web suite, and that spec's own setting is removed. No web spec
tests the terminal renderer.

Related: #422
yansfil added a commit that referenced this pull request Oct 5, 2026
yansfil added a commit that referenced this pull request Oct 5, 2026
Related: #419 (재시도 분류와 nextest), 이어지는 lint PR(`ci/test-lint`)

## Summary

`docs/TESTING.md`에 실습 절 두 개를 더했습니다. "Writing a Playwright e2e
test"(9단계)와 "Writing a Rust test"(8단계)입니다.
각 단계는 무엇을 하는가, 왜, 저장소 안의 기준 예시 파일을 적습니다. 새 정책은 없고, 이미 있는 규칙을 작성 순서로
묶었습니다.
`AGENTS.md`의 테스트 줄과 `docs/README.md`의 소유 행이 두 절을 가리킵니다. 기존 "Choose what
to test"의 "Herdr is not faked" 문장은 `FakeHerdr` 예외를 적어 한 곳으로 맞췄습니다.

## Review

- **판단해 주세요**: 아직 머지되지 않은 것을 "Pending"으로 적었습니다. 이 방식이 괜찮은지, 머지 전까지 빼는 편이
나은지.
- **판단해 주세요**: 크기 상한은 숫자 없이 "lint가 들어오면 숫자를 적는다"로 뒀습니다. 숫자는 lint PR이
정합니다.
- **조심해서 볼 파일**: `docs/TESTING.md` - 아래 Pending 항목이 실제로 머지되면 같은 문장을 맞춰야
합니다.
- **질문**: 없음.

## Evidence

- **확인한 것**: 인용한 파일 경로, 함수와 테스트 이름, data 속성, diagnostic kind를 원본에서 하나씩
대조했습니다(별도 검토에서 거짓 7건을 찾아 고쳤습니다).
- **확인한 것**: 문서 내 anchor 링크가 모두 풀립니다. `scripts/tests` 108개와 policy 불변식
스크립트가 통과합니다.
- **확인하지 못한 것**: `page.clock`을 쓰는 spec이 아직 없어 그 단계는 예시 파일 없이 규칙만 적었습니다.
`tokio::time::pause()`는 `test-util` feature가 꺼져 있어, 처음 필요한 PR이 켠다고
적었습니다.

<details><summary>머지 뒤 맞출 곳 (Pending 항목)</summary>

- #419 (열림): Playwright `retries: 1`, nextest `--retries 1`, `@flaky` 격리
장치 삭제. 머지되면 두 절의 retry 단계와 기존 "Flaky tests" 절, 그리고 "Playwright retries
are off" 문장을 같이 고칩니다.
- 공용 gate(R1, 아직 PR 없음): `focusGate` 단계의 "Pending" 문장을 공용 gate 경로로 바꿉니다.
- #429 (열림): 6단계의 "Pending #429" 문장을 `web/playwright.config.ts` 기준으로
고칩니다. 두 PR 중 먼저 머지되는 쪽 뒤에 다른 쪽이 TESTING.md를 맞춥니다.
- 시계 주입(R5, 아직 PR 없음): Rust 4단계의 "Pending" 문장과 `test-util` 안내를 실제 상태로
맞춥니다.
- lint PR: 5단계에 크기 상한 숫자를 적습니다.

</details>
@yansfil
yansfil merged commit da65b8a into main Oct 5, 2026
53 of 55 checks passed
@yansfil
yansfil deleted the ci/headless-webgl-off branch October 5, 2026 04:06
yansfil added a commit that referenced this pull request Oct 5, 2026
yansfil added a commit that referenced this pull request Oct 5, 2026
Related: #433 (retried interactions), #437 (Rust sleeps), #430 (guide),
#434 (clock injection and Rust waits), #429 (headless renderer), #438
(shared gate), #419 (retries)

## Summary

Playwright specs in `web/e2e` and `desktop/e2e` now pass
`eslint-plugin-playwright` plus two repository rules, an e2e test size
budget runs in the same `lint` script, and clippy refuses
`std::thread::sleep` in Rust.
All of it runs in the existing lanes (`web lint`, `desktop lint`,
`clippy`); no new job or workflow step.
Existing violations were fixed where a state exists to wait for, and the
rest carry a reasoned allow, listed below.

## Review

- **판단해 주세요**: `quietFor` is the only sleep an e2e spec may use for a
window in which something must not happen; its 30 call sites each state
the claim. Is a time window the right form for those, or should some
become a counted check?
- **판단해 주세요**: `no-conditional-in-test` (98 hits, mostly
`process.platform` and fold toggles) and `max-expects` (2409 hits at the
default of 5) are not enabled; the size budget replaces `max-expects`.
Enable either?
- **조심해서 볼 파일**: `web/eslint-rules/hide-e2e.mjs` - two hand-written
rules; `web/scripts/check-e2e-test-size.mjs` - the baseline logic;
`web/e2e/wait.ts` - the one `eslint-disable` for `waitForTimeout`.
- **조심해서 볼 파일**: `web/e2e/s3.spec.ts` (two draft recovery tests) - they
must not reload the page, so they carry a line allow with the reason;
adding `about:blank` made both fail.
- **조심해서 볼 파일**: `web/e2e/theme.spec.ts` - `networkidle` replaced by
asserting hided's empty 404 for `/gallery`;
`web/e2e/agent-tab-groups.spec.ts` - a 300 ms sleep between two `tab
focus` calls was removed (the CLI returns after Herdr applied it, events
reach the core in order; a probe showed the first focus changes nothing
visible); `web/e2e/s3.spec.ts` - the offline window now also asserts the
file was not written.
- **질문**: #434 merged first; this branch took main and dropped the
`#437` allows on the five functions it fixed (`hide-ai/src/router.rs`
x3, `usage.rs`, `live.rs`).

## Evidence

- **확인한 것**: `pnpm lint` in `web` and `desktop` pass (ESLint plus the
size budget); `cargo clippy --workspace --all-targets -- -D warnings`
and `cargo fmt --check` pass; `scripts/tests` 108 pass; the identity and
attribution checks pass.
- **확인한 것**: each rule fires on a planted violation (`waitForTimeout`,
an action inside `toPass`, `goto` of `#token=` after `restart()`); the
size budget fails when a baselined test grows (it caught this branch's
own 9-line addition to the Overview test, which moved into a helper).
- **확인한 것**: ran the changed specs against a local `hided` and the
pinned Herdr, all pass: theme (gallery and restart), start-panel,
agent-tab-groups external focus, sidebar-pr-start, cmdk recents, both s3
draft recovery tests, s6 Main/Overview (failed once on the first run at
the File Views open, passed on the immediate rerun; this PR only
relabels a wait in that test), and the Overview graph test.
- **확인한 것**: a reviewer found the labels above too loose in a first pass
(a settle wait named `quietFor`, native captures without
`compositorPresents`, Rust allows with the wrong reason); all were fixed
before this PR.
- **확인하지 못한 것**: known gaps in the new lint: `expect.soft(fn).toPass()`,
a poll that calls an action through a helper, and a `goto` through a
local `url` variable after `restart()` are not seen; a hand-written `new
Promise((r) => setTimeout(r, ms))` is not seen either (mobile.spec x2,
remote-workspace, browser, workspace-columns x2 exist today); clippy
covers `std::thread::sleep` only, not `park_timeout`, `wait_timeout` as
a delay or a spawned `sleep`. #437 lists the Rust gap.
- **확인하지 못한 것**: the other edited specs (digit, keys, browser,
terminal-links, session-labels, the macOS desktop specs) were not run;
desktop e2e needs the macOS lane. Windows and Linux lanes run in CI.
- **확인한 것**: macOS clippy does not compile `cfg(windows)` or Linux-only
code, which is how the two Windows named-pipe waits in
`hide-platform/src/ipc.rs` slipped through (found by the Windows OS
contract job). A source scan of every `sleep(` call in the tree,
regardless of cfg, now finds none outside an allowed function; a
Windows-target clippy run reached `hide-platform` and `hide-ai` before
`ring` failed to build on this Mac, so the Windows lane in CI is the
check for the rest.
- **확인하지 못한 것**: `Instant::now` and `SystemTime::now` bans in
clock-injected modules. Clippy cannot scope a method to a module and
#434 has injected no module yet; once it has, a per-crate `clippy.toml`
or a module-level `deny` with those two methods is the follow-up.

### Sleeps and waits, before and after

| | Before | After |
| --- | --- | --- |
| `waitForTimeout` in `web/e2e` and `desktop/e2e` | 53 | 1
(`web/e2e/wait.ts`, behind three named helpers) |
| `quietFor`: a window in which something must not happen | - | 30 |
| `compositorPresents`: native capture on macOS | - | 6 |
| `measureFor`: idle measurement and sample pacing | - | 5 |
| `animationsFinished`: waits for finite animations, not time | - | 10 |
| `unchangedForFrames`: waits until a value stops changing for 30
animation frames (bounded) | - | 3 |
| Waits on time removed or replaced by a state or a stronger assertion |
- | 3 (agent-tab-groups ordering sleep, `networkidle`, s3 offline
window) |
| `no-action-in-poll` allows, all #433 | - | 10 |
| `reopen-after-restart-through-blank` allows (reconnect is the subject)
| - | 2 |

| Rust allow (`#[allow(clippy::disallowed_methods)]`) | Count |
| --- | --- |
| Bounded polling helper or inline bounded poll (sleeps between
observations of a state, with a deadline) | 26 |
| The sleep is the subject (a slow fake peer or backend) | 1 |
| A child process kept alive for the test to kill | 6 |
| Production wait, not test code | 31 |
| Test that sleeps for a state, tracked in #437 | 59 |

The production waits are allowed line by line rather than by a
crate-root allow with `deny` in test modules: that form would leave
every new `mod tests` and `tests/*.rs` file unguarded until someone adds
the attribute, whereas the line allows fail closed.

### Size budget

`web/e2e/test-size-baseline.json` (20 tests; #447 split three of them)
and `desktop/e2e/test-size-baseline.json` (13) record the tests over 120
lines or 40 `expect` calls as a ceiling that only shrinks.

## Pending guide sentences

`docs/TESTING.md` names #429, #438 and #434 as pending, and #419 for
retries and nextest; each of those pull requests fixes its own sentence
when it takes main.

<details><summary>Verification record</summary>

Base `origin/main` 4df25a0. Local runs: `pnpm lint` (web, desktop),
`scripts/verify-cargo.sh clippy --workspace --all-targets -- -D
warnings`, `fmt-check`, `python3 -m unittest discover -s scripts/tests`,
Playwright specs listed above. Review by a separate reviewer: see the PR
comments.

</details>




Main merge (#434, #435, #431, #450): baselines were refreshed after it.
Two `browser-cdp.spec.ts` tests added by main were already over the
budget and are baselined (172 and 121 lines); the Overview test grew 9
lines on main and its ceiling moved with it. Rust allows: 123 in total
after the merge.
yansfil added a commit that referenced this pull request Oct 5, 2026
## Summary

`desktop e2e` (macOS) is the longest job of a verify run and the last to
finish in 16 of the last 25 successful runs, so it sets the time
`verify` takes (job median 13.8 minutes).
Its `Remote mailbox over private SSH` step took 2.1 minutes of that
(median 126 s: about 57 s compiling the workspace again under the test's
feature set, about 53 s for the one test).
The macOS `@platform` web e2e job also holds a macOS runner, builds
hided and fetches the pinned Herdr, and finishes earlier (median 9.0
minutes).
This moves the lane there: `web-e2e.yml` takes a `remote-mailbox` input,
which builds the CLI (`verify-cargo.sh cli`, every binary the lane
starts) instead of `build -p hided` and runs the same nextest command
after the suite; `pr.yml` sets it for the macOS lane and drops the step
from `desktop e2e`.
The OS contract's macOS leg stays in `desktop e2e`.

## Review

- **판단해 주세요**: the lane now runs when `web-e2e-platform` is planned
instead of `desktop-e2e`. On the last 80 merged pull requests that is 62
runs instead of 59 (table below); `ci-plan.py` gets a comment that a
narrower `web-e2e-platform` rule would drop the lane.
- **판단해 주세요**: the mailbox test resolves dependency features differently
from the CLI build, so about 48 dependencies build a second variant that
the macOS web e2e cache (saved from `build -p hided`) does not hold:
about 25 s per run on this pull request's run. rust-cache saves only
when its key changes, and the key hashes `Cargo.toml` and `Cargo.lock`,
so main's first run after the next manifest change saves both builds;
until then the 25 s stays.
- **조심해서 볼 파일**: `.github/workflows/web-e2e.yml`, the reusable lane
nightly and the Linux and Windows lanes also call; with the input unset
(its default) their steps and cache keys are unchanged.

## Evidence

- **확인한 것 (plan)**: `ci-plan.py` (main, after #490) over the file lists
of the last 80 merged pull requests (#371-#492):

| | before (in `desktop-e2e`) | after (in `web-e2e-platform`) |
| --- | --- | --- |
| pull requests running the mailbox lane | 59 | 62 |
| lose it | | #462, #466, #487: only `desktop/` files, which the lane
does not read |
| gain it | | #381, #383, #429, #444, #447, #488: `web/e2e` specs tagged
`@platform` |

- **확인한 것 (catches)**: of 232 failed `pr.yml` runs since 2026-09-05, the
mailbox step failed in 2 (#409 `prd/hcoord-retire`, #456 cargo `typify`
bump); both plan every lane, so both still run it.
- **확인한 것 (before)**: medians of the last 22 successful verify runs:
`desktop e2e` 13.8 min, its mailbox step 126 s; `web e2e macos` 9.0 min
(build 88 s, End-to-end 382 s).
- **확인한 것 (after)**: this pull request's verify run
[37288613490](https://github.com/modakbul-gongbang/hide/actions/runs/37288613490)
(first commit; the second only removed a cache `key` line rust-cache
ignores next to `shared-key`):

| | before (median, n=22) | after (this run) |
| --- | --- | --- |
| `desktop e2e` | 13.8 min, mailbox step 126 s | 12.2 min, no mailbox
step (its suite step took 518 s against a 494 s median) |
| `web e2e macos` | 9.0 min | 11.3 min: CLI build 91 s (was `build -p
hided` 88 s), suite 383 s, mailbox step 128 s (compile 82 s of which
about 25 s dependency variants, test 43 s) |
| macOS job-minutes for the two | 22.8 | 23.5 |

Second run, on the squashed commit,
[37290394720](https://github.com/modakbul-gongbang/hide/actions/runs/37290394720):
`desktop e2e` 12.0 min, `web e2e macos` 12.6 min (CLI build 99 s, suite
386 s, mailbox step 170 s), `verify` 13.4 min.
The two macOS jobs now end within a minute of each other (12.0-12.6
against 13.8 and 9.0), so the macOS ceiling of a run drops by about 1.5
minutes, and by about 25 s more once the cache holds the dependency
variants.
- **확인한 것**: `python3 -m unittest discover -s scripts/tests` passes (125
tests); both workflow files parse.
- **확인하지 못한 것**: the warm steady state of the macOS web e2e job is seen
only after main's first run saves the new cache; the first pull-request
runs after merge are that measurement.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant