Files
puter/extensions
Daniel Salazar 6478f18feb perf: whoami row reuse, thumbnail URL cache, KV refusals, dashboard KV boot batch, profile revalidation (#4687)
* perf(whoami): answer from the user row token auth already loaded

Token auth builds the actor from the user's row with the password hash left
out. It now records `hasPassword` in its place, so /whoami builds the details
(`oidc_only`, `is_temp`) from the actor and skips reading the same row again
by id. An actor built any other way still reads the row.

* perf(thumbnails): reuse a read URL signed this hour

A thumbnail's read URL is the same for the whole signing hour, so listings
re-signed it for nothing. Signed URLs are kept per signing client, keyed by the
signing key, bucket, object key and hour (5,000 entries, one hour). A new
signing key signs afresh.

* perf(kv): a refused conditional write ends at the refusal when it can

`set` with `onlyIfAbsent` on a live key, and a write or delete into a
foreign namespace refused by a private entry, made four store calls: the
refused write, a refused expired-row delete, a consistent read and a second
refused write. The conditional write now asks for the refusing item. When its
`ttl` is absent, null or a number, the condition already judged it the way
reads do and the refusal stands after one call. A text or boolean `ttl`, or a
refusal without the item, still settles and retries as before.

* perf(gui): the dashboard reads its saved settings in the boot batch

The GUI's boot KV batch fetched the desktop's keys on every boot, while the
dashboard read its seven (Files view and sort, Apps order, groups and
uninstalled list) one request each. The batch now carries the keys of the
interface that booted. The uninstalled-apps read-modify-write skips the batch,
which may predate another window's write.

* perf(profile): answer a revalidated GET /profile without reading it

A profile write records a hash of the stored JSON in the file's metadata.
GET /profile sends it as the ETag with `Cache-Control: private, no-cache`
and answers a matching If-None-Match with 304 before reading the stored
profile. Visibility is checked first, so a hidden profile still 404s. A
profile stored before this has no tag until its next write.

* fix(thumbnails): a listing's concurrent signings share one URL cache

The per-client cache was registered after the first signing returned, so a
cold client's first listing kept only one of the URLs it signed.

* fix(kv): recheck a refusing row's expiry and its private flag

A numeric `ttl` that passes while the refusal is on its way now settles and
retries, as before, instead of answering false. A share holder's refused
`onlyIfAbsent` takes the private flag from the refusing item rather than an
eventually consistent read after it. DDBClient tests cover the request and
the undecoded item on the wire.

* fix(gui): Apps refreshes read the saved layout from the store

Only the open's first load takes it from the boot batch. A refresh exists to
pick up another tab's changes, which a batch fetched a few seconds earlier can
predate.

* fix(profile): tag a profile response by the bytes it carries

The file is written before its entry and the entry can be read from a cache
that is behind, so a 200 now carries the tag of what was read. Tags are weak
(the compressed and plain bodies share one) and the early 304 sends
`Vary: Accept-Encoding` like the 200. A profile stored without a tag still
answers 304 to its content tag, after reading the file.

* fix(kv): the GUI boot batch only answers for the token it was fetched with

A sign-in from another tab swaps the token while the batch is still live, so
reads under the new account fall through to the store.
2026-11-18 14:30:29 -07:00
..