PR #677 was written against the pre-0.24.1 loadDir shape (one fs.tree per
directory): its error branch stored { error } in the level cache and the
cache-hit guard `dataRef.current[dir] !== undefined` treated that failure as
"already loaded", so the automatic load path never re-requested a failed
level; only the force path (refresh tick / fence-notice retry) recovered.
FileTree.tsx has since been rewritten around batched loadLevels (one fs.trees
POST for the visible set, commit 98a446b), but the bug survived the rewrite in
a new spot: BOTH failure branches now store an error in the same cache —
(a) a per-level `error` riding an otherwise-successful batch, and
(b) `{ error }` written by the whole-request catch for levels with no listing
— and the non-force `wanted` filter (`dataRef.current[path] === undefined`)
counted both as cache hits.
Port, in current idioms:
- The non-force filter now admits a cached entry only when it carries no
`error`: `cached === undefined || cached.error !== undefined`. The host
guarantees a failed level never carries entries (fs.trees returns
`{ entries: [], error }` in place), so `error` alone identifies "nothing
usable cached" for both failure branches.
- The empty `{}` placeholder of an in-flight load is still a hit, so a
re-render while a batch is open does not duplicate the request.
- The retry rides the batch route (wanted subset only; levels that DID list
stay cached) and reuses the existing non-force flow, which stores `{}`
first — same behavior the original fix gave loadDir.
- loadLevels' doc comment gains the "only a LISTING settles a level" rule.
Not ported: the original diff's comment wording about "the fence notice's
retry button" — that notice (and isOutsideWorkspaceMessage usage in the tree)
no longer exists in the current shape; recovery paths today are the refresh
tick and watch-notice/mutation re-lists, and after this fix any automatic
re-load of the expanded set.
Tests: tests/file-tree-level-retry.spec.tsx adapts the PR's spec to the
batched shape (fsTrees mock, batch-load-spec harness): (1) a per-level error
is re-requested as a batch of 1 on the next automatic load (with an added
assertion that an in-flight batch is NOT duplicated), (2) levels stored by a
failed whole request are all retryable. Both go red on the unfixed filter
(verified: "expected to be called 2 times, but got 1"). All 9 file-tree
suites (47 tests) and tsc --noEmit stay green.
The lane's `onScreenSession` walked every `[data-sidebar-right-session]` element
and took the first without a `hidden` attribute. On 0.2.x the host marks BOTH
each RETAINED seat (one per Conversation stays in the DOM) AND each seat's panel
with that attribute, so the walk could name a background Conversation and the
A → B → A round trip failed on `selectConversation` (real mount lane: expected
`session-eeb1…`, read `session-b8e4…`, 60s timeout).
Read the panel that is actually laid out (`[data-sidebar-right-panel]:visible`) —
the same `:visible` convention the rest of this lane already uses — and keep a
visible-seat fallback. Mount lane: 10/10 (was 9/10).
Two conflicts, both in the native tab adapter's per-session work — main's
`5c95002` moved the expansion set into the plugin store's session state while
this branch moved the RECORD identity to `sessionId::tabId`:
- `src/client/native/tab-adapter.tsx`: keep main's store-backed expansion as
the authority (`attachStore` / `syncExpanded` / `getSessionStates().expanded`)
and this branch's seat-scoped identity (`views` keyed `sessionId::tabId`,
`get/has/update/drop/versionOf/retain` take the seat session). `toggleExpanded`
keeps main's active-`reduce` / background-`reduceFor` split, but locates the
record by its seat and writes the SCOPE session's set — the set every view of
that session mirrors.
- `tests/native-surface.spec.ts`: main's five expansion cases adapted to the
session-scoped API (seat session on `ensure`, two-arg `get`/`drop`, seat on
`toggleExpanded`); the branch's cases now bind a store before toggling, since
expansion no longer lives in the record itself.
The `files` takeover guard and its registration invariants come from
main; this merge drops the branch's duplicate.
Resolve client preview paths against the session cwd. Limit the server file fallback to relative input and retain upstream absolute HTML path semantics. Cover nested assets, Windows/UNC paths, and external files with workspace shadows.