Repository navigation
test(relay): unload the old front page before moving its clock in relay-offline-reasons-regression - #4795
Conversation
…ay-offline-reasons-regression The front page checks its PCs at most once a minute, stamped in localStorage by whichever page of the tab checks first. toFront moved the page clock a minute ahead while the previous front page was still loaded: a late redraw of that page, once it read the seeded pairings, checked at the new minute, stamped it, and was unloaded by the next goto before its sockets opened. The new load then found the minute taken and opened no check, so 'precondition: both rows' timed out waiting for pc-a's socket. Each load now passes through about:blank first.
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
|
Merged through
omo gate reviewer CLEAR + Codex (gpt-6.2-sol-fast, xhigh) no findings + CodeRabbit reviewed ecd9bf2; test-only flake fix, merged by lane flake-relay-offline-reasons on Dori's word |
Release 0.5.10, prepared only. **Waiting for the maintainer's go**: nothing here is merged, tagged, deployed or submitted to a store by this PR's session. Relay PR #4779 is merged and the A15 recheck passed on `main` 12b8d90, so this PR is now ready for review; it is on `main` 84469d3. #4790's fragment, merged after the fold, was moved into 0.5.10 by hand. - `package.json` and `herdr-plugin.toml`: 0.5.9 -> 0.5.10. - `REMOTE_BUNDLE_VERSION` 53 -> 54 (`shared/machines.ts`): the release guard says the bundle's inputs changed since `remote-v53` (the files under `server/`, `shared/`, `patches/`, `scripts/` and others). After this merges, `remote-v54` is tagged on the merge commit and the **Remote PC bundles** run publishes it before the Release run. Until the Release run is done, nothing touching `server/`, `shared/`, `bun.lock` or `patches/` merges. - `CHANGELOG.md`: `bun scripts/changelog-fold.ts 0.5.10` folded 258 fragments (186 PRs) under 0.5.10, dated 2026-11-26, with their PR links. `by @login` credits added to the 31 links of PRs from outside contributors (one, #4176, already had it). - `release-summaries.json`: 0.5.10 in en, ko, ja and zh: 5 new, 5 improved, 5 fixed, each English line at most 70 characters. Left out on purpose (they stay in the changelog): everything behind the account's signed list (its switches stay off at the account service), and the phone apps' carried shell and iPhone SSH, which reach people only with the next store builds. - Android 1.0.7 (15) bump included (`app/android/app/build.gradle`, `app/store/android.md`; commit cherry-picked from `chore/android-1.0.7`): the store build is made from the v0.5.10 tag, so it must be on `main` before the tag. - `telemetry/deployed.json` unchanged: `shared/telemetry.ts` changed since v0.5.9, but main already records that Worker deploy, and the release guards agree. ## Release checklist (maintainer's go needed for every step) 1. [ ] **Account service first** (ovis-sh/account): production runs migrations up to **0039** and the Worker at **26eabfd**. Apply the migrations, then deploy the Worker right after (the account README's order; migrations only go forward). Confirm which migration production is on before the release: the pre-release survey could not read it. 2. [ ] **Relay**: `relay/` changed since v0.5.9 only in `relay/bun.test.ts` (#4557), so no relay deploy is needed for that range. #4779 and the commits since did not touch `relay/` either, apart from `relay/worker.test.ts` (#4787). If `relay/` changes before the tag, deploy relay.ovis.sh and relay-ap from the **same commit** before it. 3. [ ] **#4553** (privacy policy: direct connections are off by default) merges together with this release: the default changed in #4543 and the site deploys on merge. 4. [ ] `MIN_SUPPORTED_CLIENT_VERSION` stays **0.4.20** (`server/relay/client-floor.ts`): raising it would stop the live phone apps (iOS 1.0.2 (11), Android 1.0.5 (13)) at "Update the app". 5. [ ] The account's list switches stay **off** (`OVIS_LIST_ACCOUNTS = ""`, `OVIS_LIST_MIGRATE_ACCOUNTS = ""`, `PC_LIST_PROOF = "off"`): a list pin cannot be undone; turn them on separately once the new store builds are installed. 6. [ ] Right before merging, rebase onto `main` and move by hand any `changelog.d/` fragment merged after the fold (the Release run refuses while one is left; #4788 merged after the last sync). Merge this PR after CI passes, push `remote-v54` on the merge commit, wait for **Remote PC bundles** to publish it, then run **Release** with `0.5.10`. 7. [ ] **Android: a new store build on release day.** On the live Android app (1.0.5 / 1.0.6 native), Back on More -> Connect a PC (`/#add`) closes the app (the on-screen back arrow works; reopening returns to the PC). The page cannot fix it safely; main's native code already does (#4435). Android 1.0.7 (15) bump included in this PR; upload that build from the v0.5.10 tag the same day (steps: `~/.dori-sa/reports/android-store-build-0510/STEPS.ko.md` on the maintainer's PC). 8. [ ] **iOS next build**: it moves the shell to `capacitor://app.ovis.sh`, so people who update sign in once more and re-pair PCs that are not in an account. Write that line into the update notes before it ships. Evidence for the checklist: the pre-release blocker survey and the old-native QA of the 0.5.10 shell on the live store apps (iOS 1.0.2 (11), Android 1.0.5 (13) and 1.0.6 (14)): every flow passed except the Android Back in step 7; signed-in account flows were not exercised there. ## Contract diff v0.5.9..main (old phone apps, mixed versions) **Not purely additive.** No HTTP route or method, WebSocket message `type`, or relay frame was removed or renamed, and `WIRE_VERSION` "1", `RELAY_PROTOCOL` 1, `BRIDGE_PROTOCOL` 1, the minimum server version 0.4.21 and the client floor 0.4.20 are unchanged. The live iOS 1.0.2 / Android 1.0.5 apps load the hosted shell, so they pin no old parser; the old-native QA above passed on it. What changed meaning, all in adding one account PC to another (#4435) or behind the signed list: | Change | v0.5.9 -> main | Mixed versions | | --- | --- | --- | | `POST /api/machines/relay/account/pair` NDJSON progress `{digits}` -> `{waiting:true}` | `server/machine-api.ts`, `src/lib/api.ts` `pairAccountPc` | A 0.5.10 shell (app.ovis.sh) on a 0.5.9 PC, or the reverse, ignores the other's progress line, so the approval hint does not show; the final `machine`/`error` lines still arrive. | | Relay `pair-intent-vouched` needs `pair-pc-proof` | `server/relay/session.ts`, `server/relay-pc.ts` | Adding a PC between a 0.5.9 and a 0.5.10 PC fails (the old one is told it is outdated). Existing pairings reconnect as before. | | Vouched approval: `RemotePairingRequest.choices` [] and `proven_server_id` + `pc_label` instead of six digits | `shared/machines.ts`, `server/relay/pairing-approvals.ts`, `server/relay/routes.ts` | An old approver cannot approve a new vouched request. Ordinary digit comparisons keep their shape. | | A PC pinned to a signed list refuses legacy joins and signed `link`/`add`; one-press admission needs `listing_id` | `server/relay/session.ts`, `server/account/*` | Only with the list switches on, which stay off for this release. | | Direct connections default off when no choice is saved (#4543) | `server/relay/service.ts` | Relay keeps working; a saved choice is kept. Hence #4553 with this release. | | `POST /api/relay/reset-identity` validates its body, adds an optional `removed` guard | `server/relay/routes.ts` | An old shell's empty body still works. | The commits after the first audit (03d50dd..84469d3: #4779, #4784, #4478, #4787, #4790) only add, or change no wire shape: `list_held` on a non-list PC's own joins, a `held_here` join refusal for a key a block keeps out, and a `consumed` outcome for a settled pending input. Verified by reading both refs (`git diff v0.5.9 origin/main -- shared/ server/ relay/`, `git show` of each file at both refs); the first row was checked line by line. No skew test was run. **For the maintainer's go:** the first three rows mean PC-to-PC adds need both PCs on 0.5.10; nothing else an old phone app or an existing pairing uses was removed. ## Validation - `bun run check fast` on this PC at 8f4a344 (main 84469d3 + this PR's three commits): every step ok (unit: 28779 pass, 0 fail, 259 skip). Before that at f914315 (main 12b8d90 + the release commit): every step ok (unit: 28770 pass, 0 fail, 259 skip; typecheck, build, generated types and themes, workflow syntax). Earlier also at 0caf043 on main 03d50dd: 28720 pass, 0 fail. - CodeRabbit's three findings on 8f4a344 fixed in d96ac26 (superseded delegated-helper and plain `ovis` lines made to say the final behavior; the Memory summary no longer says agents use the notes); `bun run check fast` there: every step ok (unit: 28779 pass, 0 fail). CI on 8f4a344: success. CI on d96ac26: success after one rerun of Browser regression 3/3, where `scripts/application-paging-regression.ts` failed once and passed on the retry (a flake not quarantined; the PR changes no code it runs). CodeRabbit reviewed d96ac26 with nothing new. - After the Android cherry-pick: `bun test scripts/app-bundled-shell.test.ts scripts/app-shell.test.ts scripts/ci-browser-reach.test.ts` (the tests that read the Android version files): 120 pass, 0 fail. - `bun test scripts/changelog-fold.test.ts scripts/release-notes.test.ts server/release-notes.test.ts scripts/release-guards.test.ts`: 60 pass, 0 fail. - `bun scripts/release-guards.ts --base origin/main`: "Release 0.5.10: remote bundle, telemetry Worker and release metadata are in order." (before the bump it asked for 53 -> 54). - `bun scripts/release-notes.ts 0.5.10` renders the notes (New features 5, Improvements 5, Bug fixes 5). - Not run: `check full` (versions, notes and one constant); a mixed-version runtime test of the contract rows above. - Release day (lane release-0510-go, on the maintainer's go): merged `main` 3fbdb17 and moved by hand the three fragments merged after the fold (#4788 under Changed, #4791 and #4794 under Fixed; #4787 and #4795 are test-only and had none). `bun run check fast` at 0bbca5b: every step ok (unit: 28807 pass, 0 fail, 259 skip). `bun scripts/release-guards.ts --base origin/main`: in order. The release-notes and guard tests: 60 pass, 0 fail. The account service is already on migrations 0039 and Worker 26eabfd in production, with the list switches off.
…f and a fixed locale (#4895) ## Why Browser scripts build their own Playwright contexts (444 direct `newContext(` / `newPage(` calls on main), so service workers, language and clock setup differ per script. Two of last week's red mains came from exactly that: a page whose module preload the app's service worker was answering stayed on the boot screen on a loaded runner (#4777), and a fake clock moved under a loaded page let its timers take the new time (#4795). CI retries a failed browser script once, which hides such flakes. ## What (test-only: `scripts/` only, no product code, no CI or workflow file) - `scripts/app-context.ts` (new): the one context every browser script starts from. `APP_CONTEXT = { serviceWorkers: "block", locale: "en-US" }`; `appContext(browser, overrides)` lets a script's own options win key by key (a script about the worker says `serviceWorkers: "allow"`). `installClock(page)` starts Playwright's clock only on a page that has loaded nothing yet (not after a navigation, not after `setContent`). - `scripts/demo-browser.ts`: `withDemoBrowser` hands scripts `newContext(overrides)` from that factory; new `afterTransport` and `ignoreDefaultArgs` options for scripts that needed them. - Ratchet: `scripts/direct-contexts.ts` counts, from the parsed file (TypeScript AST, not text), direct `newContext` / `newPage` calls in every form (optional call, element access, parenthesized) and the `chromium.launch` calls of scripts that build the demo themselves (any import of `scripts/demo-build.ts`, aliases included). `scripts/direct-contexts.json` and `scripts/demo-launches.json` hold the counts; `scripts/conventions.test.ts` fails when one grows. Counts: direct contexts 444 -> 415, demo launches 126 -> 104. - `scripts/app-context.test.ts`: a page from the default context registers no service worker and reads en-US on a Korean machine (`LANGUAGE=ko_KR`); overrides win; `withDemoBrowser`'s context is the shared one and keeps the transport snippets in order; the clock is refused under a loaded or `setContent` page. - 28 demo regressions move onto `withDemoBrowser` + the shared context (22 that built the demo themselves, and the 6 already on `withDemoBrowser`). Each keeps its assertions, viewports and evidence screenshots. The remaining demo scripts follow in a second PR (about 100 files), so no script is edited twice. Behavior change, test side only: the moved scripts now run with service workers blocked (before: allowed) and en-US where they named no locale. No shared wait helper is added on purpose: a generic `waitUntil` would spread time-based guessing. ## Verification - CI runner image (`herdr-ci-runner:local`), no retries: each of the 28 moved scripts 10 times = 280 runs, 0 first-attempt failures (`c3-evidence/branch-A-summary.tsv`); after the review fixes, the 9 scripts using `installClock` 10 times each = 90 runs, 0 failures. - `bun run check fast` at this head: exit 0 (29,210 unit tests, 0 fail). - Adversarial review (Codex, gpt-6.2-sol xhigh) on the first head found one HIGH (the text scanner lost its place after a regex holding a backtick and missed two calls), three MEDIUMs (other call forms, an aliased demo-build import, a clock under `setContent`) and one LOW; all five are fixed in `a4cb0f52c`, with tests that fail on the old scanner. Its other categories (moved assertions/options/evidence, service-worker or locale dependencies, fixed sleeps, files outside `scripts/`) had no findings.
What
scripts/relay-offline-reasons-regression.tsfailed now and then withFAIL <profile>: precondition: both rows: Relay test event timed outand passed on rerun (mainpush run 45764850360 after #4779, and #4779's own PR CI). Test-only fix; no sleeps, no longer
timeouts.
Cause
The front page checks its PCs at most once a minute per tab:
src/lib/relay/pcSweep.tsstampsovis-pc-check-atin localStorage when a sweep starts, before it reads the devices or opens asocket.
toFrontmoved the page clock (page.clock.setFixedTime) a minute ahead while theprevious front page was still loaded, then navigated. Instrumented runs caught the failure 4 times
in 120, and every trace was the same:
toFrontadvances the clock toPAGE_NOW + 60 s.runs its first sweep at the new minute and stamps
ovis-pc-check-at = PAGE_NOW + 60 s.gotounloads it before it opens any socket.wait = 60000and starts no check, so pc-a's socket never opens andbounded(checked, 20 s)times out while both rows show.Fix
toFrontnavigates toabout:blankbefore it moves the clock, so no earlier page of the tab cantake the new minute.
ovis:settingsonly touches localStorage on the app origin:about:blankhas no storage, and reading it there throws a page error.The walk's assertions are unchanged.
Was it #4779?
No. In the CI runner image (
herdr-ci-runner:local,--cpus 12), with 6 copies of the scriptrunning at once for 6 rounds and both commits run side by side:
(
390-light-ko: precondition: both rows).#4779 only touches the account-join path after a SAS compare. This script seeds its pairings and
never joins.
Validation
this precondition.
bun run check fast: exit 0 (28779 pass, 0 fail; typecheck and build ok).Reviews
with a focused
createPcSweepprobe.