Uh oh!
There was an error while loading. Please reload this page.
test(e2e): journey — upload → SSE → document appears (#387) - #432
Conversation
Warning Review limit reached
Next review available in:3 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Deploying with |
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs | frontend-staging | 79f9662 | Commit Preview URL Branch Preview URL | Jul 28 2026, 04:05 AM |
4e06ab4 to
592eabdCompareBrowser journey driving the real streaming upload pipeline end to end: fixture PDF in through the upload modal, ride the SSE stream to its terminal done event, then assert the document renders in the library AND the row exists in Postgres via raw-SQL readback (plaintext columns only; documents.summary is asserted ciphertext-not-plaintext). The pipeline's happy path is agent-driven (classifier → summary ∥ concepts → graph merge) and only persists the documents row after those stages, so the journey cannot complete without model responses. All four agents build via the #391 seam (model_for), so this adds the seam's boot-time half per ADR 0019: SAPLING_FUNCTION_HANDLERS names a module that _providers loads (and register()s) on the first function-mode handler miss, plus agents/function_handlers_e2e.py with deterministic scripted outputs for the upload tasks. /api/health now surfaces model_mode so the spec fail-fasts instead of billing Gemini against a real-mode stack. Library.tsx becomes a registered testid surface (doc row + inventory + eslint files array). global-setup.ts picks up the #386 sibling fix verbatim (sapling_user localStorage in storageState — cookie alone leaves authed screens on their skeleton). Part of #402. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
592eabd to
297abdbCompareThe RAG post-roll embed predates the seam and sits below it; the journey's determinism holds (failures swallowed) but the comments claimed more than the seam vouches for. Tracked in #439. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
AndresL230
commented
Jul 28, 2026
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. (The panel verified the seam-file union, fixture PDF validity, schema-valid scripted payloads, and encryption-aware assertions. One pre-existing below-seam RAG egress path was confirmed and is tracked as #439; the PR's hermeticity comments were scoped accordingly in-branch.) 🤖 Generated with Claude Code |
Summary
Browser journey for the document pipeline (#387): upload a fixture PDF through the real UI (
upload-modaltestids), ride the SSE stream (streamSSEunderuploadDocumentStream) to its terminaldoneevent, then assert the document appears in the library and the row exists in Postgres via raw-SQL readback.frontend/e2e/upload.spec.ts— the journey. Event-based waiting only (auto-retryingexpect()s on UI state; zerowaitForTimeout). Asserts: SSE completion (upload-modal-donereplaces submit only after the terminal event), the scripted result payload rendered in the row (summary abstract + concept chips), the Postgresdocumentsrow (plaintext columns:user_id,category,offering_id;summaryasserted ciphertext-not-plaintext), the phase-3graph_nodesmerge, and the library card (decrypted summary round-trip).frontend/e2e/fixtures/upload-journey.pdf— hand-assembled 838-byte single-page PDF with a real text layer (232 chars extract natively via pypdf, so backend extraction never reaches the OCR engines).queryRawfromfrontend/e2e/support/db.ts(landed with test(e2e): journey — tutor conversation persists to messages (#392) #434; this PR adds no db.ts changes).frontend/src/components/screens/Library.tsx+docs/frontend-testids.md+frontend/eslint.config.mjs— Library registered as a testid surface per the "Adding a surface" procedure (doc row, inventory, eslint files array; every intrinsic interactive element tagged).LLM-dependence finding (the issue's "known hard part")
The SSE completion event and the
documentsrow itself require model responses — there is no LLM-free scoping that can honestly assert "document appears". Trace ofPOST /api/documents/upload(backend/routes/documents.py):classifier_agent→ (summary_agent∥concept_extraction_agent) → graph merge →_persist_document. Persistence happens only after the agent stages, so without a model there is no row, nodoneevent, no library entry. Option (2) from the issue (assert "upload accepted + row created" without an LLM) is factually impossible on this pipeline._legacy_upload_pipeline→services/gemini_service.py::call_gemini_json→ real Gemini (the feat(backend): pydantic-ai test seam via FunctionModel (SAPLING_MODEL_MODE) #391 seam does not covergemini_service); if that also fails, the stream endserror/failed+done "Failed."with no row persisted.model_for), but it originally had no boot-time half: handlers could only be registered by an in-process Python caller, which a separately booted uvicorn doesn't have. BootingSAPLING_MODEL_MODE=function make e2e-upalone would make every agent raise a handler-missLookupError→ legacy fallback → live Gemini. test(e2e): journey — tutor conversation persists to messages (#392) #434 (tutor) landed the canonical boot-time half on main — theSAPLING_FUNCTION_HANDLERSonce-per-process autoload with its failure-latch ordering — and this PR (rebased onto it) adopts that seam wholesale and appends on top of it:backend/agents/function_handlers_e2e.py— the upload-pipeline handlers appended to main's module per its own "append here" guidance: deterministic scripted outputs forclassifier(→lecture_notes),summary,concepts, plus post-rollcourse_summary. These agents have structuredoutput_types, so each handler emits through the agent's output tool — the real output schema validates the payload; no function tools, zero model-driven writes (within the module's stated constraints)./api/healthnow surfacesmodel_mode, and the spec fail-fasts against a real-mode stack instead of silently billing Gemini.backend/tests/test_e2e_function_handlers.py— two appended cases pinning the upload handlers under the canonical once-latch design: one autoload dispatch registers the whole pipeline and drives the real classifier; the scripted summary payload passes the realSummaryoutput schema in the hermetic lane._index_document_chunksembeds viaservices/rag_service.py(a directgoogle.genaiclient — not covered by the seam). It is fire-and-forget and swallowed on failure, so the journey doesn't depend on it, but for the 10-run tally the stack ran with a dummyGEMINI_API_KEYso even that attempt fails fast without billing.update_course_contextis covered (itscourse_summaryagent goes through the seam) and degrades to a template string if unregistered.Boot contract for this spec:
Verification
10 consecutive local runs green under a single stack-lock hold (one
make e2e-upin function mode, 10×npx playwright test e2e/upload.spec.ts,make e2e-down; exit 0):Zero
waitForTimeoutcalls — every wait is an auto-retryingexpect()on state an event flips (the only grep hit for the string is the header comment stating the rule).Post-rebase confirmation (converged onto main's test(e2e): journey — tutor conversation persists to messages (#392) #434 seam): 3/3 consecutive runs green under one lock hold — pass 7.4s / pass 6.1s / pass 7.1s, exit 0, clean teardown. The 10/10 pre-rebase tally stands as acceptance evidence; this cycle proves the seam swap changed no behavior.
Backend after rebase:
pytest tests/ -q→ 1088 passed, 23 skipped, 1 pre-existing error (tests/test_ocr_pipeline.py::test_save_to_db, "RuntimeError: Event loop is closed" — reproduces identically on an untouchedmaincheckout; unrelated to this change).Frontend after rebase:
eslint .0 errors (Library.tsx now under the testid enforcement block),tsc --noEmitclean,vitest run204 passed.Part of #402, closes#387.
🤖 Generated with Claude Code