Skip to content

use literal substrings in SQL LIKE queries - #156

Merged
dhth merged 1 commit into
mainfrom
use-literal-like-matching-for-uris-and-titles
Aug 18, 2026
Merged

use literal substrings in SQL LIKE queries#156
dhth merged 1 commit into
mainfrom
use-literal-like-matching-for-uris-and-titles

Conversation

@dhth

@dhth dhth commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Treat user-provided URI, title, and search values as literal substrings in SQL LIKE queries. Escape LIKE metacharacters while retaining the surrounding substring wildcards, preserving ordinary matching and bound parameters while preventing unintended matches during pattern deletion.

Implements #155.

Treat user-provided URI, title, and search values as literal substrings
in SQL LIKE queries. Escape LIKE metacharacters while retaining the
surrounding substring wildcards, preserving ordinary matching and bound
parameters while preventing unintended matches during pattern deletion.

Implements #155.
@github-actions

Copy link
Copy Markdown

dstlled-diff

71f75b6..55e35db -- **.rs

expand
diff --git a/71f75b64/src/persistence/get.rs b/55e35dba/src/persistence/get.rs
index 6ef22e1..ab26f3a 100644
--- a/71f75b64/src/persistence/get.rs
+++ b/55e35dba/src/persistence/get.rs
@@ -42,0 +43 @@ pub fn get_all_bookmarks(pool: &Pool<Sqlite>) -> Result<Vec<SavedBookmark>, DBEr
+fn literal_like_substring_pattern(value: &str) -> String
@@ -45,0 +47 @@ fn getting_matching_bookmark_uris_by_pattern_uses_union_semantics()
+fn get_matching_bookmark_uris_treats_like_metacharacters_literally()
@@ -50,0 +53 @@ fn getting_bookmarks_by_uri_only_works()
+fn bookmark_filters_treat_like_metacharacters_literally()
@@ -63,0 +67 @@ fn getting_tags_with_stats_works()
+fn literal_like_substring_pattern_escapes_like_metacharacters()
diff --git a/71f75b64/tests/delete_test.rs b/55e35dba/tests/delete_test.rs
index 322aa86..b8258b2 100644
--- a/71f75b64/tests/delete_test.rs
+++ b/55e35dba/tests/delete_test.rs
@@ -4,0 +5 @@ fn deleting_bookmarks_by_multiple_patterns_works()
+fn deleting_by_pattern_treats_like_metacharacters_literally()
diff --git a/71f75b64/tests/list_test.rs b/55e35dba/tests/list_test.rs
index b2a135f..8c9d94a 100644
--- a/71f75b64/tests/list_test.rs
+++ b/55e35dba/tests/list_test.rs
@@ -2,0 +3 @@ fn listing_bookmarks_with_queries_works()
+fn listing_by_uri_treats_like_metacharacters_literally()

@dhth
dhth marked this pull request as ready for review August 18, 2026 05:01
@dhth

dhth commented Aug 18, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 71bb366d-0901-4231-a685-ef872ee4e50d

📥 Commits

Reviewing files that changed from the base of the PR and between 71f75b6 and 55e35db.

📒 Files selected for processing (6)
  • .sqlx/query-91bbd7ef112eab92f110557da1378f75b949829600b7bd001bf359b8b5af53f2.json
  • .sqlx/query-b889e19231df46353987c8018ed759b0c5c3a76fb7c3bbceddcd746b851d7bce.json
  • .sqlx/query-fa1f508365f98cdcb5b3a075dfadd5fb81775e94f67ab107778cec88497f4ee6.json
  • src/persistence/get.rs
  • tests/delete_test.rs
  • tests/list_test.rs

Included review availability: Your plan includes up to 2 reviews per rolling hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

SQLite LIKE filters now treat backslashes, %, and _ as literal characters in URI, title, tag, search, listing, and deletion operations. A shared helper builds escaped substring patterns, and filters declare backslash as the escape character. Stored query metadata hashes were updated. Unit and integration tests cover literal metacharacters across filtering and deletion paths.

Merge Risk: ⚪ Minimal · up to 55e35

The change makes user-provided URI, title, and search values match as literal substrings while preserving normal wildcard behavior. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: treating user-provided values as literal substrings in SQL LIKE queries.
Description check ✅ Passed The description accurately explains literal substring handling, LIKE metacharacter escaping, preserved wildcards, and the related issue.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

@dhth
dhth merged commit 089b58a into main Aug 18, 2026
20 checks passed
@dhth
dhth deleted the use-literal-like-matching-for-uris-and-titles branch August 18, 2026 05:05
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