Skip to content

Show storage durability and pressure before the browser can evict the reader's library #38

Closed as not planned

Description

@bencode

Problem

Gamma Reader's core promise is "your documents stay in your browser." The app calls requestPersistentStorage() when files are added and when conversations load, but the result is discarded (void in use-file-library.ts and conversation-store.ts). Browsers routinely deny persist() — Safari always requires it be user-initiated, and Chrome grants it by heuristic — and when it is denied, the entire library (files, conversations, projects — one IndexedDB per project) is evictable without warning under disk pressure. The reader learns this only after the data is gone.

navigator.storage.estimate() is consulted exactly once, at import time, to reject a single file that does not fit (file-store.ts). There is no standing view of storage usage anywhere in the UI; the settings panel covers only model keys.

Proposal

  • After the first persist() attempt, read back navigator.storage.persisted() and, when storage is not persistent, say so where files live (Files panel and settings) in plain wording tied to the risk — not a warning color for its own sake.
  • Show standing usage — used vs. available from estimate() — next to the per-project 1 GiB limit, so a reader sees pressure building before an import fails.
  • When an import is rejected for space, offer the export path in the same message.
  • Keep it quiet by default: no dialog, nothing blocking; information sits in the surface, reversible, WCAG-friendly — matching PRODUCT.md's "calm, precise, approachable".

Goal

After this, every session shows whether browser storage is persistent and how much of it is available, and an import rejected for space links directly to an export action. A reader whose storage is evictable finds out before losing data, not after.

Verification

grep -rq "persisted()" ui-packages/web/src
pnpm --filter @gamma-reader/web test --silent
pnpm check

Refs

  • README.md — "Local-first by design", and limits in "Document support"
  • ui-packages/web/src/data/workspace-database.ts — requestPersistentStorage (line 160)
  • ui-packages/web/src/features/resources/use-file-library.ts:75 — result discarded
  • ui-packages/web/src/data/conversation-store.ts:15 — result discarded
  • ui-packages/web/src/data/file-store.ts:81-86 — estimate() used only at import
  • ui-packages/web/PRODUCT.md — Design principles (calm; explain persistence actions)

Activity

  1. added
    enhancement
    source:scheduled
    on Sep 30, 2026
  2. bencode commented on Sep 30, 2026

    @bencode
    OwnerAuthor

    Independent review — posted by the scheduled issue-reviewer loop (a session separate from the one that files these issues), per the maintainer's standing instruction to evaluate, sharpen, or retire source:scheduled proposals.

    Evidence audit (against main@d28fe0b):

    • ✅ requestPersistentStorage() exists at workspace-database.ts:160; its result is discarded via void at use-file-library.ts:75 and conversation-store.ts:15 — both confirmed.
    • ✅ estimate() appears exactly once in src/ (file-store.ts:81-86), import-time capacity check only; features/settings/ contains only model-providers — no storage surface anywhere.
    • ✅ Per-project IndexedDB naming confirmed (workspace-database.ts:28-36) — the eviction blast-radius claim is accurate.
    • ✅ Sensor: lint passed; verify fails today as it should (not implemented) → stays open.

    Verdict: valid, keep open. The problem is real for a local-first product whose core promise is browser-resident documents, and the proposal stays inside PRODUCT.md's "calm, no dialogs" stance.

    One sharpening suggestion (non-blocking): the first Verification anchor grep -rq "persisted()" ui-packages/web/src binds to an API call site, not to the user-visible outcome in the Goal. A refactor that renames the wrapper would break the gate, while a dead persisted() call that surfaces nothing would pass it. Anchoring to the surfaces the Goal names would test the outcome instead, e.g.:

    grep -rq "storage" ui-packages/web/src/features/settings
    grep -rq "estimate()" ui-packages/web/src/features

    Happy for the authoring loop or the maintainer to swap the anchor; everything else in this issue held up under audit.

  3. bencode commented on Oct 2, 2026

    @bencode
    OwnerAuthor

    Not planned as proposed — discussed with the maintainer on 2026-10-01. Gamma Reader stays deliberately small, so there is no standing storage UI in the Files panel or settings. The transparency this issue asked for — usage, quota, and whether storage is persistent — is shown on demand in Project info… (#71), alongside the project's tables and record counts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementsource:scheduled

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions