Repository navigation
fix(app): hold the address while a sheet goes back onto its own entry (phone-back flake) - #4387
Conversation
…y is on its way On a phone, Back off a sheet over another that stays (New workspace's agent list or folder browser) lands on the entry under both, and the sheets then go forward again onto the entry Back left (src/lib/sheetHistory.ts `returning`). The address bar held its writes only while a closed sheet's step off its entry was on its way, not while that way back was. New workspace reports its fields 400 ms after they change, so when that report fell between the two landings it wrote `new=workspace&...` into the address of the entry under the dialog, and the next Back, landing there, opened New workspace again. That is the CI flake at scripts/phone-back-demo-regression.ts:164 (run 44828208755). sheetBackPending becomes sheetTraversalPending and also counts the sheets' own ways back onto an entry (returning, climbing, a refusing sheet's way back), so the write is held until that popstate lands and is made on the right entry. Reproduced by holding the app's own traverseTo for 1.5 s in a scratch copy of the walk: 2 of 2 failed on main, 4 of 4 passed with the fix.
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
… with no landing Gate review of 396e9c1 (B1 HIGH, B2 MEDIUM, both reproduced with the suite's fake browser): - A way back the browser drops with no word (no Navigation API: a step by count) left `returning` set, so every later address write was held, even after the dialog closed and another pane was selected. The hold now applies only while a sheet is up; with every sheet closed nothing is held. - A way back the browser rejects cleared `returning`, but the held write was released only by a popstate, and the dialog's entry made again by the next tap is a push. The sheets that lost their way back are now counted as pending until that tap makes their entry, and sheetHistory tells the address bar (onSheetTraversalOver) when a sheet made its entry, closed or lost its way back with nothing left pending; the address bar then writes what it held, onto the sheet's entry and not the one under it. Tests: a dropped (rejected) way back holds until the tap makes the entry and says so once; a silently dropped one holds nothing once the sheets close (both fail against 396e9c1's predicate); the address bar writes the held New workspace fields onto the remade entry once told (fails against 396e9c1's useAddressBar). The trace listener of the first test stops listening after its assertion (review LOW).
|
Gate review (omo-native-gate-reviewer, GPT-6.2 Astra) of 396e9c1: BLOCK with B1 HIGH and B2 MEDIUM. Both reproduced with the suite's fake browser and fixed in 6f9b653:
At 6f9b653: |
… or its way back's sheet closed Delta gate review of 6f9b653 (D1 HIGH, D2 MEDIUM, both reproduced by the reviewer with the real modules and the suite's fake browser): - D1: a lost way back for a sheet with no entry that refused Back (`stood`) told the address bar to write, while the history was still on the other pane's entry, which it then overwrote. A way back that only ended (dropped, rejected or given up) now tells nothing; the write stays held until a landing, as at 396e9c1. - D2: a way back dropped with no word kept `returning` set, and a sheet opened afresh counted it, so its new entry got no address. A way back now counts only while the sheet it is for is up (`returning.owner`, `climbing.owner`, stranded sheets still open), which replaces the `open.size === 0` short-cut. The address bar is told only when the history is on the entry of what is shown with no landing to say so: a sheet made its entry (`write`), or the sheet a way back was for closed (the history is on the entry under it, which is what is left shown). Closed sheets no longer stay in `stranded` (review LOW). Tests: "tells nothing when the way back for a sheet with no entry that refused Back is dropped" and the fresh-sheet part of "holds no address once every sheet is closed" both fail at 6f9b653.
|
Delta gate review of 6f9b653: BLOCK with D1 HIGH and D2 MEDIUM, both reproduced by the reviewer with the real modules; fixed in 3bad30b:
At 3bad30b: |
…when a way back's sheet closed Delta gate review of 3bad30b (E1 HIGH): after Back past more than one entry (A, B, then a drawer and a menu on B; go(-2) lands on A while the drawer stays up on B), closing the drawer before its way back landed released the held write onto A's entry. A sheet closing says nothing about which entry the history is on, so leaveSheet no longer tells the address bar; only a sheet making its entry does. The held write then waits for the next landing or the next change that writes the address. Test: "tells nothing when the sheet a way back past more than one entry was for closes before it lands" (fails at 3bad30b).
|
Delta gate review of 3bad30b: BLOCK with E1 HIGH and E2 HIGH.
At 0c04125: |
|
Merged through Reviews of record at 0c04125: dori review (omo) CLEAR; omo-native-gate-reviewer (GPT-6.2 Astra) CLEAR after three BLOCK rounds (B1/B2 at 396e9c1, D1/D2 at 6f9b653, E1/E2 at 3bad30b; all reproduced; E1 and the earlier ones fixed with failing-first tests; E2 and the residual E1 path confirmed by the reviewer to happen on main 721aa78 and not widened here, filed as #4400). CodeRabbit did not review this head (rationed); merged on these reviews per the owner's standing rule. Evidence: phone-back-demo-regression.ts 20/20 in the CI image on hosthatch at this head; check fast green. |
Release 0.5.8, on the owner's word (2026-11-21: run the whole release end to end), option A by the lead's call: ship from main without #4377, so step 2 stays off by default on every PC (`accountOpensAll()` is on only when `OVIS_ACCOUNT_OPENS_ALL` is exactly `1`). #4377 (default on) moves to 0.5.9. - `package.json` and `herdr-plugin.toml`: 0.5.7 -> 0.5.8. - `REMOTE_BUNDLE_VERSION` 51 -> 52 (`shared/machines.ts`): `server/` and `shared/` changed since `remote-v51`. After this merges, `remote-v52` 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.8 2026-11-21` folded the fragments under 0.5.8; fragments merged after the fold (#4384, #4387) were moved in by hand with their PR links. No `by @login` credits: every PR in the section is the maintainer's. - `release-summaries.json`: 0.5.8 in en, ko, ja and zh: 3 new, 5 improved, 2 fixed. Step 2 is not announced for everyone; one line says `OVIS_ACCOUNT_OPENS_ALL=1` on a PC opens it by signing in once (what step 2 does, per docs/account.md). Its parts (one-press PC add, It's me, durable Not me #4341, strict mode) are not named one by one. Left out on purpose: the built-in browser's results panel and downloads list (render only with P3a's setting, not on main), Android SSH (ships through the store). - `telemetry/deployed.json` unchanged: release guards agree. ## Validation - `bun run check fast` on the remote heavy host (hosthatch) at the release commit on main cfbe85c: every step ok, unit 21695 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.8: remote bundle, telemetry Worker and release metadata are in order." - `bun scripts/release-notes.ts 0.5.8` renders the notes. - Not run: `check full` (the diff is versions, notes and one constant).
…4906) Plan step B5. Fixes #4393 and #4400 (their remaining paths), on top of #4888 which merged meanwhile. ## Problem On a phone, `useAddressBar` wrote the shown place with `replaceState` onto whatever history entry the browser was on. A sheet's own traversal (a Back it refused, a way back the browser dropped, a step that landed unheard) can leave the history on another pane's entry with this pane still shown, so a routine render could write pane B's address onto pane A's entry. #4724 and #4888 guarded one case each (`refusedEntry`). Left over: - #4393: after a closed sheet's own Back landed with no event, the user's next Back was taken for the sheet's step: the address moved to A while the screen stayed on B. - #4400 / Settings: a pane that took the place over under Settings, on an entry a sheet had closed over, was never written to the address. ## Change - **The address bar owns one entry, by key.** It remembers the key of its own entry: the one it last wrote, or the one a Back/Forward the app (or Settings) followed landed on, or the one the page just made (a sheet's, a Settings page's, a file's). It writes only onto that entry, or onto an entry whose address already names the pane shown; otherwise the write is held until the next popstate or new entry. Settings is the one exception: the entry Settings steps back onto as it closes is taken at that moment only (and not when Settings was opened over an entry that was not the address bar's own). - Keys come from `sheetHistoryEntryKey()` (the Navigation API key, or the `ovis:place` key `sheetHistory.ts` keeps where Chromium has no Navigation API). `sheetHistory.ts` gains `onHistoryEntryMade` (with the key of the entry it was made over), so an entry pushed by anyone (a file opened over another pane's entry) is owned with its correct address, also where the browser tells no key. - A browser that tells no key at all treats every entry as one: a sheet's own traversal drops ownership, and it comes back with a followed Back, the app's own move, a new entry the page made, or the sheets' "traversal over" signal. - Removed: `refusedEntry`, `wouldOverwriteRefused`. Kept: the `sheetTraversalPending()` hold and `onSheetTraversalOver` (a sheet's underlying entry is also "owned", so they still keep a dialog's draft off the entry under it, #4387), and the unread-popstate hold. - #4393: `hear` in `sheetHistory.ts` treats a step as the sheet's own only when it lands on the entry the step named (`stepOnto`); a landing elsewhere is the user's Back. `stepOnto` comes from the Navigation API or, without it in Chromium, from the `ovis:place` keys. An address write held while such a step was on its way is made once the silent landing is settled. - No UI, HTTP or WS contract change. ## Tests (failing first) New cases drive the **real** `useAddressBar` over the **real** `sheetHistory` in the fake browser of `src/lib/sheetHistory.skips.test.ts` (the hook's probe moved to `src/lib/useAddressBar.fixture.ts`, shared with `useAddressBar.hook.test.ts`): | Case | On main before this PR | Here | |---|---|---| | D1, E1, E2 of the #4387 gate reviews (pane A's entry keeps A through roster renders, owner close and rejection) | pass (since #4724); kept as locks, each fails with the write guard turned off | pass | | A jump from a drawer over B whose place was taken over on a dialog's entry | pass; fails with ownership reset turned off | pass | | Settings: the pane that took the place over under Settings is written, also after a sheet closed over that entry | **fail** (address stays on pane a) | pass | | #4393: the user's Back right after a closed sheet's own Back landed unheard | **fail** (screen stays on b) | pass | | #4400: pane b's file on its new entry with no Navigation API | **fail** (file entry keeps pane a) | pass | | No key at all: the other pane's entry is kept | pass; fails with no-key handling turned off | pass | | #4888's two cases | pass (merged) | pass | `settingsHistory.test.ts` now imports its own copy of the module: it passed only when it was the first file to load it. ## Verification (head 628d026) - `bun test src/lib/sheetHistory src/lib/useAddressBar src/lib/settingsHistory src/lib/historyKeys`: 164 pass, 0 fail. - `bun run check fast`: exit 0 (typecheck, build, unit 29660 pass / 0 fail). - `scripts/phone-back-demo-regression.ts` on a demo build of this head: **20 of 20** passed (4 at a time). `settings-pages-demo-regression.ts` passes. - Android emulator (Android 16 AVD, Chrome 133, the system's real Back key and real taps over the demo): drawer; a move to another pane, a row menu over the drawer, Back x3 back onto the first pane; a file from Files closed by Back, then Files. After every step the address's pane equals the pane shown; all steps passed in 2 of 2 runs (also 2 of 2 at the first head). - Follow-up filed for a pre-existing path found in review: #4907.
What
On a phone, the address bar now holds its write while any traversal of the sheets' own is on its way, not only a closed sheet's step off its entry.
sheetBackPending()becomessheetTraversalPending()(src/lib/sheetHistory.ts) and also counts the ways back onto an entry:returning(Back off a sheet over one that stays goes forward again onto the entry it left),climbing, and a refusing sheet's way back (stood). Its only caller isuseAddressBar, which releases a held write when the next popstate lands, and now also when sheetHistory says the history is on the entry of what is shown with no landing to tell it (onSheetTraversalOver: a sheet made its entry). A way back counts only while the sheet it is for is up; one that only ended (dropped, rejected, given up, or its sheet closed) releases nothing.Not fixed here, and present on main: after a Back across panes that a sheet refuses or returns from, a later address write can land on the other pane's entry (#4400). This PR holds those writes while the way back is pending, where main writes at once; it does not widen the case.
Why (the flake on main)
scripts/phone-back-demo-regression.ts:164failed on main at ed69fd4 (run 44828208755): after Back closed New workspace's folder browser, the next Back left.new-session-modalup for 30 s.The cause is in the app, not the script:
sheetHistorythen goes forward again onto the entry Back left (returning).DRAFT_MS). When that report fell between the two landings,useAddressBarsaw no pending step and wrotenew=workspace&cwd=...withreplaceStateinto the address of the entry under the dialog.useAddressBar's popstate readcreatefrom the address and opened New workspace again.A history trace of the walk with the app's own
traverseToheld 1.5 s shows the write landing on index 0 (replace idx=0 /?...&new=workspace&cwd=...) between the Back and the way forward, and the dialog coming back after the last Back. A user sees the same thing: Back from New workspace opens it again.Validation
navigation.traverseToheld 1.5 s, not committed): main failed 2 of 2; with the fix 4 of 4 passed.src/lib/sheetHistory.skips.test.ts:sheetTraversalPending()is true at the popstate onto the entry under the sheets and false once the way back lands. It fails against main's module ([["entry under it", false], ...]) and passes with the fix.bun test src/lib/sheetHistory src/lib/useAddressBar: 95 pass, 0 fail (3 runs in a row).scripts/phone-back-demo-regression.ts20 times in the CI runner image on hosthatch (ovis-in-image, herdr-ci-runner:fe67f3d2ccdc, 4 at a time to load it):PHONEBACK pass=20 fail=0at 396e9c1, 6f9b653, 3bad30b and 0c04125.bun run check fast(hosthatch, at 0c04125): typecheck, build, unit tests and the rest all ok.bun run check full; the other browser scripts run in this PR's CI.Changelog:
changelog.d/new-workspace-back-reopens.md.