Repository navigation
perf(inbox): Settings → Storage counts its sizes on its own, only when shown - #2546
Merged
Merged
Conversation
… shown GET /api/inbox/settings no longer walks every file in the store; the new GET /api/inbox/settings/storage does, and only the Storage panel asks for it, each time it opens. While the first count runs, the panel shows the calm wait the owner chose: the card holds its place, the total is a soft grey bar, "Counting what is stored…" after 0.4 s, the numbers fade in. Co-Authored-By: Claude <noreply@anthropic.com>
…alled storage read times out, Try again shows the wait - P1-1: the window asks GET /api/inbox/settings?store=0; a read without the marker (a page older than the storage route) still gets store, so it no longer blanks the window after an update. - P2-1: the folder line falls back to an older Inbox's settings.store.dir. - P3-1: the storage read gives up after 20 s (getWithin). - P3-2: a read starting clears the error; no aria-busy around the alert. - P3-3: the slow words reset on leaving Storage, not on the next open. - P3-4: the DOM test times the words with an observer from before the click. - P3-5: the failure state and the marker in the docs. Co-Authored-By: Claude <noreply@anthropic.com>
# Conflicts: # packages/server/inbox.test.ts
…s ?store=0 #2546 makes the window read GET /api/inbox/settings?store=0. Four DOM tests compared the fetched URL to the bare '/api/inbox/settings', so: - palettePicker: the gate that holds the first settings read never held, so config.json's palettes landed before the test's first check (CI dom-1). - rowMenu: renderApp waited for a fetch of exactly '/api/inbox/settings' and timed out; the stuck act() then failed every later test in the file (dom-2). - themeToggle and accountsSection: their settings gates silently stopped holding, so "a click before the first settings read" and "the foot stays hidden until settings answer" / "settings that fail" no longer tested that. Compare the path before '?', which still never matches /settings/storage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Every time the Inbox window read its settings (on load, on opening Settings, after most saves, and in every window after some changes), the server also counted every file in the Inbox to fill one panel: Settings → Storage. That count reads every message file on disk, on the server's only thread, so everything else waited behind it.
Now the settings read leaves the count out. Settings → Storage asks for it on its own, each time it opens, through a new route:
GET /api/inbox/settings/storage.What you see
Only Settings → Storage looks different, and only while the count runs. This is the loading state the owner chose ("A · The calm wait"):
Delete thread and Delete project still update the numbers: their answer already carries the new count, and the window now uses it (one count per delete instead of two).
Numbers (L data set, server only, median of 7)
Notes
/api/inbox/settings*route.store_dir, so the Storage line can show the folder before the count arrives.docs/agent-guides/server-and-storage.mdand the Storage line indocs/agent-guides/inbox-window.mdare updated.storein its settings read, so it keeps working until it reloads; the new page asks with?store=0and never pays for the count there.Tests
packages/server/inbox.test.ts: the settings read does not count the files (nodiskUsage()call, nostore), and the new route returns the same numbers the store counts (the exact bytes on disk). It fails on main: the settings read counts once.packages/inbox/settingsSections.test.tsx(DOM): Settings does not ask for the count; Storage asks when it opens; before 0.4 s there is a bar and no "Counting…", after 0.4 s "Counting what is stored…" shows; then the numbers match the server's; a second visit shows them at once. It fails on main: Storage never asks.packages/server/inbox-project-combine.test.tsreads the per-folder sizes from the new route.