GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(browser): import browsing history and complete the address bar from it by Hona · Pull Request #65073 · anomalyco/opencode Conversation
|
Now (dev) |
This PR | |
|---|---|---|
| Dialog | ![]() |
![]() |
| Choose sites | ![]() |
![]() |
| Result | ![]() |
![]() |
| Some sign-ins stayed behind | ![]() |
![]() |
| Offer over a page | ![]() |
![]() |
| Offer on a new tab | ![]() |
![]() |
| Settings › Browser | ![]() |
![]() |
| Sign-ins unticked | Its result | Measured |
|---|---|---|
![]() |
![]() |
![]() |
main.ts, Ipc browser.profile.importBrowser with cookies and history):| Ticked | Cookies | History |
|---|---|---|
| Sign-ins only | read and written | no page read, the history store is not opened |
| Browsing history only | none read or written, so the other browser's cookie key is never asked for: no Keychain or key-store prompt | read and stored |
| Both | read and written | read and stored |
rune |
Down | gith |
Measured |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
Chrome 136 against this PR, with a history of github.com, github.com/anomalyco/rune-desktop, other GitHub pages and docs.rune.example/guide:
| Input | Chrome | Here |
|---|---|---|
rune, anom rune |
Row 1 is "rune - Google Search", chosen; matching pages below; Enter searches | Same |
how to center a div |
The search row, then suggestions from Google | The search row only |
gith |
Field shows github.com with ub.com selected; row 1 the site, row 2 the search. Only when the page outscores the typed text: typed more than once, a host typed once, or visited often |
Same field and rows. Completes whenever the best page begins with the text |
github.com/anom |
Completes to the page under the same rule | Same, as above |
github.com/anomalyco/rune-desktop |
The visited page is row 1, deleting or not | Same |
example.org, localhost:3000 |
Row 1 is the typed address, chosen; row 2 the search for it | Same |
| Backspace, Delete | Removes the completed part only. Deleting never completes: the typed text is row 1 | Same |
| Paste, or the caret off the end | No completion. Moving the caret takes a completed address into the text | Same |
| Down, Up | Choose the next or previous row, around either end. The field shows the row's text: https:// stays, http:// and a bare host's slash go. The rows stop changing |
Same |
| Tab, Shift+Tab | As Down and Up while the list is open; also steps onto a row's remove button | As Down and Up; rows have no button |
| Escape | 1. the typed text returns, if a row was moved to; 2. the list closes and the completed part goes; 3. the page's address returns, selected; 4. the focus leaves | Same |
| Shift+Delete | Forgets the chosen page; the row that takes its place is chosen. On the typed text's row it is the field's own key | Same |
| Click a row | Opens it | Same |
| Enter | Opens the chosen row, first or not; with the list closed, the typed text | Same |
| Arrow with the list closed | Opens the list without moving | Same |
| Leaving the field | Keeps the typed text | Drops the edit, as on dev |
refs/tags/136.0.7103.48): keys, Escape, temporary text and the caret in omnibox_edit_model.cc and omnibox_view_views.cc; moving around either end in omnibox_popup_selection.cc; the first row and searches above pages in autocomplete_result.cc and omnibox_controller.cc; what may be first in autocomplete_match.cc (SetAllowedToBeDefault); search or address in autocomplete_input.cc; completion and scores in history_url_provider.cc, history_quick_provider.cc, scored_history_match.cc and search_provider.cc. Shift+Delete is in Chrome's keyboard shortcuts.Not copied from Chrome
@, Tab to search), "switch to this tab" rows, suggestions on focus, the remove button on a row.clear: () => serial(async () => { const signedOut = await profile().then((current) => current.clear()).then(() => undefined, (cause: unknown) => ({ cause })) const forgotten = await clearHistory().then(() => true, () => false) if (signedOut) throw signedOut.cause return { history: forgotten } }),
flowchart LR
subgraph window
field[address field] -->|"input: ask(attempt, text)"| machine[address-machine.ts]
list[last 30 pages<br/>new tab page, icons] --> machine
machine -->|"rows: typed text + pages<br/>first row chosen"| dropdown[drop-down]
dialog["import dialog<br/>Sign-ins · Browsing history"]
end
subgraph main
ipc[["Ipc browser.history<br/>prepare · search · visit · retitle · remove · clear"]] --> store[(history.sqlite<br/>one row per page)]
store --> index[in-memory index<br/>search text per page]
profile[profile import] -->|"history: readHistory → add"| store
profile -->|"cookies: read → session"| cookies[(browser session)]
end
machine -->|"search(text, 8)"| ipc
ipc -->|"answered(attempt, pages)"| machine
dialog -->|"importBrowser(cookies, history, sites)"| profile
other[(other browser<br/>History · places.sqlite · History.db)] -->|private copy, deleted after the read| profile
browser/history/store.ts): <userData>/browser-history/history.sqlite through node:sqlite, in the main process only. One row per page: host without www., path without a trailing slash, query and fragment, so http/https, www. and a trailing slash are one row. At most 50,000 pages; past that the least visited and oldest go.history/search.ts): the first focus of the address field reads every page into memory as one search text per page. A keystroke is one pass over it, no database read. Opening the store reads nothing, and a visit before the first search only writes its row.history/earlier.ts), so no visit is lost.answered with any other number returns the same state. The previous answer stays, matched against the new text, so the list narrows instead of blinking.export type AddressList = /** It follows the typing, and its first row is the chosen one. */ | { readonly type: "following" } /** The person moved through it: its rows stay as they were, and the field shows the text of the row at `line`. */ | { readonly type: "held"; readonly rows: readonly AddressRow[]; readonly line: number } /** Escape closed it. Typing or an arrow key opens it again. */ | { readonly type: "closed" }
| Browser | File, table | Read | Left behind |
|---|---|---|---|
| Chromium family | History, urls |
url, title, visit_count, typed_count, last_visit_time (µs since 1601) |
hidden rows, rows never visited |
| Firefox family | places.sqlite, moz_places |
url, title, visit_count, typed, last_visit_date (µs since 1970) |
hidden places, bookmarks never visited; frecency is not read, its meaning changed in Firefox 147 |
| Safari | History.db, history_items ⋈ history_visits |
url, visit_count, latest visit's title and visit_time (s since 2001) |
needs Full Disk Access, as its cookies do; without it, 0 pages and no error |
snapshotDatabase: a private copy, deleted after the read. The other browser's files are never written or locked.PRAGMA table_info); a value of the wrong type reads as no title, no visit or no time.log2(1 + visits + typed) × recency: recency is 1 for the last 4 days and falls to 0.7 at 14 days, 0.5 at 31, 0.3 at 90 and 0.1 at a year.| Taken from | What |
|---|---|
Chrome (ScoredHistoryMatch, HistoryURLProvider) |
Word-boundary matches beat mid-word ones. The recency curve above. Typed visits weigh more (1.5× there; a typed visit counts twice here). Frequency saturates (the last 10 visits there; a logarithm here). A typed host prefix promotes the host itself. Duplicates collapse by scheme, www. and trailing slash. hidden rows stay out. |
| Firefox (Places frecency) | One number per page from frequency and recency buckets (100/70/50/30/10 at 4/14/31/90 days). All words must match, at a boundary first, then anywhere. Origin autofill scores an origin by the sum of its pages. Bookmarks never visited are not history. |
browser.history Ipc between a window and main. packages/plugin-browser, the pane and its RPC are untouched, so no browser tool lists or searches it and no tool result carries it.http(s), addresses with a user name or password, addresses over 2,048 characters. Titles are cut to 200 characters.secure_delete, then VACUUM and a truncating checkpoint. A test reads the bytes.Pinned Electron 44.9.1 (V8 15.2, SQLite 3.53.4) on Windows, a 50,000-page store of made-up pages, three process runs. dev has no store to compare with: it searches 30 visits in the window.
| 50,000 pages | |
|---|---|
| Search in main, 10 queries × 200 runs | median 1.2–6.1 ms per query, worst single run 8.7 ms |
… gith / rune / anom rune / e / no match |
2.4 / 4.7 / 4.5 / 6.0 / 1.2 ms |
| Open the store | 1.3 ms |
| Record a visit | 0.02 ms |
| First read into memory, once per run, on focusing the address field | 143–149 ms |
Import 50,000 rows: read a copy of a Chromium History + write |
140–142 ms + 307–324 ms = 449–464 ms |
| Store file, index in memory | 12.4 MB, about 15 MB |
dev, rows could be listed with none chosen, arrows left the field's text alone, and Escape closed the list and then left the field.packages/core, server, protocol, schema, plugin, plugin-browser, desktop: no change. In packages/app only tests changed.Flag.enabled; the only gate it has is ctx.app.channel.History (version 70, Edge and Helium) and places.sqlite schemas were checked on Windows from private copies. "No Keychain prompt" for history only rests on the cookie reader, the only code that asks for the key, not being called; a test proves that with a cookie database that cannot be read.address-machine.test.ts: a table of Chrome's cases (each input: rows, chosen row, field text, what Enter opens), played as the pane runs, with main's real search answering; late, stale and failed answers.electron-import-choice.test.ts: the three import paths and chosen sites through the real Ipc in the pinned Electron; history only runs against a cookie database that cannot be read.electron-history.test.ts: sign-out, import, search and Clear history through the real Ipcs with a store file that is a directory, then one that is not a database.history/store.test.ts, history/match.test.ts, profile/history.test.ts, profile/electron-import.test.ts: ranking, the 50,000 cap, clear leaves no bytes, each browser's reader, the read and the store in Electron's SQLite.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Read through the store, the profile readers and the address-field changes. The targeted tests (97) pass and tsc -b is clean. The Electron-backed tests fail here exactly as they do on dev, so I couldn't exercise the feature in a running desktop window or against real profiles.
Public API: unchanged. The new browser.history IPC, the optional history input / pages result on the profile import IPC, and the importHistory preference are all internal to the browser GUI plugin and backwards compatible.
One concern worth fixing before merge: Sign out everywhere now needs the history store to open before it clears cookies (inline).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| clear: () => | ||
| serial(async () => { | ||
| const current = await profile() | ||
| const store = await history() |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sign-out now waits for history() before current.clear(). If the store can't open (damaged/locked history.sqlite, a node:sqlite error), the whole job rejects and cookies are never cleared, so a privacy action regresses because of a new optional store. Could the cookie clear run first and the history clear be best-effort (logged, as importHistory already does), or the two run independently with both errors reported?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in c5f6b8f: "Sign out everywhere" now clears cookies, site data, the cache and HTTP sign-ins first and no longer waits on the history store, and the history is cleared on its own, by deleting the file when the store cannot open. If the history could not be cleared the row says so, and electron-history.test.ts drives both Ipcs with a store file that cannot be opened.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I read the code at pr/head, and c5f6b8f fixes this. I have no remaining concerns on this thread.
main.ts:302-321, clear runs current.clear() before anything touches the history store. Its failure is captured and not thrown right away. clearHistory() then runs either way, and a failure there is logged and returned as { history: false }. A failed sign-out is rethrown only after the history attempt, so neither failure hides the other.main.ts:119-138, clearHistory handles both a store that fails to open (history().catch(() => undefined)) and one that opens but whose clear() throws. Either way it closes the handle, deletes history.sqlite together with its -wal, -shm and -journal files, and points opened.store at a fresh, empty store. Callers that arrive in the meantime wait for that new store. In store.ts, the constructor now closes the database before rethrowing a schema failure, so the file isn't still held open when it's deleted.electron-history.test.ts covers the cases I'd want:
history: false;history: true;I couldn't run that test because Electron fails to start in my sandbox (libnspr4.so is missing), so the logic above is checked by reading only. I made no changes; the bun.lock modification in the checkout isn't mine and I left it alone.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…dress bar list Sign out everywhere clears cookies, site data, the cache and HTTP sign-ins first and never waits on the history store. The history is cleared on its own: a store that cannot open or clear is deleted and opened anew, and a history that stayed is said in the row's message. Clear history says when main could not clear it and stays available to try again. The address field's list and keys follow Chrome's omnibox: the first row is what Enter opens and is always chosen (the typed text as a search or an address, or the page whose address the typing completes, shown selected in the field); Down, Up and Tab move through the rows and put each row's text in the field; Escape undoes one step at a time; Shift+Delete forgets a page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The sign-out concern is fixed. Cookies are cleared first, whatever the history store does, and the history clear is separate and logged. A history failure comes back as history: false and no longer rejects the sign-out, and a damaged store is deleted and reopened empty. I read the new Chrome-style list in the address field and found nothing that blocks. The unit tests pass (126) and tsc -b is clean. The Electron-backed tests, including the new electron-history one, can't run here because Electron won't start in this sandbox, so I didn't exercise the feature in a running window.
Public API: unchanged. The clear call gaining a { history } result is internal to the browser plugin.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…in Settings The import dialog has two ticked boxes, "Sign-ins" and "Browsing history", and no sentence: an import is a one-off, so the choice is made there, per import. Both paths are real in main: without sign-ins no cookie is read or written and no cookie key is asked for; without history no page is read and the history store is not opened. "Choose sites" limits both. The Settings switch, its `importHistory` preference and its strings are gone. The result line says in words what came, the offer names the browser, and site rows show the site's name only. A passkey notice's import brings one site's sign-in and no history.
# Conflicts: # packages/app/test-browser/browser-pane-model.test.ts # packages/gui-plugins/src/browser/model.ts
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The sign-out fix from the last round is still in place: cookies are cleared first, whatever the history store does. The new import choice looks sound. With cookies: false no cookie is read and the key-store prompt is skipped, and with history off the store isn't opened. The result messages also cover the history-only and nothing-imported cases. The unit tests pass and tsc -b is clean. The Electron-backed tests, including the new import-choice and history-store ones, can't start in this sandbox, so I didn't exercise the dialog in a running app.
Public API: unchanged. The new optional cookies input on browser.profile.importBrowser is internal to the browser plugin.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.