Repository navigation
perf(backend): reduce isolated unit test startup and image scan work - #23405
Git-on-my-level wants to merge 1 commit into
Conversation
Codex Review SummaryThis 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. |
|
Folding batch (2026-11-04): this branch's tip was merged into the survivor PR #24477 ( |
|
Hey @Git-on-my-level 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
What changed and why
Reduce backend unit-runner startup and static image-contract work after test-slot contention. Reuse parsed imports for identical source text within one image-contract check, defer pytest-httpserver's fixtures to the one loopback test that uses them, and use a fake clock for mentor silence detection. Each image still stages and resolves its own COPY surface; all existing assertions, isolation, markers, and timing budgets remain intact.
The file-isolated runner now prints
BACKEND-UNIT-FILE-WALL <seconds>s <file>including collection/import and shutdown, with one-second precision and no extra timing subprocesses.Product invariants affected
none
How it was verified
origin/main(abfff9df7b), managed Git,make setup, Python 3.11.15 on m1-mac-studio.backend/test.shselections viaBACKEND_UNIT_TEST_FILE_LIST, at nice 19 throughomi-heavy, two pytest workers. Ten slow-file candidates selected from the baseline full CI log were measured before and after.make preflight: all 33 checks passed. Normal pre-push gate passed, including backend type checking (0 errors) and the four changed test files. No hook bypasses.Tests
Existing assertions are unchanged. Regression cases verify that successive scans observe file creation/deletion, identical sources retain nested/lazy imports, and a complete image cannot mask missing files in another image. Runner probes verify the HTTP-server/Werkzeug import chain stays deferred while asyncio remains active; the real loopback test still runs with upstream fixtures.
UI evidence
UI-Evidence: none -- developer infrastructure only.
Failure-Class: none
Targeted file process wall time (seconds)
The ten candidates with the longest test-node spans in the baseline CI unit logs were rerun locally. This is a candidate ranking, not a claim to have profiled all 2,253 files locally. Per-file timings include pytest startup and shutdown. Same selection/order, two workers, nice 19; single runs are load/cache sensitive.
backend/tests/unit/)test_runtime_image_contracts.pytest_cross_service_deploy_contract.pytest_sync_v2.pytest_listen_speaker_id_failover.pytest_firestore_query_shapes.pytest_desktop_proxy_lifetime.pytest_desktop_transcribe.pytest_sync_cloud_tasks.pytest_task_intelligence_contract_freeze.pytest_pipeline_sim_scenarios.pyAggregate file-process time: 287.80s → 250.05s. This sum is not suite elapsed time.
The dominant image source-closure test call measured 45.88s → 26.50s. A cProfile run identified repeated AST parsing/walking across 19 images; the shared cache retains only import statements and is discarded after each check.