Repository navigation
fix(tests): issue-147 cwd fault hits only the grading fallback (#692) - #954
Conversation
Windows run 38008915302 (job 114084097957) failed test_force_write_survives_missing_cwd and test_force_write_tags_grading_failure_observably with FileNotFoundError raised from <frozen ntpath>:719 inside the store's Path(db).resolve(), before the write reached grading. The tests patched os.getcwd for the whole interpreter, and on Windows ntpath.realpath reads the cwd even for an absolute path. Windows refuses to remove a process's cwd, so that failure exists only under the mock. The fault is now injected where issue 147 located it: the os.getcwd() fallback in handlers/remember_helpers._grade_content_best_effort. Refs #692 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018kyZYsMMHWM8R2NFVyNfFC
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. |
|
Claude finished @cdeust's task in 1m 48s —— View job PR #954 review: done
No Blockers. The review lists 3 Notes, none needed before merge. I couldn't run pytest in this job because the command needed approval, so the verdict comes from reading the code. Verdict: approve |
Review 1 of 3 (ADR-1119): PR #954Five reviews: code quality, test coverage, docs accuracy, security and performance. No Blockers.
Notes, no action before merge
I couldn't run pytest in this job (the command needed approval), so this verdict comes from reading the code. Verdict: approve |
|
Réponse aux trois notes non bloquantes de la revue 1. Aucune ne justifie de pousser un commit seul :
Generated by Claude Code |
Summary
Tranche de la classe 9 de #692 («
Path.resolvemocké », 2 tests). Le run Windows 38008915302 (job 114084097957) faisait échouertest_force_write_survives_missing_cwdettest_force_write_tags_grading_failure_observablyavec unFileNotFoundError. L'erreur venait de<frozen ntpath>:719, dans lePath(db).resolve()du store, avant que l'écriture n'atteigne la notation.Cause racine (défaut du test, pas du produit) : les tests remplaçaient
os.getcwdpour tout l'interpréteur. Or, sous Windows,ntpath.realpathlit le cwd même pour un chemin absolu. De plus, Windows refuse de supprimer le cwd d'un processus, donc cet échec n'existe que sous le mock. Le défaut est maintenant injecté là où l'issue 147 l'a localisé : le replios.getcwd()dehandlers/remember_helpers._grade_content_best_effort, viapatch.object(remember_helpers, "os", Mock(wraps=os, getcwd=…)). Aucun code de production n'est touché.Refs #692
Type of change
Test plan
pytest tests_py/handlers/test_issue_147_write_class_and_grading.py: 13 passed (Linux, SQLite).pytest tests_py/handlers: 1937 passed, 81 skipped.ntpath.realpath: un plugin pytest fait lireos.getcwd()parPath.resolve, comme le fait Windows. Avec cette simulation, l'ancien test donne 2 failed, ce qui reproduit les 2 échecs Windows. Le nouveau test passe (4/4 sur la classe).getcwdmocké renvoie un chemin au lieu de lever une exception,test_force_write_tags_grading_failure_observablyéchoue. Le défaut est donc bien atteint.test_force_write_survives_missing_cwdseul ne tue pas ce mutant, parce qu'un contenu sans référence est notéunverifiabledans les deux cas.ruff check/ruff format --check(ruff 0.17.3),python scripts/check_craftsmanship.py: OK. Le fichier fait 295 lignes, sous le plafond de 300.Non vérifié :
os.getcwd()du chemin d'écriture ne bloque avec un cwd supprimé. Il couvre uniquement le site corrigé par remember: write_class='deliberate' contract violated (below_threshold rejection) and force=true intermittently raises FileNotFoundError #147.Audit notes
Coding-standards compliance
Reviewer checklist
Generated by Claude Code