Add frontend client for musing-ai-service - #94
Merged
Conversation
PR guideAuto-generated from changed paths. Fill in Summary and How to verify in the PR description above. Touches: app shell / routes, tests, CI / GitHub, other Diff: 15 files changed, 908 insertions(+) Suggested verify
Checklist (applies to this PR)
Reviewer focus
Commits
Files by area
CIPrimary check: CI runs lint, Prettier format check, Vitest coverage, and build for every PR. Coverage tables are posted separately. Template: |
|
Unit tests (Vitest)
Minimum allowed coverage is Generated by 🐒 cobertura-action against c91963b |
3 tasks
- src/lib/aiClient.ts: isAiServiceConfigured() (mirrors
isSupabaseConfigured()'s pattern, plus requires Supabase configured
since every endpoint needs a session JWT), an AiServiceError class,
and typed wrappers for all five backend endpoints. Cross-origin per
the earlier architecture correction (no same-origin proxy).
- src/lib/blockPlainText.ts: strips HTML from block content before
sending anything to the AI service or Anthropic/Voyage — mirrors
blockEditorCommands.ts's isBlockHtmlVisuallyEmpty() DOM approach.
- src/hooks/usePageIndexing.ts: debounces embed-page ~2s after a
page's blocks stop changing (document pages only), mirroring
WorkspaceContext's 800ms remote-save debounce but longer, since this
costs money. Failures are logged, never surfaced — a background
enhancement must never disrupt writing.
- UI wiring, per the earlier placement decisions:
- PageChrome.tsx: a "Summarize" button as a sibling to Export (not
a third item inside it — Export's whole interaction model is
"click, download, no persistent UI"; Summarize needs to show
text, so it gets its own busy-state + dismissible result panel).
- RelatedPagesSection.tsx: collapsed-by-default <details> under the
page header, only for document pages when configured.
- SidebarSearch.tsx: debounced (300ms) search input above the page
tree, results deduped to one entry per page (highest-similarity
block), each with a snippet.
- AppLayout.tsx: a compact AiUsageBadge pill next to the existing
RemoteSyncBadge, showing the higher of the two providers'
token-usage percentage with a full breakdown in the tooltip.
- VITE_AI_SERVICE_URL: added to .env.example, vite-env.d.ts, and
deploy-pages.yml's build env (mirrors the VITE_SUPABASE_* pattern
exactly). Set directly in .env.local for local dev against the live
Cloud Run service.
Fixed via /code-review (6 parallel finders): the three new components
referenced CSS classes that were never defined anywhere (confirmed by
grep) — the search dropdown would have rendered as broken inline
content instead of an overlay. Added the missing App.css rules for
sidebar-search-*, related-pages-*, and ai-usage-badge. Also fixed
RelatedPagesSection swallowing fetch errors into the same empty state
as "no related pages" — now shows a real error, matching how
PageChrome already surfaces the same class of failure for
summarize/export.
Documented, not fixed: usePageIndexing's debounce can reset without a
real edit when WorkspaceContext replaces the whole snapshot (cross-tab
sync, or the initial remote-fetch race) — delays indexing, never
skips or corrupts it, so not worth the complexity of keying off a
content hash instead of array identity for a delay-only edge case.
Coverage thresholds hold without new component-level tests (existing
convention: PageChrome/PageView/Sidebar/AppLayout have none; only
lib/hook logic is unit-tested here) — aiClient.ts and
usePageIndexing.ts, the actual new logic, are covered at 82%/93%.
Cannot verify in a browser: no browser automation tool is available
in this environment. Verified instead: typecheck, lint, full test
suite (161 passing), production build, and that every referenced CSS
class now resolves. A real manual click-through is still needed.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
danibsheehan
force-pushed
the
feat/ai-notes-frontend-client
branch
from
August 30, 2026 22:07
7281470 to
c91963b
Compare
This was referenced Aug 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wires musing's frontend up to the now-live `musing-ai-service` backend: search, summarize, related pages, background indexing, and a usage indicator.
Found and fixed via `/code-review` (6 parallel finders): the three new components referenced CSS classes that were never defined anywhere in the repo (confirmed by grep) — the search dropdown would have rendered as broken inline content instead of an overlay. Added the missing `App.css` rules. Also fixed `RelatedPagesSection` swallowing fetch errors into the same empty state as "no related pages" — now shows a real error, matching how `PageChrome` already handles the same failure class for summarize/export.
Documented, not fixed: `usePageIndexing`'s debounce can reset without a real edit when `WorkspaceContext` replaces the whole snapshot (cross-tab sync, or the initial remote-fetch race) — delays indexing, never skips or corrupts it; not worth the complexity of a content-hash key for a delay-only edge case.
Coverage: thresholds hold without new component-level tests, consistent with this codebase's existing convention (`PageChrome`/`PageView`/`Sidebar`/`AppLayout` have none; only lib/hook logic is unit-tested here). `aiClient.ts` (82%) and `usePageIndexing.ts` (93%) — the actual new logic — are well covered.
Cannot verify in a browser — no browser automation tool is available in this environment. Verified instead: typecheck, lint, full test suite, production build, and that every referenced CSS class now resolves (grep-checked). A real manual click-through is still needed before merging.
Test plan
🤖 Generated with Claude Code