Skip to content

test: cover follow-up route boundaries - #75

Open
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/missing-test-coverage-f4ef
Open

test: cover follow-up route boundaries#75
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/missing-test-coverage-f4ef

Conversation

@cursor

@cursor cursor Bot commented Jul 28, 2026

Copy link
Copy Markdown

Summary

  • Add deterministic route-level coverage for POST /api/sessions/[id]/followup.
  • Add test-only aliases and a lightweight NextResponse stub so the root Vitest suite can exercise the real handler without requiring the Next.js runtime.
  • Keep production behavior unchanged.

Risky behavior now covered

  • Malformed JSON and blank messages are rejected before session lookup or vendor calls.
  • Missing or tenant-inaccessible sessions return 404 without constructing an adapter.
  • Valid follow-ups use the persisted session vendor and exact session ID/message, with exactly one paid vendor invocation.
  • Vendor failures return 502 rather than a false success.

Test files added/updated

  • test/followup-route.test.ts
  • test/support/next-server.ts
  • vitest.config.ts

Regression-risk reduction

The follow-up endpoint is a core authenticated workflow that can trigger paid external vendor work. These tests protect the validation and tenant-scoped lookup boundaries and catch wrong-vendor, altered-message, duplicate-dispatch, and false-success regressions without fragile network or browser dependencies.

Validation

  • npm test — 43/43 tests pass.
  • npm run build — passes.
  • npx prettier --check vitest.config.ts test/followup-route.test.ts test/support/next-server.ts — passes.
  • Mutation checks confirmed the suite fails for a hard-coded wrong vendor and for duplicate vendor dispatches.
Open in Web View Automation 

cursoragent and others added 2 commits July 28, 2026 10:05
Co-authored-by: Parvez Kose <koseparvez@gmail.com>
Co-authored-by: Parvez Kose <koseparvez@gmail.com>
@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
polyagent Ready Ready Preview, Comment Jul 28, 2026 10:10am

@parvezk
parvezk marked this pull request as ready for review July 29, 2026 21:03
@cursor

cursor Bot commented Jul 29, 2026

Copy link
Copy Markdown
Author

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@parvezk

parvezk commented Jul 29, 2026

Copy link
Copy Markdown
Owner

@cursoragent this is part of which Cursor thread, or is there a Linear issue to track this? I don't remember where this issue fix request originated?

@cursor

cursor Bot commented Jul 29, 2026

Copy link
Copy Markdown
Author

This came from a Cursor automation, not a Linear issue.

The origin appears to be the recurring “test coverage automation” looking for risky untested paths. It also posted to Slack #polyagent here: https://pk-sfs3859.slack.com/archives/C0BGTS8KHE3/p1785233455266339

Open in Web Open in Cursor 

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.

2 participants