Skip to content

Lint Playwright specs and refuse thread::sleep in Rust - #445

Merged
yansfil merged 13 commits into
mainfrom
ci/test-lint
Oct 5, 2026
Merged

yansfil merged 13 commits into
mainfrom
ci/test-lint

Conversation

@yansfil

@yansfil yansfil commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

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.
  • 질문: Make Rust tests wait on state instead of a wall-clock guess #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. Rust tests sleep instead of waiting for a state or injecting the clock #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 Make Rust tests wait on state instead of a wall-clock guess #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.

Verification record

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.

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 13 commits October 5, 2026 10:43
…y rules

Replace fixed waits with animationsFinished and a named quietFor, make
reads web-first assertions, reopen through about:blank after a restart, and
bound one e2e test's size with a baseline that only shrinks.
… name the e2e sleep helpers

Split quietFor into quietFor, compositorPresents and measureFor, wait for
state at two sites that were waiting on time, and document the lint in the
testing guide and CONTRIBUTING.
…tion, drop the three baseline entries it removed
@yansfil
yansfil merged commit e38f935 into main Oct 5, 2026
31 checks passed
@yansfil
yansfil deleted the ci/test-lint branch October 5, 2026 05:05
HyunjunJeon pushed a commit to HyunjunJeon/hide that referenced this pull request Nov 9, 2026
…ore (with-hide#2149)

Closes with-hide/hide-private#561
Closes with-hide/hide-private#495
Closes with-hide/hide-private#564
Closes with-hide/hide-private#605

## Summary

e2e 픽스처가 두 번째 에이전트를 너무 일찍 시작해서, 코어가 "다른 시작이 아직 진행 중"이라며 거절하고 픽스처는 30초를
기다리다 실패했습니다.
코어는 시작 하나가 끝나기 전에는 새 시작을 받지 않는데, 첫 에이전트의 행은 그 시작이 끝나기 전에 먼저 보입니다.
이제 테스트는 행이 아니라 코어가 그 시작에 준 답(시작 패널이 읽는 것과 같은 영수증, `task_operation`)을
기다렸다가 다음 시작을 보냅니다. 거절되면 30초를 기다리지 않고 코어의 이유로 바로 실패합니다.

화면 변경 없음: 테스트 코드와 문서만 바뀝니다.

## Review

- **조심해서 볼 파일**: `web/e2e/daemon-actions.ts` `startAgentInCheckout` -
코어의 task slot 규칙(`herdr-core/src/runtime/session.rs:3994-4003`)을 그대로
읽는지, `started` 외의 답은 모두 실패로 끝나는지.
- **조심해서 볼 파일**: `web/e2e/engine-fixture.ts` - 첫 시작이 끝난 뒤에야 두 번째 시작(또는
family의 spawn)이 나갑니다. 기다림은 코어 신호뿐이고 timeout·sleep·retry는 늘리지 않았습니다.
- **원인이 다른 것**: with-hide#444 with-hide#445 with-hide#459 with-hide#479 with-hide#496 은 픽스처가 아니라 spec 안의 기다림에서 실패하고
로그에 거절이 없어 이 PR에서 다루지 않습니다.
- **Herdr 레인에서만 난 것**: with-hide#260 with-hide#489 with-hide#502 with-hide#510 with-hide#511 with-hide#519 with-hide#533 은 `*-herdr-*`
레인에서만 났고 그 레인은 #2069로 지워졌습니다. #2069와 아래 반복 run을 적은 댓글로 닫습니다.
- **열어 두는 것**: with-hide#490 with-hide#492 with-hide#523 with-hide#529 with-hide#532(`agent_pane_required`)는 이 PR이
끝내지 않습니다. 원인은 with-hide/hide-private#630에서 따로 다룹니다.

## Evidence

- **확인한 것**: own engine으로 바뀐 뒤 "second fixture agent" 실패 6건 중 5건(#561
x2, with-hide#495, with-hide#564, with-hide#605; Linux·Windows)의 setup snapshot과 hided 로그를 봤습니다. 모두
두 번째 시작의 request id로 `task_operation.busy` 거절이 남아 있습니다. 나머지 1건(#561, run
42076071271)은 로그를 받지 않았고 오류 줄만 같습니다.
- **확인한 것**: 실패 로그 순서는 tab.create 완료 -> busy 거절 -> 첫 시작의
`agent.started`, 통과한 실행은 tab.create 몇 ms 뒤 `agent.started` -> 두 번째
시작입니다.
- **확인한 것**: `web`·`desktop` typecheck, lint(e2e 크기 검사 포함) 통과.
- **확인한 것**: a79a97b, run 42202678411의 Linux 전체 e2e(6 shard)와 Windows
`@platform` e2e를 3번 돌렸습니다. 닫는 11개 제목은 매번 통과했고 재시도도 없었습니다.
- attempt 1: Linux 6/6, Windows 1/1 통과. 재시도 후 통과: `desk-lane` "Desk is
off on a new install"(Linux 4/6), with-hide#444 close-subtree(Linux 6/6)
  - attempt 2: Linux 6/6, Windows 1/1 통과, 재시도 없음
- attempt 3: Linux 6/6, Windows 1/1 통과. 재시도 후 통과: `desk-lane` 같은
테스트(Linux 4/6)
- **범위 밖**: #444가 attempt 1에서 재시도 후 통과한 것과 `desk-lane`이 두 번 재시도 후 통과한 것은
픽스처 원인이 아닙니다. 이 노드 범위 밖이고 따로 묶여 있습니다.
- **확인하지 못한 것**: 로컬 e2e는 돌리지 않았습니다(Rust debug 빌드 디스크 부족). macOS 웹 e2e는
PR CI에 없어 반복하지 않았고, 이 묶음의 21개 이슈 중 macOS에서 난 것은 없습니다.
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