Data-quality roadmap: R-A–R-F + DQ-5 fixes (citations 590→1075, section signal 10%→95%) #16

Merged
user2595 merged 31 commits from integration/roadmap into main 2026-06-27 07:12:31 +00:00
2 changed files with 9 additions and 2 deletions
Showing only changes of commit 553ae3995d - Show all commits

View File

@@ -84,10 +84,10 @@ def search_paper(
rows = conn.execute( rows = conn.execute(
""" """
SELECT id, title, year, SELECT id, title, year,
abstract_emb <-> %(emb)s AS distance abstract_emb <-> %(emb)s::vector AS distance
FROM papers FROM papers
WHERE abstract_emb IS NOT NULL WHERE abstract_emb IS NOT NULL
ORDER BY abstract_emb <-> %(emb)s ORDER BY abstract_emb <-> %(emb)s::vector
LIMIT %(limit)s LIMIT %(limit)s
""", """,
{"emb": emb, "limit": limit}, {"emb": emb, "limit": limit},

View File

@@ -106,6 +106,13 @@ class TestSearch:
assert "Test Paper" in result.stdout assert "Test Paper" in result.stdout
assert "0.123" in result.stdout assert "0.123" in result.stdout
# Regression guard (DQ-4): the pgvector `<->` operator requires the
# query embedding cast to ::vector. Without it, real Postgres raises
# "operator does not exist: vector <-> double precision[]". Mocked DBs
# don't catch the type error, so assert the cast is in the SQL.
executed_sql = mock_conn.execute.call_args_list[0][0][0]
assert "<->" in executed_sql and "::vector" in executed_sql
def test_search_formula_command(self) -> None: def test_search_formula_command(self) -> None:
"""Test `search formula` command with mocked DB.""" """Test `search formula` command with mocked DB."""
with patch("codex.db.get_conn") as mock_get_conn: with patch("codex.db.get_conn") as mock_get_conn: