Skip to content

[codex] Isolate sync decode test imports on Windows#7948

Merged
kodjima33 merged 2 commits into
BasedHardware:mainfrom
tianmind-studio:codex/windows-sync-decode-test-stubs
Jun 17, 2026
Merged

[codex] Isolate sync decode test imports on Windows#7948
kodjima33 merged 2 commits into
BasedHardware:mainfrom
tianmind-studio:codex/windows-sync-decode-test-stubs

Conversation

@tianmind-studio

@tianmind-studio tianmind-studio commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a temporary python_multipart stub while importing routers.sync in the PCM and Opus decode unit tests, so lightweight Windows backend envs can collect the tests without the full multipart package installed.
  • Ensure the tests' existing import-time stubs expose the full routers.sync import surface, even when earlier-collected tests left partial modules in sys.modules.
  • Keep the changes scoped to test isolation; production sync decode code is unchanged.

Root cause

These decode tests exercise pure PCM/Opus WAL conversion helpers, but importing routers.sync also builds FastAPI routes and imports optional service helpers. In this Windows lightweight backend venv, standalone collection failed on FastAPI's multipart package check. In collection-order runs after stub-heavy tests, partial opuslib, database.conversations, utils.cloud_tasks, and utils.other.endpoints modules could block collection before the decode assertions ran.

A later local stacked Windows collect scan found two remaining same-process cases after the first pass: prior tests could leave models.conversation_enums.ConversationSource without the omi / limitless members, or leave utils.executors without the full import surface used by routers.sync. This PR now fills those stubs before importing routers.sync.

Before this change:

  • python -m pytest backend\tests\unit\test_sync_pcm_decode.py --collect-only -q --tb=short -> RuntimeError: Form data requires "python-multipart" to be installed.
  • python -m pytest backend\tests\unit\test_sync_opus_decode.py --collect-only -q --tb=short -> RuntimeError: Form data requires "python-multipart" to be installed.
  • python -m pytest backend\tests\unit\test_action_item_date_validation.py backend\tests\unit\test_sync_pcm_decode.py backend\tests\unit\test_sync_opus_decode.py --collect-only -q --tb=short --continue-on-collection-errors -> import failures from partial sync dependencies.

Current status

  • Rebased on main at 1a5824403b68ce47c3b0909577cadc1242ba0d3f
  • Head refreshed to 8c31bedb161584d24ff93530717abeba17825a0b
  • GitHub currently reports the PR as mergeable
  • GitHub Actions Lint Check run 27684277856 completed successfully on this head

Validation

  • D:\codex-omi-work\.venvs\omi-backend-vad-refresh\Scripts\python.exe -m pytest backend\tests\unit\test_realtime_integrations_usage_tracking.py backend\tests\unit\test_sync_pcm_decode.py backend\tests\unit\test_sync_opus_decode.py --collect-only -q --tb=short --continue-on-collection-errors
    • 48 tests collected, 1 warning
  • D:\codex-omi-work\.venvs\omi-backend-vad-refresh\Scripts\python.exe -m pytest backend\tests\unit\test_sync_pcm_decode.py backend\tests\unit\test_sync_opus_decode.py -q --tb=short
    • 44 passed, 1 warning
  • D:\codex-omi-work\.venvs\omi-backend-vad-refresh\Scripts\python.exe -m pytest backend\tests\unit\test_sync_opus_decode.py backend\tests\unit\test_sync_pcm_decode.py -q --tb=short
    • 44 passed, 1 warning
  • D:\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_sync_pcm_decode.py backend\tests\unit\test_sync_opus_decode.py -q --tb=short
    • 70 passed, 1 warning
  • D:\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_sync_opus_decode.py backend\tests\unit\test_sync_pcm_decode.py -q --tb=short
    • 70 passed, 1 warning
  • D:\codex-omi-work\.venvs\omi-backend-vad-refresh\Scripts\python.exe -m py_compile backend\tests\unit\test_sync_pcm_decode.py backend\tests\unit\test_sync_opus_decode.py
  • D:\codex-omi-work\.venvs\omi-backend-vad-refresh\Scripts\python.exe -m black --line-length 120 --skip-string-normalization --check backend\tests\unit\test_sync_pcm_decode.py backend\tests\unit\test_sync_opus_decode.py
    • 2 files would be left unchanged
  • git diff --check origin/main...HEAD
  • scripts/pre-commit with the backend Windows venv and local Dart SDK on PATH

Stacked Windows collect check

On a local-only integration branch containing the open Windows collect-isolation PR heads, D:\codex-omi-work\.venvs\omi-backend-vad-refresh\Scripts\python.exe -m pytest backend\tests\unit --collect-only -q --tb=short --continue-on-collection-errors now exits 0 with 4206 tests collected.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test-only stabilization (import isolation / stubs); zero product risk, CI not failing.

@tianmind-studio tianmind-studio force-pushed the codex/windows-sync-decode-test-stubs branch from 76cbab4 to 40d5ba0 Compare June 17, 2026 09:07

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test-only stabilization (sync decode test imports), CI green

@kodjima33 kodjima33 merged commit 7f91b88 into BasedHardware:main Jun 17, 2026
1 check 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