Skip to content

Conversation

Copy link

Copilot AI commented Nov 5, 2025

The FakeEmbeddings test fixture regex correctly extracts SQL-escaped single quotes ('') from filter expressions but wasn't unescaping them before comparison, causing false negatives for metadata values containing apostrophes.

Changes:

  • Unescape filter values in tests/utils.py by replacing ''' before comparison
  • Add test coverage for single quotes, multiple quotes, and baseline cases

Example:

# SQL query built by TxtaiStore._build_sql escapes quotes
sql = "SELECT * FROM txtai WHERE [author] = 'O''Brien'"

# Before: raw_val = "O''Brien" didn't match stored value "O'Brien"
# After: expected = raw_val.replace("''", "'") matches correctly

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Base automatically changed from codex/fix-sql-query-escaping-and-add-tests to main November 5, 2025 01:08
Co-authored-by: rodrigopitanga <1755608+rodrigopitanga@users.noreply.github.com>
Copilot AI changed the title [WIP] Add changes to metadata persistence sanitization based on feedback Fix escaped single quote handling in FakeEmbeddings filter comparison Nov 5, 2025
Copilot AI requested a review from rodrigopitanga November 5, 2025 01:18
@rodrigopitanga rodrigopitanga force-pushed the main branch 2 times, most recently from 0288107 to 8e8a634 Compare November 5, 2025 14:38
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