Repository navigation
Split four long e2e journeys into one-contract specs - #447
Merged
Merged
Conversation
yansfil
added a commit
that referenced
this pull request
Oct 5, 2026
…the pane settles (#449) Related: follows #420 (its "R2" list of other readers of the birth cwd); #438 and #447 are independent. ## Summary A new pane reports the cwd its shell was born in until it enters the start folder, and Herdr sends no event when that settles. #420 stopped the tab placement from reading it for a tab Hide created. This PR goes through the other readers in #420's list: where the birth cwd gives the operator a wrong result, every reader now sees the folder the tab was created for until a pane of it reports a cwd inside that checkout; where it does not, the reason is below. The clamp (`clamp_created_tab_cwds`) runs once on the session before anything reads it, and the coordinator applies it before it builds the catalog off the lock, so the rows, the purpose mirror, the pane's `cwd` and the port attribution cannot disagree. Once a pane has reported a cwd in the checkout the record is `settled` and the cwd is read as reported, so a later `cd` out of the folder is not hidden. | Reader (from #420) | Wrong with a birth cwd? | Result | | --- | --- | --- | | `worktree_control.rs` new worktree's first tab | Yes: the first tab sat under the parent folder's row | Recorded from `worktree.create`'s own `tab`; test fails without the clamp | | `session.rs` `session_spaces`, `pane_cwd` | Yes: a project row for the parent folder with no tabs, a purpose from another checkout, a branch description written from it | Clamped; test | | `runtime.rs` `project_layout_panes` (ports) | Yes: the tab claimed every listener under the parent folder | Clamped; test | | `device_catalog.rs` `tab_context` | Yes: a device tab grouped under another project | Device-created tabs recorded and clamped before grouping; test | | `replica.rs` `replace_agents` | Yes, through the same pane cwd | Covered by the same clamps (the agent's cwd too) | | `replica.rs` remote projection workspace path | Not shown wrong: grouping rebuilds projects from the tabs' cwds, now clamped | No change; a workspace the helper has not answered for still shows its first pane's path (not tested) | | `sidebar.rs` `project_agent` | No: the cwd name is used only when Herdr's workspace label is blank, which the projection never leaves | No change | | `labels/worker.rs` | No: the cwd is only the first directory searched for a session whose identity is already known | No change | ## Review - **판단해 주세요**: the 30 s birth window (`CREATED_TAB_BIRTH_WINDOW_MS`) is a judgment from the ~20 s measured in #400; a shell that starts elsewhere on purpose is believed after it. - **조심해서 볼 파일**: - `herdr-core/src/session_sync/coordinator.rs` - high-frequency path: one extra `payload.clone()` only while a recorded tab is in the session and unsettled; otherwise none. - `herdr-core/src/runtime/session.rs` - runtime mutex: the clamp is a loop over at most 64 records; no subprocess; the settled flag is read from the payload before it is clamped. - `herdr-core/src/runtime/agents.rs` - device acknowledgements record the tab; records leave with the tab or when the device's session fails. - **비용 검토**: per session publish, at most 64 records are checked against the payload's layouts; both maps are capped at 64 with the crossing reported to the diagnostic log; records end with their tab, the session, the device or the 30 s window. `path_is_within_checkout` stats paths (as the placement already does under the lock), so the cost is a few stats per unsettled tab in the session for at most 30 s. - **질문**: should a device's records survive a disconnect that keeps its tab ids? They are dropped, like the local ones, because a later connection numbers its own tabs. ## Evidence - **확인한 것**: - 8 core tests: `runtime/tests/birth_cwd.rs` (worktree first tab, no parent-folder row and purpose mirror input, no sibling listener claimed, a settled tab reads its cwd as reported) and `device_catalog.rs` (device tab stays in its folder, then follows its cwd once settled). - With the clamp disabled, the first three fail (the first tab under `/…/T`, a row for the parent folder, a claimed listener) and the device test fails with `["t1"]` against `["t1","t2"]`. - `scripts/verify-cargo.sh test-scoped -p herdr-core`: 1377 passed; `clippy -D warnings` and `fmt-check` clean. - **확인하지 못한 것**: - Left as follow-ups from review: a birth cwd inside a nested linked worktree counts as inside the checkout; a device-created worktree's first tab is not recorded; device paths are compared with the local filesystem rules; a device acknowledgement that arrives after the session carries the tab waits for the next device publish; the record uses Herdr's path spelling, which is canonical in the test but not checked against a real Herdr. - No native or Linux/Windows run, and no live device (the device path is covered by the core fixture only). - The purpose-mirror branch description write was reasoned from the code, not run: the test asserts the mirror's input (`last_session_spaces`), not the git config. - Whether Herdr's `agent.list` reports a settled cwd for a plain pane, which would shorten how long the old behavior lasted; the fix does not depend on it.
yansfil
added a commit
that referenced
this pull request
Oct 5, 2026
…tion, drop the three baseline entries it removed
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
…468) Related: #424 (s2 flaky, closing condition below); #438 (control lane; its CI showed the same delay and it is not the cause); #447, #449, #450 are independent. ## Summary The local session coordinator read Herdr's focus (`pane.layout` then `workspace.get`, 5 s each) before it ingested a session update whose focused pane differed from Hide's. That read ran on the coordinator thread, so a pane close, a zoom or a resize behind it reached the screen only after Herdr answered, up to ten seconds late, and the next stream delta waited behind it too. Now the update is ingested at once, and only the differing focus (with the zoom of the pane it names) stays Hide's until the read answers. The read runs on its own worker outside `Mutex<Runtime>`, one at a time, and a confirmed answer applies the layout the session already stored. The 5 s deadline is unchanged and nothing waits longer: the order of read and ingest is state now (`pane_focus_readback`, one slot the runtime takes under the lock and the worker frees on every way out). Separate commit `0c2a2f35` (asked for in review of #438): a lost answer that discards waiting tab or pane focus controls now records the number dropped and the request whose answer was lost in the diagnostics. ## Review - **조심해서 볼 파일**: - `herdr-core/src/runtime/session.rs` - runtime mutex and ownership: `ingest_session_awaiting_focus_readback` takes the slot under the lock, `finish_pane_focus_readback` re-checks serial, generation and pending requests before it adopts, and hands the worker the next read only when the stored layout still shows a move. - `herdr-core/src/session_sync/coordinator.rs` - failure path: `spawn_focus_readback` frees the slot on a panic, a poisoned lock, a dropped runtime and a failed thread start; the read itself is the same `confirm_pane_focus`. - `herdr-core/src/runtime/control_lane.rs` - failure path (separate commit, asked for in review of #438): a lost answer that discards waiting focus controls now records how many (`tab.focus.unknown`, `pane.focus.dropped`, including the pane-after-pane case that recorded nothing) and whose answer it was (target, request id, serial in the diagnostic line); `control_order.rs` asserts the counts. - **비용 검토**: no new work per input; the thread is spawned only when a stream move differs from Hide's selection, one is outstanding at most (cap 1, owner: the runtime slot), each lives at most two 5 s reads per answer and ends with its answer; an unconfirmed answer is not repeated until the next session update, so there is no retry loop. - **판단해 주세요**: while the read is out, Herdr's zoom is not shown, because a zoom's subject is the focused pane Hide has not adopted yet; the geometry (panes, splits) is shown at once. ## Evidence - **확인한 것**: - The failing test came first (commit `Test that a pane close is ingested ...`): with FakeHerdr holding `pane.layout`, the runtime's layout still had the closed pane after Herdr had been asked (`["w1:p1","w1:p2","w1:p3"]` against `["w1:p1","w1:p2"]`). It passes with the fix, and the same test locks `Mutex<Runtime>` while Herdr still holds the answer, then releases and checks the focus and zoom are followed. - 6 core tests: that one, an unconfirmed readback keeps Hide's focus and frees the slot (`session_sync/coordinator.rs`), and four in `runtime/tests/session_navigation.rs` (stale stream, a new selection or connection outlives an answer, one read outstanding and a superseded one hands on, an answer for another tab than the selected one cannot pull focus back; the last fails without its guard). The old three readback tests were rewritten onto the new calls. - `scripts/verify-cargo.sh test -p herdr-core --lib`: 1397 passed; `lint` and `fmt-check` clean; `scripts/check-capability-readers-off-lock.sh` passes. - **확인하지 못한 것**: - **Whether this resolves s2:55 (#424).** The core test proves the ingest was held behind the read and no longer is. The CI logs of the s2:55 failures show a gap of about 4.5 s before the core's authoritative update on macOS and Windows, which matches the old blocking read, but they carry no hided diagnostics, so the match is a hypothesis. The control lane in #438 is ruled out (core tests show close, zoom and resize start while it is busy). Only CI can show it. - No native, Linux or Windows run of the web e2e, and no live Herdr; the read is covered by FakeHerdr. - A zoom behind a held focus appears when the read confirms, not before; not asserted against a real Herdr. **Closing conditions.** #424 and the s2:55 flaky issue are not closed by this PR. Close them when `main` is green on the same lane (web e2e, retry 0, existing deadlines) for 2 consecutive runs after this merges and the `@flaky` tag is gone; if s2:55 fails again after that, the cause stays open on #424 and this PR is not the cause to blame twice.
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.
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.
Related: R12 of the control-order split; conditions for closing #231, #286, #303 and #308 are below. Order rules the core decides are in #438.
Summary
Four long e2e journeys were quarantined whole, so one shaky step took every contract in them out of the required lane.
Each is now split into small specs that start from one shared fixture helper, put themselves into the shape they need as setup, and assert one contract against the real pinned Herdr and hided.
Their
@flakytags are removed; no new quarantine and no newwaitForTimeoutorsetTimeoutdelay were added.agent-close-contract:13(#231)agent-tab-groups:35(#303)sidebar-menus:80(#308)s7:929(#286)24 specs return to the required lane; 0 steps stay quarantined from these four.
agent-tab-groups:216(#287) keeps its tag: it is not a long journey, and I did not establish its cause; it ran green 2 of 2 locally on top of #438, which is not enough to un-tag it.Review
workspace-views.jsonwould be faster but would stop testing the path.web/e2e/sidebar-menus.spec.ts- the checkout menu and Set as default start from a Pinned project, because the menu is the registered project's; unpinned, the menu differs.web/e2e/agent-close-contract.spec.ts- the last-pane spec closes the original tab's pane directly; the old journey closed the replacement tab's pane after the replacement existed.docs/TESTING.md- step 5 names the split specs as references.verifyruns pass on two consecutive main runs after this merges; a step that fails then gets its own issue by the Retry a failed test once in CI and file the flaky ones as issues #419 flow, not a tag.Evidence
bash scripts/verify-web.sh(typecheck, lint, unit tests, builds) passes.--repeat-each=3only; a rarer wobble is not excluded, which is what the post-merge condition above is for.