Skip to content

fix(tests): reranker cache-path tests compare paths, not strings (#692) - #952

Merged
github-actions[bot] merged 3 commits into
mainfrom
fix/692-reranker-cache-path-compare
Nov 9, 2026
Merged

github-actions[bot] merged 3 commits into
mainfrom
fix/692-reranker-cache-path-compare

Conversation

@cdeust

@cdeust cdeust commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Summary

Tranche de la classe 9 de #692 : deux tests du cache du reranker échouaient sous Windows parce qu'ils comparaient des chaînes de chemin au lieu de chemins. Le produit est correct ; les tests vérifiaient le séparateur, pas l'emplacement. Ils comparent maintenant des objets Path.

Refs #692 (issue multi-tranches : pas de Closes).

Cause racine (log du run 38008915302, job 114084097957) :

  • tests_py/core/test_reranker.py::TestRerankerCacheDir::test_falls_back_to_home_cache : assert '\\fake\\home...he\\flashrank' == '/fake/home/.cache/flashrank'. shared/platform.cache_dir() renvoie un Path natif ; le test le comparait à un littéral POSIX.
  • tests_py/benchmarks/test_reranker_matrix_runtime.py::test_cell_model_cache_and_state_restore_without_changing_defaults : le diff ne porte que sur les séparateurs (stat0\ms-marco-…\flashrank-…onnx contre stat0/ms-marco-…/flashrank-…onnx). core/reranker_model._model_path() joint avec /, core ne pouvant pas importer pathlib (ADR-0244) ; le test le comparait à un str(Path) natif. Les deux valeurs désignent le même fichier.

Type of change

  • Bug fix (non-breaking change which fixes an issue) — tests uniquement

Test plan

  • pytest tests_py/core/test_reranker.py tests_py/benchmarks/test_reranker_matrix_runtime.py : 46 passed (Linux).
  • ruff check / ruff format --check sur les fichiers touchés : OK ; python scripts/check_craftsmanship.py : OK.
  • Mutation : un reranker_cache_dir() ou un _model_path() qui désignerait un autre dossier ou fichier fait toujours échouer la comparaison de Path ; seule la différence de séparateur est neutralisée.
  • Non vérifié : aucun run Windows, la correction repose sur le diff lu dans le log. Environnement local installé sans torch (téléchargement bloqué par le réseau), dont les tests touchés ne dépendent pas.

Audit notes

  • Aucune revue d'agent lancée sur ce diff de 7 lignes de test.

Coding-standards compliance

  • Aucun code de production modifié ; couches inchangées.

Breaking changes

Aucun.

Reviewer checklist

  • CHANGELOG.md updated under the appropriate section (### Fixed).
  • No secrets / credentials / PII in the diff.
  • CI passes on the latest commit (en attente).

https://claude.ai/code/session_018kyZYuh12mhbtnpuBLP9bi


Generated by Claude Code

Windows run 38008915302 (job 114084097957) failed
test_falls_back_to_home_cache ('\fake\home\.cache\flashrank' against the
literal '/fake/home/.cache/flashrank') and
test_cell_model_cache_and_state_restore_without_changing_defaults (the
'/'-joined path core/reranker_model.py builds, since core may not import
pathlib under ADR-0244, against a native str(Path) with backslashes). Both
values name the same file; the tests asserted the separator, not the
location. They now compare Path objects.

Refs #692

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018kyZYuh12mhbtnpuBLP9bi
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T21:31:07.130199Z 63c2788 New commits
🔒 Security Review ✅ Completed 2026-11-09T21:32:08.903102Z 63c2788 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@claude

claude Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Claude finished @cdeust's task in 1m 30s —— View job


I'll analyze this and get back to you.

@claude

claude Bot commented Nov 9, 2026

Copy link
Copy Markdown

Review 1/3: PR #952

Five reviewers ran: code quality, performance, test coverage, documentation and security. None found a Blocker.

I read the test changes against the source:

  • shared/platform.home_dir() reads $HOME on every OS, so on Windows the expected path is \fake\home\.cache\flashrank.
  • WindowsPath("/fake/home/.cache/flashrank") equals that path.
  • _model_path() joins with /, and Path(...) normalises those separators.

Both tests still fail if the cache falls back to /tmp, if HOME is ignored, or if the subdirectory is wrong. Path was already imported in both files. The CHANGELOG entry is under [Unreleased] / Fixed.

Notes, no action before merge

Not verified: the reviews read the code but did not run the tests or a Windows job.

Verdict: approve

@claude

claude Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Claude finished @cdeust's task in 1m 13s —— View job


Review 2/3: PR #952

Verdict: approve

cdeust commented Nov 9, 2026

Copy link
Copy Markdown
Owner Author

Suite à la revue 1/3 :


Generated by Claude Code

@claude

claude Bot commented Nov 9, 2026

Copy link
Copy Markdown

Review 2/3: PR #952

Scope. Review 1 (b68a26b) found no Blockers, so there was nothing to re-check. This review covers only the commit pushed after it, 63c2788 (fixup). It changes one line in CHANGELOG.md and one comment line in tests_py/benchmarks/test_reranker_matrix_runtime.py. In both, the source cited for the rule "core may not import pathlib" changes from ADR-0244 to issue #560.

Five reviewers ran on that commit: code quality, performance, test coverage, documentation and security. None found a Blocker.

I checked the new citation against the code:

  • mcp_server/core/reranker_model.py:6 and :45 both credit the rule to issue [audit] 17 core/ modules import os or pathlib (core must be zero-I/O) #560.
  • docs/adr/ADR-0244-mcp-server-core-reranker-model.md says nothing about pathlib.
  • No ADR-0244 citation for this rule is left in the changed files.
  • The assertion under the edited comment (test_reranker_matrix_runtime.py:145-147) is unchanged, so the tests behave exactly as before.

Notes, no action before merge

Not verified: I did not run the tests or a Windows job for this fixup, since it only changes a comment and a CHANGELOG line.

View job run

Verdict: approve

@github-actions
github-actions Bot merged commit 695e851 into main Nov 9, 2026
18 checks passed
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