Skip to content

Familiars reads shell shows "Loading…" for a disconnected client, once a Cave-backed source drives it #90

Description

@BunsDev

not_ready carries two different meanings, and FamiliarsReadsShell renders
both as "Loading…". Today only the harmless one is reachable; the misleading one
becomes reachable when CaveFamiliarsSource lands.

The two meanings

The shell's own pre-fetch initial state. All five results start at the
NOT_READY constant (src/familiars/reads-shell.tsx:41, used at lines 122–131)
before any read is issued. "Loading…" is accurate here.

The adapter's "no usable client". createQueryAdapter returns not_ready
when it is disposed or getClient() yields nothing
(src/lib/sdk/query-adapter.ts:87 and :217). Here the app is disconnected or
torn down and no request is in flight, so "Loading…" tells the user something is
happening when nothing is.

statusMessage maps both to the same string
(src/familiars/reads-shell.tsx:43-47, where not_ready falls through to
loading).

Why it is latent rather than broken

The shell is currently only ever driven by MockFamiliarsSource, which never
returns not_ready (zero occurrences in src/familiars/mock-source.ts). So the
only reachable case today is the initial one, where the copy is correct.

It becomes reachable when CaveFamiliarsSource drives the shell through
QueryAdapter — the deferred half of the Stage 1 work, currently on #86, which
is blocked on the SDK release cut and its contract-canary re-pin.

Suggested fix

Distinguish the two at the point where they differ, rather than by string:

  • give the shell its own initial sentinel (an idle status, or a hasLoaded
    flag) so the pre-fetch state is not spelled not_ready; or
  • give the adapter's not_ready its own message, something nearer
    "Not connected to Cave." than "Loading…".

The first is probably cleaner, since the shell's initial state is genuinely a
different thing from the adapter's, and conflating them is what produced the
ambiguity.

Notes

Raised by Copilot on #89 (thread on src/familiars/reads-shell.tsx) and
deliberately not fixed there: with no way to reach the state, the change would
have been untestable and speculative. Filed here rather than tracked on #86
because #89 absorbed reads-shell.tsx into main, so #86 no longer touches the
file and would merge without ever visiting it.

Best fixed alongside, or immediately after, the change that makes
CaveFamiliarsSource drive the shell, when the state can actually be exercised
in a test.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KacEJmkX5GhkViPUhx9Mie

Activity

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions