Repository navigation
fix(scope): the SQL project predicate normalizes Windows separators like the Python rule (#692) - #959
Conversation
…ike the Python rule (#692) project_ancestors() slash-normalizes the session root and memory_matches_project() normalizes the stored directory_context too (ADR-1080), but every SQL scope predicate compared the ancestor list with the raw column. A row whose directory_context uses backslashes or ends with a separator matched in Python and never in SQL: on the Windows measurement (run 38008915302, job 114084097957) file priming left aliased rows at heat 0.5 (test_file_priming_aliases x4, test_file_memory_priming x2). pg_scope_clause.normalized_directory_column() is now the one expression (REPLACE then RTRIM, valid in PostgreSQL and SQLite) used by both backends' scope clauses and by the session-start, auto-recall and agent-briefing raw PostgreSQL queries, which carried inline copies of the predicate. Refs #692 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018kyZYudG4Cbi77EfobNUhL
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Review 1/3: PR #959Five reviewers ran: code quality, security, performance, test coverage and documentation. None found a Blocker. What they traced:
Not run in this review: ruff, the craftsmanship gate and pytest. Running them needed approval. Notes, no action before merge
Verdict: approve |
|
Réponse aux notes de la revue 1/3 (aucune n'est bloquante, donc aucun push pour elles seules) :
Generated by Claude Code |
…692) The unit check's mutation step (ADR-1122, run 42737080540, job 129576254714) kept 7 survivors on the lines 3ac8699 changed: - agent_briefing_query._fetch_agent_context 12, 13 and 15 drop the pass-1 rows. No test ever had pass 1 return a row: the existing PG scope test only reaches team decisions through pass 2. test_pg_briefing_passes_scope_a_ windows_directory makes both passes and _pg_role_rows return rows stored under C:\work\orchid (one with a trailing separator), and exclude a sibling directory. - agent_briefing_role._pg_role_rows 8, 9, 23 and 26 only change the case of SQL keywords and of the unquoted alias. The query moves to the module constant _PG_ROLE_SQL, like session_start_fetch's queries, so it is no longer mutated as function code. Also narrows two docstrings from review 1/3: SQLite has covering indexes ending with directory_context, and the static guard covers only the "= ANY(" and "IN (" forms. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018kyZYudG4Cbi77EfobNUhL
|
CI autopilot : Les 12 354 tests passent (run 42737080540, job 129576254714, image
Non vérifié :
Generated by Claude Code |
Review 2/3: PR #959Review 1/3 found no Blockers, so this pass covers only the commit pushed after What they traced:
Not run in this review: ruff, the craftsmanship gate and pytest (no approved shell), and the PG-only test (it skips on SQLite). Notes, no action before merge
Verdict: approve |
|
Réponse aux notes de la revue 2/3. Aucune n'est bloquante ; je ne pousse pas pour elles seules, car un push relance la CI et une revue.
Generated by Claude Code |
…cess (#692) The unit check's mutation step (run 42745672842, job 129607262143) passed the briefing functions but kept two gaps on 903cd34: - auto_recall._recall_memories 4, 5 and 7 drop its query rows. test_auto_recall_scope runs the hook as a subprocess, which mutmut's trampoline does not reach. The Windows-directory PG test now calls _recall_memories in process and requires the scoped rows back. - pg_scope_clause and sqlite_scope_clause were untested: no test file imported them. test_scope_clause_separators now imports both and pins each builder's output; locally scripts/mutation_check.sh on the two modules leaves no survivor. Also from review 2/3: the role-prior query must exclude the team decision, and the static guard's docstring names the queries the PG test runs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018kyZYudG4Cbi77EfobNUhL
|
CI autopilot : Les 12 355 tests passent (run 42745672842, job 129607262143). Les mutants de
Non vérifié : le test PG et la mutation d' Generated by Claude Code |
|
Claude finished @cdeust's task in 2m 44s —— View job Review 3/3: PR #959
The whole PR is accepted. All three commits and all 10 files are clear, and no Blocker is open. The review comment lists three Notes that need no action before merge. The main one: in Not run in this review: ruff, the craftsmanship gate and pytest. Verdict: approve |
Review 3/3: PR #959Review 2/3 found no Blockers, so this pass covers only the commit pushed after What they traced:
Not run in this review: ruff, the craftsmanship gate and pytest. The PG-only test skips on SQLite. Notes, no action before merge
Accepted: the whole PR, all three commits ( Verdict: approve |
|
Réponse aux notes de la revue 3/3 : aucune n'est bloquante. Je ne pousse rien pour elles : le budget de revue est épuisé (3/3, ADR-1119), et un push relancerait la CI pour des points de test seulement.
Ces trois points sont notés pour la prochaine tranche de #692. Generated by Claude Code |
Summary
Tranche classe 9 « file priming aliases » de #692. Refs #692 (le suivi Windows reste ouvert pour les autres tranches).
Cause racine.
project_ancestors()normalise la racine de session (\→/, séparateur final retiré) etmemory_matches_project()normalise aussi ledirectory_contextstocké (ADR-1080). Les prédicats SQL, eux, comparaient la liste normalisée à la colonne brute. Une ligne dont ledirectory_contextcontient des\ou finit par un séparateur passait la règle Python mais jamais la requête SQL. Dans la mesure Windows (run 38008915302, job 114084097957), le priming laissait donc les lignes à heat 0.5 (test_file_priming_aliases×4,test_file_memory_priming::test_alias_project_read_preserves_stored_scope×2,assert 0.5 == 0.6).Correctif.
pg_scope_clause.normalized_directory_column()est maintenant la seule expressionRTRIM(REPLACE(directory_context, '\', '/'), '/'), valide en PostgreSQL et en SQLite. Les deuxdirectory_scope_clausel'utilisent, ainsi que les 6 requêtes PostgreSQL brutes des hooks, qui en avaient chacune une copie inline :session_start_fetch×3,auto_recall,agent_briefing_query×2 etagent_briefing_role. Aucun index ne couvredirectory_context, donc envelopper la colonne ne retire aucun usage d'index. Pour un chemin POSIX déjà normalisé, l'expression ne change rien.Type of change
Test plan
tests_py/infrastructure/test_scope_clause_separators.py. Il écrit l'orthographe Windows sur n'importe quelle plateforme, donc la CI Linux couvre le défaut :get_hot_memoriesacceptentC:\work\repo,C:\work\repo\,C:/work/repoet l'ancêtreC:\work, et rejettentC:\work\other;mcp_server/ne compare la colonne brute (directory_context = ANY/IN (), pour éviter que les copies réapparaissent.mainsans le correctif : 6 failed, 2 passed (les 6 cas à\ou à séparateur final). Avec le correctif : 9 passed.pytest tests_py/infrastructure tests_py/hooks tests_py/shared: 3083 passed, 195 skipped, 6 failed. Les 6 échecs sont identiques surorigin/maindans le même environnement :test_embedding_engine×3 ettest_vulnerable_dependency_paths(torch absent, son index de téléchargement est bloqué par le réseau), plustest_entry_auto_dispatch×2.ruff checketruff format --checksur les fichiers modifiés : OK.python scripts/check_craftsmanship.py: OK.Audit notes
directory_scope_clausecôté PG ne sont exercées que par la CI. Le littéral'\'supposestandard_conforming_strings = on(défaut PostgreSQL depuis 9.1).benchmarks/reproduce.shn'a pas été lancé (il faut PostgreSQL et les modèles). Les chemins des benchmarks sont POSIX, et l'expression ne les modifie pas./repo/) entre maintenant dans la portée SQL de/repo, comme la règle Python l'acceptait déjà.Coding-standards compliance
infrastructure.sqlite_scope_clause).Reviewer checklist
Generated by Claude Code