Skip to content

fix(web-panel): closing a docked file or a page after a reload goes back under every page entry - #3095

Merged
devswha merged 6 commits into
mainfrom
fix/web-panel-history-3058
Nov 6, 2026
Merged

devswha merged 6 commits into
mainfrom
fix/web-panel-history-3058

Conversation

@devswha

@devswha devswha commented Nov 6, 2026 •

Copy link
Copy Markdown
Owner

Fixes #3058

What

Both cases are on a phone (or a window that widens from one) with Settings → Web links set to In the app, follow-ups of #3057.

  1. A docked file over stacked pages. Two pages stacked from the palette, the window widened so the page docks, then a file opened as a docked panel: the file takes over the page's entry, and withoutWebPanel dropped the ovis:web-panel-below count with the page's marks. Closing the file went back one entry and the first page showed again. Now useFileViewer.openFile keeps that count when it replaces an entry (a fresh push never carries one), closeFile goes back 1 + below entries, and releaseFile keeps the count, so a page that takes the docked file's entry over (a web link opened beside the pane) still goes back past the pages.
  2. A reload with a sheet open over the page. The palette's entry is a copy of the page's (its marks included). On reload lib/sheetHistory.ts stripped only the sheet mark, leaving a second page entry over the real one, so Close page landed on the real one and the page came back. Now an entry a sheet leaves as an ordinary one (reload, Forward onto a retired entry, an address changed on it) counts, when it copied a page's entry (or a docked file's entry holding the count), as one more of the page's (overCopiedWebPanel in lib/historyKeys.ts), and Close page goes back past it in the same traversal.

A diff pushed over such a docked file no longer copies the count (useRepoDiffViewer.openDiff), so the diff's file that takes the diff's entry over closes onto the file under it, not past it.

Back still walks the entries one at a time, as before.

Design

Same rule as #3057 and a browser tab: closing drops everything the panel holds, Back walks through it. No new setting, no UI change.

Not changed

presentFile / openDiffFile step back a fixed two entries when a popup file or a diff's file docks over a report that holds the entry; over a stacked report they would still land on an earlier page. Not reproduced here, left as is.

Validation

  • Failing first, scripts/palette-local-page-demo-regression.ts (phone branch, two new steps): on origin/main 1427e1c the reload step failed (Close page after a reload under the palette goes back to the pane's entry); with that fixed, the docked file step failed (closing a file docked over two pages goes back to the pane's entry). Both pass with the fix at 390 and 1280, light and dark.
  • Review round (Codex): two more failing-first checks, a page opened from the palette over a file docked over two stacked pages then Close page (browser step, failed with the first commit's releaseFile), and a retired copy of a file entry holding the count (unit assertion). Both pass.
  • Review round (omo, reproduced): new hook test in src/lib/useFilePanels.hook.test.ts (a diff's file docked over a file holding the count closes onto that file) fails without the useRepoDiffViewer.ts change (traverses to the page) and passes with it.
  • Unit: new test in src/lib/sheetHistory.test.ts (a retired entry copied from a page's counts one more) fails without the sheetHistory.ts change and passes with it; sheetHistory, useFilePanels* and webPanel tests pass.
  • In the CI runner image (herdr-ci-runner:local, uid 1001): palette-local-page, web-panel-mobile, files-panel, files-documents, deep-link, settings-pages, palette-machines, background-agent-detail, follow-focus and terminal-autoswitch regressions pass. file-viewer-regression.ts times out on .conn-live in the image on origin/main too (it needs an owned herdr pane), so not from this change.
  • bun run check fast on the head after merging origin/main: pass (12527 unit tests, 0 fail; typecheck, build, generated files).
  • After the review round, palette-local-page, web-panel-mobile and files-panel regressions again pass in the CI runner image.
  • Skipped: bun run check full (CI runs integration and browser lanes).

…ack under every page entry (#3058)

A docked file that takes over a stacked page's entry keeps the count of the web panel's entries under it, so closing the file goes back past them. A phone sheet's entry left as an ordinary one (reload, Forward onto a retired entry, an address changed on it) that copied a page's entry counts as one more of the page's, so Close page goes back past it.
@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Explain Change →

Note

CodeRabbit ASCII loading animation

Currently processing new changes in this PR. This may take a few minutes, please wait...

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 1e21796 and 4eda299.

Files selected for processing: 10

  • changelog.d/web-panel-close-under-every-page.md
  • docs/development.md
  • scripts/palette-local-page-demo-regression.ts
  • src/lib/historyKeys.ts
  • src/lib/sheetHistory.test.ts
  • src/lib/sheetHistory.ts
  • src/lib/useFilePanels.hook.test.ts
  • src/lib/useFileViewer.ts
  • src/lib/useRepoDiffViewer.ts
  • src/lib/useWebPanel.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

…py of that entry, keep the page count

Review of #3095: releaseFile kept dropping the count before a web page took the file's entry over, and a sheet's copy of a file entry holding the count was not counted as one more.
…e file that takes it

Review of #3095 (omo, reproduced): a diff pushed over a docked file holding the count copied it, and the diff's file replacing that entry closed past file A onto a page.
@devswha

devswha commented Nov 6, 2026

Copy link
Copy Markdown
Owner Author

Review notes for d0a9d3a.

omo: CLEAR on 3b31444. On b5bd13d: BLOCK for one reproduced MEDIUM this PR introduced (a diff pushed over a docked file copied the page count, so the diff's file closed past file A onto a page). Fixed in d0a9d3a (openDiff push drops the count) with a failing-first hook test. Its LOW about the description (releaseFile) is fixed in the body.

Codex (Terra 6.1, xhigh), round 1: two MEDIUMs, both fixed in b5bd13d with failing-first checks:

  • releaseFile dropped the page count before a web page took a docked file's entry over, so Close page landed on an earlier page. Fixed (count kept); browser step added.
  • A sheet's copy of a docked file's entry holding the count was not counted as one more. Fixed in overCopiedWebPanel; unit assertion added.

Codex on d0a9d3a: no HIGH, no MEDIUM introduced by the PR.

Codex round 2 (no HIGH), left after the one fix round:

  • MEDIUM, reproduced on origin/main too, outside the web panel: a reload with the palette open over a plain file leaves a copy of the file's entry, so closing the file shows it again. Follow-up A reload with the palette open over a file leaves a copy of the file's entry: closing the file shows it again #3101.
  • MEDIUM, not reproduced: Forward onto a retired palette entry while the window is wide, then narrowing, may let the web panel's width conversion rewrite the entry from event.state and drop the added count. Static reading only; left as is.
  • Not changed (noted in the body): presentFile / openDiffFile step back a fixed two entries over a stacked report.

@devswha

devswha commented Nov 6, 2026

Copy link
Copy Markdown
Owner Author

Local merge gate (owner-approved): origin/main merged (no overlap), bun run check fast passed at this head (12543/0), omo CLEAR at this head (Codex Terra xhigh no findings on the previous head), threads resolved, merges cleanly; palette-local-page, web-panel-mobile, files-panel and files-documents regressions pass in the CI runner image. Follow-up #3101. CodeRabbit was rate-limited. Fixes #3058. Merged without waiting for GitHub CI.

@devswha
devswha merged commit 2a37e2e into main Nov 6, 2026
11 of 12 checks passed
@devswha
devswha deleted the fix/web-panel-history-3058 branch November 6, 2026 01:58
devswha added a commit that referenced this pull request Nov 6, 2026
…heet goes back to the pane (#3115)

Fixes #3101

## What

On a phone, a sheet (the command palette, the ⋯ menu) is a history entry
that copies the entry it opened over. On reload `lib/sheetHistory.ts`
turned that entry into an ordinary one by dropping only the sheet's own
mark. Over a plain file, the copy kept `ovis:file-preview`, so it read
as a second entry of the file above the real one: closing the file (X)
went back one entry, landed on the real file entry, and the viewer came
back. A repository diff had the same problem.

#3095 already counts such a copy for the web panel: a copy of a page's
entry is one more of the page's (`ovis:web-panel-below`), and Close page
goes back past it. This PR applies the same rule to a file's and a
diff's own entry:

- `overCopiedWebPanel` becomes `overCopiedEntry` (`lib/historyKeys.ts`).
A copy of an entry that holds `ovis:file-preview` or `ovis:repo-diff`
now also gets the count, so the copy holds one more entry under it. A
file's or a diff's copy counts only where the entry under it is still
the one it copied: a reload, and an address an item changed on the
sheet's entry. Forward onto a retired sheet entry keeps main's rule,
which counts only the web panel's copies. After Back, another pane may
have taken over the entry under it (review round).
- `closeFile` already goes back `1 + below`. `closeDiff` now does the
same through `backUnderCurrentEntry`, in place of a single
`history.back()`. If the browser refuses the traversal, the closing
latch is released, as `closeFile` already does.
- `ovis:file-preview` and `ovis:repo-diff` now live in `historyKeys.ts`
with the other shared history keys, so `sheetHistory` can recognise them
without importing the viewers.

Back still steps through the entries one at a time, as before (#3095).

Pushes already drop the count where needed: `openFile` pushes through
`withoutWebPanel`, `openDiff` drops it, and a web page pushed from the
palette sets it to 0. So a fresh entry pushed over a copy never inherits
the count. A file or diff that replaces the copy's entry keeps the
count, so it still closes past both entries.

## Design

This follows the rule #3058/#3095 set, which a browser tab also follows:
closing drops everything the overlay holds, while Back walks through it.
Nothing changes on screen, and there is no new setting.

## Validation

- Failing first, on origin/main 72b8127:
- `scripts/files-documents-demo-regression.ts`, phone branch, new step
(Documents → a file as the popup viewer, palette over it, reload, Close
file): `closing the file after a reload under the palette goes back to
the pane's entry (0), not 1`. It passes with the fix at 390 light and
dark, and the 1280 steps pass too.
- `src/lib/sheetHistory.test.ts`, new test: a sheet's copy of a plain
file's or a diff's entry that is kept over it counts one more under it,
and a copy that Forward lands on after Back does not. Reverting either
side of the change turns it red.
- `src/lib/useFilePanels.hook.test.ts`, new test: a diff over a copy of
its entry closes back to the pane. Without the change it traverses onto
the diff's own entry. It passes with the change.
- Unit: `sheetHistory`, `useFilePanels*`, `repoDiff`, `useFileViewer`,
`webPanel` and `settingsHistory` tests pass (54 + 38). Running
`settingsHistory.test.ts` in the same process as `sheetHistory.test.ts`
fails 6 settings tests on origin/main as well, because the files
interfere with each other. Each file passes on its own.
- `bun run typecheck`: pass.
- In the CI runner image (`herdr-ci-runner:local`, uid 1001):
files-documents, files-panel, palette-local-page, web-panel-mobile,
file-viewer-mobile, diff-find and diff-line-notes regressions pass, and
so does `repo-diff-browser-qa.ts` (Back/Close/focus of the diff).
`phone-worktree-sheet-regression.ts` times out waiting for a response on
origin/main in the image too, because it needs an owned herdr pane. It
is not affected by this change.
- `bun run check fast`: pass (12585 unit tests, 0 fail; typecheck,
build, generated files).
- After the review round: `bun run check fast` passes again, and so do
the files-documents and palette-local-page regressions.
- Skipped: `bun run check full` (CI runs the integration and browser
lanes).
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.

Web page popup: a docked file or a reload over the page leaves its earlier entry to come back

1 participant