docs: align ARCHITECTURE with 0.6/0.7 behavior

- Search: describe the lazy full-history paged search (snapshot + scroll
  paging, epoch/results-epoch guards) instead of the old "disables
  scroll-driven appends" behavior.
- Theming: light.css is loaded once with no theme-context 'changed'
  subscription (removed in 0.7.0 to stop the reload recursion); document the
  trade-off, not the old re-load-on-changed claim.
- Thumbnail size: ~256 px -> ~200 px to match THUMB_PX.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Eduard Tolosa 2026-05-26 19:24:34 -05:00
parent ffa1a407fe
commit 7a203c70a7

View file

@ -35,7 +35,7 @@ together and the trade-offs at each layer.
| | | SQLite (WAL, FTS5) | | | | | SQLite (WAL, FTS5) | |
| | +---------------------+ | | | +---------------------+ |
| v | | v |
| image::load_from_memory --> PNG thumbnail (~256 px) | | image::load_from_memory --> PNG thumbnail (~200 px) |
| | | |
+-------------------------------------------------------------------------------+ +-------------------------------------------------------------------------------+
``` ```
@ -129,7 +129,7 @@ CREATE TABLE clipboard_history (
mime_type TEXT NOT NULL, mime_type TEXT NOT NULL,
content_text TEXT, -- one of these two is populated content_text TEXT, -- one of these two is populated
content_blob BLOB, -- (text vs binary) content_blob BLOB, -- (text vs binary)
thumbnail_blob BLOB, -- pre-decoded PNG, ~256 px thumbnail_blob BLOB, -- pre-decoded PNG, ~200 px
content_hash TEXT NOT NULL, -- blake3 of raw bytes content_hash TEXT NOT NULL, -- blake3 of raw bytes
source_app TEXT, source_app TEXT,
created_at INTEGER NOT NULL created_at INTEGER NOT NULL
@ -239,9 +239,14 @@ page each time the scroll position comes within a fixed threshold (200 px)
of the bottom. The Rust side serves these from the `idx_created_at DESC` of the bottom. The Rust side serves these from the `idx_created_at DESC`
index with `LIMIT/OFFSET`, which stays O(log n) for any history size. index with `LIMIT/OFFSET`, which stays O(log n) for any history size.
Search shortcuts this path: when the search box is non-empty the panel Search uses a parallel path: when the search box is non-empty the panel
calls `SearchHistory(query, limit)` instead and disables scroll-driven calls `SearchHistory(query, max-history)`, which returns the full match set
appends, so an in-progress search and a scroll event cannot race. (bounded by the configured history size, not an arbitrary cap). The panel
snapshots those results and renders them lazily, a page at a time as you
scroll -- the same paging mechanism as the recent view, but fed from the
in-memory snapshot instead of re-querying. A search epoch plus a
results-epoch guard discard stale renders, so a fast new query (or a scroll
landing during a query's fetch) can never paint the previous query's rows.
### On-demand thumbnails ### On-demand thumbnails
@ -286,10 +291,14 @@ and `light.css` carries light overrides with every rule scoped under a
`.strata-theme-light` ancestor class. That scoping makes each light rule `.strata-theme-light` ancestor class. That scoping makes each light rule
strictly more specific than its dark counterpart, so it wins strictly more specific than its dark counterpart, so it wins
deterministically regardless of stylesheet load order. `extension.js` loads deterministically regardless of stylesheet load order. `extension.js` loads
`light.css` into the St theme context once at `enable()` (and re-loads it on `light.css` into the St theme context once at `enable()` and unloads it on
theme-context `changed`, since a Shell-theme swap drops dynamically loaded `disable()`; it does nothing until the panel adds the class. It deliberately
sheets); it does nothing until the panel adds the class. The panel resolves does NOT subscribe to the theme context's `changed` signal: `load_stylesheet`
the effective theme from the `theme` setting (`auto` consults itself emits `changed`, so reloading on it feeds back into itself and hits
"too much recursion" (it fired on screen unlock, which restyles widgets). The
trade-off of the one-time load is that a GNOME Shell theme switch drops the
sheet until the extension is re-enabled. The panel resolves the effective
theme from the `theme` setting (`auto` consults
`org.gnome.desktop.interface color-scheme`) and toggles the class on its `org.gnome.desktop.interface color-scheme`) and toggles the class on its
root box. Switching themes is one class toggle on an existing subtree, off root box. Switching themes is one class toggle on an existing subtree, off
the ingest/render hot paths. the ingest/render hot paths.