Repository navigation
Local verification stack, provider seams (embeddings/LLM/storage), and 3 bug fixes - #1
Merged
Merged
Conversation
… compare - .claude/skills/verify-root: up/doctor/down/db/compare scripts, Playwright harness (scenarios for library add-source and quote -> embed -> ask), and a feature map. Runs fully in the container: paradedb Postgres (same image as CI), moto for R2, and a stdlib fake for Voyage + Gemini. Services start with an explicit env so Doppler/Neon/Logfire values never leak in. - create-verification-skill / maintain-verification-skill: generic generator and upkeep skills, adapted to .claude/skills. - fast-api: optional EMBEDDING_BASE_URL so Voyage can point at a local fake (wired into both compose files). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016wtkrky4phkWzyb6s99yN2
Embedder seam (first of the provider refactors): - app/providers/embedder.py: Embedder Protocol (embed_documents, embed_query, rerank), deterministic FakeEmbedder, create_embedder() picking EMBEDDING_PROVIDER=voyage|fake. VoyageEmbedder in app/integrations/voyage.py owns model + rerank model; services no longer touch the Voyage SDK. - Services, deps and agents depend on Embedder; tests default to the fake (no Voyage key needed for unit tests). Bug fix: new citations/captures/takeaways/sections were never embedded. FastAPI runs BackgroundTasks before tearing down request-scoped deps, so get_db committed after the embedding task had already looked for the row and silently skipped. Routes that take BackgroundTasks now use Depends(get_db, scope="function") (as captures already did), enforced by tests/test_background_task_db_scope.py; a skipped row now logs a warning. Existing unembedded rows are picked up by the admin per-user refresh. verify-root: wait for the postgres image's post-init restart before migrating; feature map updated (quote-embed-ask now passes). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016wtkrky4phkWzyb6s99yN2
LLM seam (second provider refactor): - app/providers/llm.py: create_llm_client(ModelConfig) resolves through an LLMProvider chosen by LLM_PROVIDER=live|fake. Jetflow's AsyncBaseClient is the (already vendor-neutral) client interface. - Live: JetflowLLMProvider (app/integrations/llm.py) builds vendor clients and owns API-key checks, so services no longer gate on vendor keys (VoiceSuggestionMatcher lost its key arg and OpenAI isinstance assert; rag_service no longer checks google_api_key). - Fake: FakeLLMClient speaks Jetflow's protocol (complete/stream/extract): scripted responders keyed by action/schema name, auto-calls the RAG search tool once, then answers "[fake-llm] ...". Missing responder fails loudly. - Tests default to LLM_PROVIDER=fake; new tests drive real Jetflow agents. Bug fix found by the fake: follow-up chips in Reflect were always empty. generate_followups read response.parsed, which Jetflow leaves unset after an exit action (the run ends on the tool message); it now parses response.content like transcript sectioning. The old unit test mocked a response shape Jetflow never produces. verify-root: in-process fake LLM by default (VERIFY_LLM=http keeps the Gemini SDK-over-HTTP path; its fake now answers forced function calls), new reflect-followups scenario, provider calls copied into each run's evidence, up.sh refuses to reuse an instance started in another LLM mode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016wtkrky4phkWzyb6s99yN2
…esigned URLs - app/providers/object_store.py: ObjectStore Protocol, InMemoryObjectStore, create_object_store() (OBJECT_STORE_PROVIDER=r2|memory), provider-level ObjectStoreError/ObjectNotFoundError, read_json() for async callers. - R2Client implements it and gains get_bytes/get_json (boto errors mapped). - The five places the backend read its own transcripts by presigning a URL and GETting it with httpx (chunk hydrator, suggestion service, transcript embed, transcript pipeline, embedding backfill) now call read_json. Presigned URLs remain only for browsers and AssemblyAI. - Services/deps/routes type against ObjectStore; R2 credentials are required only when the provider is r2. Tests default to the in-memory store. verify-root: pdf-upload scenario (object in the S3 stand-in, key on the row, presigned URL serves the bytes). It surfaced a pre-existing viewer bug (page_count is never stored, so the viewer says "No PDF uploaded"), documented in features/pdf.md and not fixed here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016wtkrky4phkWzyb6s99yN2
The viewer treats a source as having a PDF only when metadata.page_count is set, but upload_pdf stripped page_count and nothing ever wrote it, so every upload showed "No PDF uploaded". - Backend counts pages with pypdf on upload, stores page_count (also used by citation page-bounds validation), and rejects unreadable or >500-page files with 400 (the limit was only enforced client-side). - Viewer: hasPdf also accepts size_bytes, so PDFs uploaded before this fix open without a backfill. - Viewer: pass the bundled pdf.js worker to PdfLoader, which otherwise fetched its worker from unpkg.com at runtime. Tests: page counting unit tests, API upload regression + unreadable-file rejection. verify-root pdf-upload now asserts the viewer renders (fresh and legacy rows); compare.sh shows the previous commit failing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016wtkrky4phkWzyb6s99yN2
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
Makes the app runnable and provable without Doppler, Neon, R2 or AI keys (cloud sessions included). It also puts the three external providers behind interfaces with offline fakes. Driving the real app against those fakes surfaced three user-facing bugs, all fixed here:
BackgroundTasksbeforeget_dbcommits, so the embedding task couldn't see the row and skipped silently7dcd322generate_followupsreadresponse.parsed, which Jetflow leaves unset after an exit action2e20e1dmetadata.page_count; the backend stripped it and nothing set it74a6619How to review
Go commit by commit. Each commit is self-contained, passes tests on its own, and has a detailed message. Size by area:
fast-api/appfast-api/testsfrontend.claude/(verification tooling)Most of the
fast-api/appline count is mechanical renames. The parts that need judgment are called out below.1.
8f57ce6Verification skill (tooling only, safe to skim).claude/skills/verify-root/: bash scripts (up/doctor/down/compare), a Playwright harness, a feature map, and a stdlib HTTP fake for Voyage and Gemini.create-verification-skillandmaintain-verification-skillskills.EMBEDDING_BASE_URL(config.py,clients.py, both compose files).2.⚠️ review the fix
7dcd322Embedder seam + background-task commit fixapp/api/*.py: every route that takesBackgroundTasksnow usesDepends(get_db, scope="function"). This is the existing pattern fromcaptures.py, applied everywhere.tests/test_background_task_db_scope.py: enforces that rule.app/providers/embedder.py: the newEmbedderprotocol andFakeEmbedder.app/integrations/voyage.py:VoyageEmbedder.VoyageClient→Embedderandvoyage_client→embedderrenames across services, deps and agents. Call sites move from.embed(texts=..., input_type=...)toembed_documents/embed_query/rerank.3.⚠️ review the fix
2e20e1dLLM seam + follow-ups fixapp/providers/llm.py:create_llm_client()now resolves throughLLM_PROVIDER=live|fake.FakeLLMClientimplements Jetflow'sAsyncBaseClient.app/services/agent/followup_agent.py: now parsesresponse.content, the same waytranscript_sectioning_servicealready does.tests/test_fake_llm.py: drives the real Jetflow agent, which is how the bug showed up. The old unit test mocked a response shape Jetflow never produces.app/integrations/llm.py(JetflowLLMProvider) now owns API-key checks. A missing key raises when the client is created instead of when it is first called.VoiceSuggestionMatcher()no longer takes a key, andrag_serviceno longer gates follow-ups ongoogle_api_key.4.
6b3d9aaObjectStore seamLook closely at: five call sites that read the backend's own transcripts by presigning a URL and GETting it with
httpxnow callread_json(store, key):Error types move from
httpx.HTTPError/FileNotFoundErrortoObjectStoreError/ObjectNotFoundError. Presigned URLs remain only for browsers and AssemblyAI.Also new:
R2Clientgainsget_bytes/get_json, and R2 credentials are only required whenOBJECT_STORE_PROVIDER=r2.Mechanical, skim:
R2Client→ObjectStoretype hints, andget_r2→get_object_store.5.⚠️ review the fix
74a6619PDF viewer fixpypdf(new dependency), storespage_count, and returns 400 for unreadable PDFs or PDFs over 500 pages (previously that limit was enforced client-side only).source-pdf-slideover/index.tsx):hasPdfalso acceptssize_bytes, so PDFs uploaded before this fix open without a backfill.PdfLoadergets the bundled pdf.js worker. Before, it fetched its worker from unpkg.com at runtime.Deploy notes
EMBEDDING_PROVIDER=voyage,LLM_PROVIDER=live,OBJECT_STORE_PROVIDER=r2,EMBEDDING_BASE_URLempty. They're added to both compose files.pypdf, pinned inuv.lock. The image rebuild picks it up.generate:api.Testing
fast-api: 154 unit tests and 71 integration tests pass, the integration tests against the CI Postgres image (
paradedb/paradedb:0.20.5). mypy and ruff are clean on changed files.frontend:
tscpasses. The PDF slideover file already had 3 ESLint errors onmainand has the same 3 here.End to end, all 5 browser scenarios pass on a fresh local stack via
.claude/skills/verify-root:library-add-sourcequote-embed-askreflect-followups, in both LLM modespdf-uploadBefore/after proof:
compare.sh <base> <scenario>runs a scenario against the previous commit and the fix side by side:quote-embed-askreflect-followupspdf-uploadpage_countnever stored)To reproduce locally, run
.claude/skills/verify-root/scripts/compare.sh HEAD~1 pdf-upload.Not in this PR
🤖 Generated with Claude Code
https://claude.ai/code/session_016wtkrky4phkWzyb6s99yN2