Skip to content

fix(docs): cap search query length and time out the embedding call - #8601

Merged
waleedlatif1 merged 3 commits into
stagingfrom
fix/docs-search-abuse
Oct 3, 2026
Merged

waleedlatif1 merged 3 commits into
stagingfrom
fix/docs-search-abuse

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Oct 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Truncate docs search queries to 256 characters before generating an embedding
  • Add a 10s timeout to the OpenAI embedding request

Type of Change

  • Bug fix

Testing

bun run lint, check:audits, type-check, docs-manifest:check, block-registry check, and root bun run test all pass

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

🤖 Generated with Claude Code

@vercel

vercel Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
docs Ready Ready Preview Oct 3, 2026 8:18pm UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Adds query length limits and timeout to the docs search API.

The PR appears safe to merge; no outstanding or new actionable findings remain.

Summary

The PR caps docs search queries before embedding and adds a 10-second timeout to the embedding request. The change since the previous review replaces slicing with truncation that preserves surrogate pairs.

Reviews (3) · Last reviewed commit: "fix(docs): truncate search queries on a ..."

Comment thread apps/docs/app/api/search/route.ts Outdated
Comment thread apps/docs/lib/embeddings.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/docs/app/api/search/route.ts Outdated
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit cbf6815 into staging Oct 3, 2026
33 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/docs-search-abuse branch October 3, 2026 21:15

This branch was successfully deployed

1 active deployment
Preview — 5841ef01 Deployed Oct 3, 2026 by vercel[bot]
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