Skip to content

feat(ask-ai): generic Ask AI frontend client + store - #428

Draft
haileyok wants to merge 1 commit into
hailey/ask-ai-3-ssefrom
hailey/ask-ai-4-frontend
Draft

feat(ask-ai): generic Ask AI frontend client + store#428
haileyok wants to merge 1 commit into
hailey/ask-ai-3-ssefrom
hailey/ask-ai-4-frontend

Conversation

@haileyok

Copy link
Copy Markdown
Member

Description

Part 4/5 of the Ask AI stack (stacked on hailey/ask-ai-3-sse; shares only the JSON wire contract with the backend). Adds osprey_ui/src/components/ask_ai: typed wire+domain contracts, a chunk-safe POST-SSE client (fetch + ReadableStream reader + TextDecoder) that tolerates split frames, stops at the terminal, rejects unknown event types, maps pre-flight HTTP errors to a safe error, and always cancels the reader; plus a Zustand store (createAskStore) with a monotonic stale-request guard, abort handling, retry/new-chat/reset, and safe error mapping. Implements AC5.1, AC5.3, and the state parts of AC5.4.

Checklist

  • Tests pass locally (pnpm typecheck + eslint + rstest)
  • uv run ruff check . passes (n/a to UI, backend unchanged)
  • uv tool run fawltydeps --check-unused --pyenv .venv passes
  • Updated CHANGELOG.md (deferred — happy to add)

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a5c0f42e-a864-4389-93b1-c46661d18ee8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hailey/ask-ai-4-frontend

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Add osprey_ui/src/components/ask_ai: typed wire+domain contracts, a chunk-safe POST-SSE
client (fetch + ReadableStream reader + TextDecoder) that tolerates split frames, stops
at the terminal, rejects unknown event types, maps pre-flight HTTP errors to a safe
AskStreamError, and always cancels the reader; plus createAskStore (Zustand v3, injectable
stream) with a monotonic requestId stale-guard, AbortController cancellation, retry/
new-chat/reset, and safe error mapping that never leaks a raw stack.

Tests (16 passing: pnpm typecheck + eslint + rstest) cover frame splitting/no-loss,
malformed/unknown-type rejection, missing-terminal, reader cancellation, happy-path apply,
stale-response guard, abort, error mapping, retry de-dup, and new-chat.

Implements osprey-ask-ai AC5.1, AC5.3, and the state parts of AC5.4.
@haileyok
haileyok force-pushed the hailey/ask-ai-4-frontend branch from cad34a7 to ea6844e Compare July 14, 2026 22:13
@haileyok
haileyok force-pushed the hailey/ask-ai-3-sse branch from f198727 to 1773779 Compare July 14, 2026 22:13
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.

1 participant