Skip to content

Add test coverage for analysis pipeline (FLO-160)#4

Merged
Fl0p merged 2 commits into
mainfrom
flo-160-analysis-pipeline-tests
May 24, 2026
Merged

Add test coverage for analysis pipeline (FLO-160)#4
Fl0p merged 2 commits into
mainfrom
flo-160-analysis-pipeline-tests

Conversation

@Fl0p

@Fl0p Fl0p commented May 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add runPool.test.ts: concurrency limiting, abort signal, onProgress callbacks, empty-input guard, concurrency-cap edge case (6 tests)
  • Add buildModel.test.ts: OpenAI, Anthropic, OpenRouter provider cases; -1m long-context suffix strips model id and adds anthropic-beta header (5 tests)
  • Add extractSignals.test.ts: happy path, empty-text response, throw path, non-Error throw, prompt/abort-signal forwarding, finishReason=length error description (7 tests)
  • Add generateSummary.test.ts: empty-fragments guard, happy path, empty-text response, throw path, prompt contents, abort-signal forwarding, fragment-count in prompt (7 tests)
  • Add Analyze.test.tsx: render/redirect guards (no session, no provider), chunk list, side buttons, disabled Run summary, extraction flow, done/error/retry states, missing-key warning, back-link (11 tests)

Test plan

  • pnpm test --run — 82 tests pass (46 existing + 36 new), no regressions
  • All acceptance criteria from FLO-160 met: runPool concurrency/abort/progress/empty, buildModel per-provider + -1m suffix, extractSignals/generateSummary mocked happy+error paths, Analyze render + interaction

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Added comprehensive test suites for model building, signal extraction, summary generation, and task pool concurrency management, verifying success/error handling and callback behavior. Added tests for the Analyze route covering UI rendering and user interactions.

Review Change Stack

New test files covering the previously untested critical paths:
- runPool: concurrency limiting, abort signal, progress callbacks, empty input
- buildModel: each provider case, -1m long-context suffix handling
- extractSignals: happy path, empty response, throw, prompt/signal forwarding
- generateSummary: empty fragments guard, happy path, empty response, throw, prompt contents
- Analyze route: render, no-session redirect guard, side buttons, extraction flow,
  error/retry states, missing-key warning

82 tests total (46 existing + 36 new), all passing.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
@coderabbitai

coderabbitai Bot commented May 24, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 78fe553c-52fc-4266-97e4-7d1f0ad0888e

📥 Commits

Reviewing files that changed from the base of the PR and between c6aa408 and 6c77c46.

📒 Files selected for processing (5)
  • src/lib/buildModel.test.ts
  • src/lib/extractSignals.test.ts
  • src/lib/generateSummary.test.ts
  • src/lib/runPool.test.ts
  • src/routes/Analyze.test.tsx

📝 Walkthrough

Walkthrough

This PR adds five Vitest test suites covering core library utilities and a route component: buildModel provider factory, extractSignals LLM-based signal extraction, generateSummary fragment summarization, runPool concurrent task execution, and the Analyze route UI. All tests use mocked dependencies and verify behavioral contracts and error handling.

Changes

Test Suite Addition for Core Library and Route Components

Layer / File(s) Summary
Provider Model Factory Tests
src/lib/buildModel.test.ts
Tests buildModel with OpenAI, Anthropic, and OpenRouter providers; verifies correct header attachment (browser-access always for Anthropic, context-1m beta only for *-1m models with suffix stripped) and factory argument passing.
Signal Extraction Tests
src/lib/extractSignals.test.ts
Tests extractSignals success path with trimmed output, empty-text and error-rejection handling, prompt composition from chunk.text, and optional abort signal forwarding to generateText.
Summary Generation Tests
src/lib/generateSummary.test.ts
Tests generateSummary early exit for empty fragments, success path with text trimming, empty-text and rejection errors, prompt composition including fragment count and per-fragment signal details, and abort signal forwarding.
Concurrent Pool Utility Tests
src/lib/runPool.test.ts
Tests runPool for empty input handling, ordered result preservation, configurable concurrency limiting, per-item progress callbacks, abort signal respect, and oversized concurrency relative to item count.
Analyze Route Component Tests
src/routes/Analyze.test.tsx
Tests Analyze route for conditional rendering when session or provider missing, core UI presence, chunk extraction with per-chunk status transitions and retry controls on failure, missing API key warnings, and "Back to import" navigation link.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A warren of tests now guards the way,
Each signal and summary held at bay,
Models and pools dance in harmony,
With mocks and asserts dancing free,
Coverage blooming, spring's sweet display! 🌱

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch flo-160-analysis-pipeline-tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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 and usage tips.

- buildModel.test.ts: cast through unknown (LanguageModel union does not
  overlap MockModel) so tsc -b passes; pnpm build/deploy was failing
- runPool.test.ts: drop unused beforeEach import
- extractSignals.test.ts: biome formatting

Co-Authored-By: Paperclip <noreply@paperclip.ing>
@Fl0p Fl0p merged commit 9971e25 into main May 24, 2026
1 of 2 checks passed
@Fl0p Fl0p deleted the flo-160-analysis-pipeline-tests branch May 24, 2026 14:54
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