[codex] Isolate translation langdetect imports on Windows#7949
Merged
kodjima33 merged 1 commit intoJun 17, 2026
Merged
Conversation
kodjima33
approved these changes
Jun 16, 2026
kodjima33
left a comment
Collaborator
There was a problem hiding this comment.
Test-only stabilization (import isolation / stubs); zero product risk, CI not failing.
49de74e to
9a6ad2c
Compare
9a6ad2c to
3d13fdd
Compare
kodjima33
approved these changes
Jun 17, 2026
kodjima33
left a comment
Collaborator
There was a problem hiding this comment.
Test-only stabilization (translation langdetect imports), CI green
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
langdetectfallback for translation optimization tests when the package is missing in lightweight backend environments.utilsandmodelspackage paths before importing translation modules, so earlier stub-heavy tests cannot makeutils.translationormodels.transcript_segmentunreachable.detect,detect_langs,DetectorFactory, andLangDetectExceptionsurface used by these tests, and skips itself when the reallangdetectpackage is installed.Root cause
The translation tests already mock Redis and Google Translate, but they still import
utils.translation, which importslangdetectat module load. On this Windows lightweight backend venv, standalone collection failed before the tests could run:When collected after stub-heavy tests, a prior lightweight
utilspackage stub could also hide the realbackend/utilspackage, producing:Current status
mainat1a5824403b68ce47c3b0909577cadc1242ba0d3f3d13fdd672d9a7cb36dc366333f4a5caf6c1deeeValidation
D:\codex-omi-work\.venvs\omi-backend-vad-refresh\Scripts\python.exe -m pytest backend\tests\unit\test_translation_optimization.py backend\tests\unit\test_translation_cost_optimization.py --collect-only -q --tb=shortD:\codex-omi-work\.venvs\omi-backend-vad-refresh\Scripts\python.exe -m pytest backend\tests\unit\test_translation_optimization.py backend\tests\unit\test_translation_cost_optimization.py -q --tb=shortD:\codex-omi-work\.venvs\omi-backend-vad-refresh\Scripts\python.exe -m pytest backend\tests\unit\test_translation_cost_optimization.py backend\tests\unit\test_translation_optimization.py -q --tb=shortD:\codex-omi-work\.venvs\omi-backend-vad-refresh\Scripts\python.exe -m pytest backend\tests\unit\test_action_item_date_validation.py backend\tests\unit\test_translation_optimization.py backend\tests\unit\test_translation_cost_optimization.py -q --tb=shortD:\codex-omi-work\.venvs\omi-backend-vad-refresh\Scripts\python.exe -m py_compile backend\tests\unit\test_translation_optimization.py backend\tests\unit\test_translation_cost_optimization.pyD:\codex-omi-work\.venvs\omi-backend-vad-refresh\Scripts\python.exe -m black --line-length 120 --skip-string-normalization --check backend\tests\unit\test_translation_optimization.py backend\tests\unit\test_translation_cost_optimization.pygit diff --check origin/main...HEADscripts/pre-commitwith the backend Windows venv and local Dart SDK onPATH