Skip to content

fix cross-thread order filtering in textSearch#257

Open
ianmacartney wants to merge 3 commits intomainfrom
issue-256
Open

fix cross-thread order filtering in textSearch#257
ianmacartney wants to merge 3 commits intomainfrom
issue-256

Conversation

@ianmacartney
Copy link
Copy Markdown
Member

@ianmacartney ianmacartney commented May 5, 2026

Fixes a bug (#256) where textSearch with searchAllMessagesForUserId incorrectly filtered out cross-thread matches by applying the target message's order as a global filter. Since message order sequences are independent per thread, a target message with a low order in a new thread was causing valid matches from older threads (which naturally have higher order values) to be excluded.

The fix scopes the order-based filter to same-thread messages only, both at the database query level and in the post-fetch filter. When searching across threads, the database-level lte(order) constraint is skipped entirely, and the post-fetch filter now checks threadId before applying the order comparison. Same-thread ordering behavior is preserved — messages after the target within the same thread are still excluded.

Two regression tests are added to cover both cases: cross-thread matches being returned correctly, and same-thread messages after the target still being filtered out.

Fixes #256

@ianmacartney ianmacartney requested a review from sethconvex May 5, 2026 08:16
Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 5, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@convex-dev/agent@257

commit: 9ae6bd9

@ianmacartney ianmacartney marked this pull request as ready for review May 5, 2026 08:17
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

Warning

Rate limit exceeded

@ianmacartney has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 28 minutes and 57 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: get-convex/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a22ec6f7-412e-4524-8e3f-6b788bb69279

📥 Commits

Reviewing files that changed from the base of the PR and between e751f5a and 9ae6bd9.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • package.json
  • src/component/messages.test.ts
  • src/component/messages.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-256

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.

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.

searchOtherThreads drops valid cross-thread text search results when target message order is lower

1 participant