From 0c51fe0c6b632e4b7337273881e61efd00a783da Mon Sep 17 00:00:00 2001 From: Bingxi Zhao <150592536+pancacake@users.noreply.github.com> Date: Sun, 16 Aug 2026 22:39:47 +0800 Subject: [PATCH] test: restore CI baseline contracts (#878) Restore Ruff formatting, whitespace-tolerant source contracts, and a deterministic CI model catalog. --- .github/workflows/tests.yml | 1 + .../pipelines/llamaindex/document_loader.py | 4 +-- tests/fixtures/ci_model_catalog.json | 27 +++++++++++++++++++ tests/scripts/test_pre_commit_hook.py | 6 ++--- .../rag/test_llamaindex_document_loader.py | 4 +-- .../codex-oauth-settings-contract.test.ts | 2 +- 6 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 tests/fixtures/ci_model_catalog.json diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ab4a39fc1..48df6df25 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -171,6 +171,7 @@ jobs: logging: level: WARNING YAML + cp tests/fixtures/ci_model_catalog.json data/user/settings/model_catalog.json - name: Run Python tests run: | diff --git a/deeptutor/services/rag/pipelines/llamaindex/document_loader.py b/deeptutor/services/rag/pipelines/llamaindex/document_loader.py index 471d8f514..eb690b644 100644 --- a/deeptutor/services/rag/pipelines/llamaindex/document_loader.py +++ b/deeptutor/services/rag/pipelines/llamaindex/document_loader.py @@ -72,9 +72,7 @@ class LlamaIndexDocumentLoader: # archive download) on a synchronous httpx.Client — running it on # the event loop stalls every other request for the whole PDF # (same class of bug as upstream #761/#777). Hand it to a thread. - text, extracted_images = await asyncio.to_thread( - self._parse_document, file_path - ) + text, extracted_images = await asyncio.to_thread(self._parse_document, file_path) self._append_if_nonempty(documents, file_path, text) image_sources.extend(extracted_images) diff --git a/tests/fixtures/ci_model_catalog.json b/tests/fixtures/ci_model_catalog.json new file mode 100644 index 000000000..6359b167e --- /dev/null +++ b/tests/fixtures/ci_model_catalog.json @@ -0,0 +1,27 @@ +{ + "version": 1, + "services": { + "llm": { + "active_profile_id": "ci-llm-profile", + "active_model_id": "ci-llm-model", + "profiles": [ + { + "id": "ci-llm-profile", + "name": "CI LLM", + "binding": "openai", + "base_url": "https://api.openai.com/v1", + "api_key": "sk-test-not-a-real-key", + "api_version": "", + "extra_headers": {}, + "models": [ + { + "id": "ci-llm-model", + "name": "CI Test Model", + "model": "gpt-4o-mini" + } + ] + } + ] + } + } +} diff --git a/tests/scripts/test_pre_commit_hook.py b/tests/scripts/test_pre_commit_hook.py index aa0e748b6..a3bcfa8ba 100644 --- a/tests/scripts/test_pre_commit_hook.py +++ b/tests/scripts/test_pre_commit_hook.py @@ -1,7 +1,7 @@ from __future__ import annotations -from pathlib import Path import os +from pathlib import Path import subprocess @@ -27,6 +27,4 @@ def test_hook_stops_when_repo_hygiene_fails(tmp_path: Path) -> None: ) assert result.returncode != 0 - assert calls.read_text(encoding="utf-8").splitlines() == [ - "scripts/check_repo_hygiene.py" - ] + assert calls.read_text(encoding="utf-8").splitlines() == ["scripts/check_repo_hygiene.py"] diff --git a/tests/services/rag/test_llamaindex_document_loader.py b/tests/services/rag/test_llamaindex_document_loader.py index 3a1c7bbcf..6ec1d6e7e 100644 --- a/tests/services/rag/test_llamaindex_document_loader.py +++ b/tests/services/rag/test_llamaindex_document_loader.py @@ -106,9 +106,7 @@ def test_loader_keeps_event_loop_responsive_while_parser_blocks( return await asyncio.wait_for(load_task, timeout=1) documents = asyncio.run(_exercise()) - assert [document.text for document in documents] == [ - "Parsed without blocking the loop" - ] + assert [document.text for document in documents] == ["Parsed without blocking the loop"] def test_loader_skips_document_when_active_engine_cannot_parse( diff --git a/web/tests/codex-oauth-settings-contract.test.ts b/web/tests/codex-oauth-settings-contract.test.ts index 05ea09416..de8f1ae60 100644 --- a/web/tests/codex-oauth-settings-contract.test.ts +++ b/web/tests/codex-oauth-settings-contract.test.ts @@ -85,7 +85,7 @@ test("ordinary users can edit only their owner-scoped Codex reasoning overrides" ); assert.match( card, - /setCodexReasoningEffort\(model\.model, value \|\| null\)/, + /setCodexReasoningEffort\(\s*model\.model,\s*value \|\| null,?\s*\)/, ); });