[PR #8] [CLOSED] test: add source-audit tests for the async DoclingLoader rework #10

Closed
opened 2026-10-18 21:09:30 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/tests/pull/8
Author: @jannefleischer
Created: 7/9/2026
Status: ❌ Closed

Base: main ← Head: feat-docling-loader-async


📝 Commits (1)

  • 26e12d3 test: add source-audit tests for the async DoclingLoader rework

📊 Changes

1 file changed (+842 additions, -0 deletions)

View changed files

➕ unit/retrieval/test_docling_loader_async.py (+842 -0)

📄 Description

THIS IS MOSTLY DONE BY AI. I am an urban planner having (almost) no understanding of the inner workings of tests...

This relies on PR https://github.com/open-webui/open-webui/pull/26947 (which is part of discussion in https://github.com/open-webui/open-webui/discussions/26931)

Covers the DoclingLoader rework that replaces the old blocking /v1/convert/file call with submit (/v1/convert/file/async) -> long-poll (/v1/status/poll/{task_id}) -> retrieve (/v1/result/{task_id}), on both its sync (load()) and true async (aload()) paths, plus:

  • optional overall timeout (DOCLING_SERVE_TIMEOUT), wired end-to-end from config.py through LOADER_CONFIG_KEYS/RETRIEVAL_CONFIG_KEYS, ConfigForm, and update_rag_config
  • optional status_callback hook invoked on submit and on task_position updates while polling, on both paths
  • load_from_task_id() / aload_from_task_id() to resume an already-submitted task without re-uploading
  • _notify_status_async(): the async path awaits status_callback's return value if it's awaitable, since a real caller may reasonably supply an async def callback (e.g. one that awaits a DB write) — calling it as a plain function would silently produce an un-awaited coroutine that never runs
  • Loader.aload()'s dispatch now routes DoclingLoader through its true async aload() directly instead of asyncio.to_thread(self.load, ...), so a slow conversion no longer occupies a worker thread from the shared default executor for its entire duration; every other loader is unaffected and still goes through asyncio.to_thread

Source-level tests (regex-match the actual backend source via the open_webui_backend fixture) rather than importing open_webui.retrieval.loaders.main directly, since that module pulls in a dependency tree (typer, langchain_community, azure.identity, ftfy) not present in this repo's test environment — same approach already used for the knowledge-status tests.

One thing worth calling out for review: method-boundary lookaheads in this file use \n (?:async\s+)?def\s+\w+ rather than \n def\s+\w+. DoclingLoader interleaves sync and async methods, and a lookahead recognizing only plain def runs straight past an async def boundary, sweeping a later method's body into the match — I caught this via a false-positive failure on the load_from_task_id test itself once the async methods were added after it in the source.

Verified: all 37 tests pass against the feat-docling-loader-async source branch, and all 37 correctly fail against the pristine, pre-rework dev source — confirmed by pointing OPEN_WEBUI_SOURCE_DIR at each in turn, so these are discriminating regression guards rather than tautologies, not just "assert True".

ruff format / ruff check (line length 100, per this repo's pyproject.toml) are clean.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/tests/pull/8 **Author:** [@jannefleischer](https://github.com/jannefleischer) **Created:** 7/9/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat-docling-loader-async` --- ### 📝 Commits (1) - [`26e12d3`](https://github.com/open-webui/tests/commit/26e12d393187899dcd675d38837d3193d2e37939) test: add source-audit tests for the async DoclingLoader rework ### 📊 Changes **1 file changed** (+842 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `unit/retrieval/test_docling_loader_async.py` (+842 -0) </details> ### 📄 Description **_THIS IS MOSTLY DONE BY AI. I am an urban planner having (almost) no understanding of the inner workings of tests..._** This relies on PR https://github.com/open-webui/open-webui/pull/26947 (which is part of discussion in https://github.com/open-webui/open-webui/discussions/26931) Covers the DoclingLoader rework that replaces the old blocking `/v1/convert/file` call with submit (`/v1/convert/file/async`) -> long-poll (`/v1/status/poll/{task_id}`) -> retrieve (`/v1/result/{task_id}`), on **both** its sync (`load()`) and true async (`aload()`) paths, plus: - optional overall timeout (`DOCLING_SERVE_TIMEOUT`), wired end-to-end from `config.py` through `LOADER_CONFIG_KEYS`/`RETRIEVAL_CONFIG_KEYS`, `ConfigForm`, and `update_rag_config` - optional `status_callback` hook invoked on submit and on `task_position` updates while polling, on both paths - `load_from_task_id()` / `aload_from_task_id()` to resume an already-submitted task without re-uploading - `_notify_status_async()`: the async path awaits `status_callback`'s return value if it's awaitable, since a real caller may reasonably supply an `async def` callback (e.g. one that awaits a DB write) — calling it as a plain function would silently produce an un-awaited coroutine that never runs - `Loader.aload()`'s dispatch now routes `DoclingLoader` through its true async `aload()` directly instead of `asyncio.to_thread(self.load, ...)`, so a slow conversion no longer occupies a worker thread from the shared default executor for its entire duration; every other loader is unaffected and still goes through `asyncio.to_thread` Source-level tests (regex-match the actual backend source via the `open_webui_backend` fixture) rather than importing `open_webui.retrieval.loaders.main` directly, since that module pulls in a dependency tree (typer, langchain_community, azure.identity, ftfy) not present in this repo's test environment — same approach already used for the knowledge-status tests. One thing worth calling out for review: method-boundary lookaheads in this file use `` \n (?:async\s+)?def\s+\w+ `` rather than `` \n def\s+\w+ ``. `DoclingLoader` interleaves sync and async methods, and a lookahead recognizing only plain `def` runs straight past an `async def` boundary, sweeping a later method's body into the match — I caught this via a false-positive failure on the `load_from_task_id` test itself once the async methods were added after it in the source. **Verified:** all 37 tests pass against the `feat-docling-loader-async` source branch, and all 37 correctly fail against the pristine, pre-rework `dev` source — confirmed by pointing `OPEN_WEBUI_SOURCE_DIR` at each in turn, so these are discriminating regression guards rather than tautologies, not just "assert True". `ruff format` / `ruff check` (line length 100, per this repo's `pyproject.toml`) are clean. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-18 21:09:30 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
open-webui/tests#10
No description provided.