Skip to content

fix(local): answer the familiar reads that standalone mode cannot serve - #91

Merged
BunsDev merged 1 commit into
mainfrom
fix/local-adapter-familiar-reads
Sep 4, 2026
Merged

fix(local): answer the familiar reads that standalone mode cannot serve#91
BunsDev merged 1 commit into
mainfrom
fix/local-adapter-familiar-reads

Conversation

@BunsDev

@BunsDev BunsDev commented Sep 4, 2026

Copy link
Copy Markdown
Member

main does not typecheck. npx tsc --noEmit on b5c3756 reports 8 errors.

Cause

A semantic conflict, with no textual conflict for git to report:

#61's CI ran before #89 merged, so the two were never typechecked together. Both
were green on their own; main went red the moment #61 landed on top of #89.

Fix

Both reads answer service_unavailable.

A familiar's contract and its execution analytics are Cave's to report — what a
familiar has been granted, and what it has since done. A device holding only
local conversations has neither record. Returning an empty contract instead
would render as "this familiar is permitted nothing", which is a different claim
from "nobody asked Cave", and the shell prints the code to the user verbatim.

service_unavailable is already this file's code for a read it cannot complete
(toErrorResult, for anything that is not a ChatStoreError).

Tests

The suite already had an exhaustive sweep asserting the local adapter never
emits loading, stale, or reconcile_required, but it enumerated the members
by hand and so silently stopped covering the interface when it grew. Both new
members are added to it, so the next addition is caught by a failing test rather
than by main going red. A focused test pins the two codes.

  • tsc --noEmit — 0 errors
  • local-chat.test.ts — 28 passed (was 27)
  • lint clean

Not labelled ci:full: the break is TypeScript-only and Web checks covers it
ungated, so there is no reason to spend the macOS and Windows runners here.
main runs the full set after merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KacEJmkX5GhkViPUhx9Mie

main does not typecheck. #89 added familiarContract and familiarAnalytics to
QueryAdapter; #61 added createLocalQueryAdapter implementing that interface.
Neither conflicted textually and each passed CI alone, because #61's run
predated #89's merge, so the two were never typechecked together.

Both reads answer service_unavailable. A familiar's contract and its execution
analytics are Cave's to report -- what a familiar has been granted, and what it
has since done -- and a device holding only local conversations has neither
record. Returning an empty contract instead would read as "this familiar is
permitted nothing", which is a different claim from "nobody asked Cave".

Extends the existing status sweep to both members, so a future addition to the
interface is caught by a test rather than by main going red, and adds a focused
test for the codes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KacEJmkX5GhkViPUhx9Mie
Copilot AI lite review requested due to automatic review settings September 4, 2026 09:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes correctly implement the newly required interface members and add targeted tests to prevent regressions while preserving the local adapter’s established status semantics.

Pull request overview

This PR fixes a TypeScript interface mismatch between the standalone/local QueryAdapter implementation and the expanded QueryAdapter surface (added in #89) by implementing the new familiar reads in the local adapter with a consistent service_unavailable response.

Changes:

  • Add familiarContract and familiarAnalytics to the local query adapter, returning { status: 'error', code: 'service_unavailable' } in standalone mode.
  • Extend the local adapter surface test suite to cover the new methods and ensure they never emit nonterminal statuses.
File summaries
File Description
src/lib/local/local-query-adapter.ts Implements the new familiar reads for standalone/local mode by returning service_unavailable.
src/lib/local/local-chat.test.ts Adds focused assertions for the new reads and includes them in the “never emits loading/stale/reconcile_required” sweep.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@BunsDev
BunsDev merged commit ab7dc73 into main Sep 4, 2026
14 of 19 checks passed
@BunsDev
BunsDev deleted the fix/local-adapter-familiar-reads branch September 4, 2026 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants