Skip to content

fix(mcp-server): non-destructive FTS5 check + FTS5 search#241

Merged
tomymaritano merged 1 commit into
developfrom
fix/coderabbit-review-findings
Apr 24, 2026
Merged

fix(mcp-server): non-destructive FTS5 check + FTS5 search#241
tomymaritano merged 1 commit into
developfrom
fix/coderabbit-review-findings

Conversation

@tomymaritano

Copy link
Copy Markdown
Collaborator

Summary

Addresses two major CodeRabbit findings on PR #238.

1. Non-destructive FTS5 check (was Major)

assertFts5Available used CREATE VIRTUAL TABLE + DROP TABLE to probe FTS5. If the process crashed between those two statements, a stale _fts5_check table would persist and block all future startups with a false "FTS5 not available" error.

Fix: Use sqlite_compileoption_used('ENABLE_FTS5') — a read-only query that never touches the schema.

2. Search now actually uses FTS5 (was Major)

The docstring and PR description said search used FTS5, but the query was still LIKE '%term%'. The FTS5 triggers were maintaining the notes_fts index on every write, but no reader ever queried it.

Fix: readied_search_notes now uses notes_fts MATCH with bm25() ranking and snippet() highlights.

Also

  • Skip WAL pragma for :memory: databases (no-op but avoids confusion in tests/health checks)

Test plan

  • pnpm --filter @readied/mcp-server build — clean
  • pnpm --filter @readied/mcp-server test — 5/5 pass

🤖 Generated with Claude Code

…ATCH

- Replace CREATE/DROP temp table FTS5 check with
  sqlite_compileoption_used('ENABLE_FTS5') — no schema mutation,
  no crash risk if process dies mid-check
- Switch readied_search_notes from LIKE to FTS5 MATCH with bm25()
  ranking and snippet() highlights
- Skip WAL pragma for :memory: databases (silent no-op)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Apr 24, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
readide Building Building Preview, Comment Apr 24, 2026 5:06pm

Request Review

@coderabbitai

coderabbitai Bot commented Apr 24, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

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

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 23 minutes and 39 seconds.

⌛ 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9685517b-1814-4277-8509-1a4d826a0814

📥 Commits

Reviewing files that changed from the base of the PR and between 32f522a and 1b603f4.

📒 Files selected for processing (3)
  • packages/mcp-server/src/__tests__/fts5-triggers.test.ts
  • packages/mcp-server/src/db.ts
  • packages/mcp-server/src/index.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/coderabbit-review-findings

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.

@github-actions github-actions Bot enabled auto-merge (squash) April 24, 2026 17:07
@tomymaritano tomymaritano disabled auto-merge April 24, 2026 17:08
@tomymaritano tomymaritano merged commit 3c7fab8 into develop Apr 24, 2026
7 of 9 checks passed
@tomymaritano tomymaritano deleted the fix/coderabbit-review-findings branch April 24, 2026 17:08

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1b603f4160

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +232 to +234
FROM notes_fts
JOIN notes n ON n.id = notes_fts.id
WHERE notes_fts MATCH ? AND n.is_deleted = 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Guard FTS search when FTS index table is unavailable

This query now hard-depends on notes_fts, but startup only checks that the SQLite binary supports FTS5 and never verifies that migration 008 actually created the table. On older or partially migrated databases, readied_search_notes will now fail with no such table: notes_fts instead of returning results (the previous LIKE query path worked). Consider checking for notes_fts existence (or catching this error) and falling back to a non-FTS query or an explicit migration-required message.

Useful? React with 👍 / 👎.

tomymaritano added a commit that referenced this pull request Apr 24, 2026
## Summary

- **fix(mcp-server):** non-destructive FTS5 check + switch search to
FTS5 MATCH (#241)
- **fix:** unwrap getToken IPC result + use exact range for auto-link
paste (#240)
- **fix:** gate built-in plugins until enabled state loads + fix IPC
listener cleanup (#239)
- **feat:** allow disabling built-in plugins + fix MCP server FTS5 crash
(#237)
- **chore(deps):** sync postcss bump from main

## Test plan
- [ ] CI passes (typecheck, lint, tests, build)
- [ ] After merge, run Release workflow via `workflow_dispatch`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant