test: add source-audit tests for the async DoclingLoader rework - #8
Draft
jannefleischer wants to merge 1 commit into
Draft
test: add source-audit tests for the async DoclingLoader rework#8jannefleischer wants to merge 1 commit into
jannefleischer wants to merge 1 commit into
Conversation
Open
13 tasks
jannefleischer
force-pushed
the
feat-docling-loader-async
branch
from
July 30, 2026 11:46
95f14b7 to
26e12d3
Compare
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.
Method-boundary lookaheads 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 (caught this via a false-positive failure on
load_from_task_id's own test once async methods were added after it).
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, confirming they're discriminating regression
guards rather than tautologies.
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.
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 open-webui/open-webui#26947 (which is part of discussion in open-webui/open-webui#26931)
Covers the DoclingLoader rework that replaces the old blocking
/v1/convert/filecall 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:DOCLING_SERVE_TIMEOUT), wired end-to-end fromconfig.pythroughLOADER_CONFIG_KEYS/RETRIEVAL_CONFIG_KEYS,ConfigForm, andupdate_rag_configstatus_callbackhook invoked on submit and ontask_positionupdates while polling, on both pathsload_from_task_id()/aload_from_task_id()to resume an already-submitted task without re-uploading_notify_status_async(): the async path awaitsstatus_callback's return value if it's awaitable, since a real caller may reasonably supply anasync defcallback (e.g. one that awaits a DB write) — calling it as a plain function would silently produce an un-awaited coroutine that never runsLoader.aload()'s dispatch now routesDoclingLoaderthrough its true asyncaload()directly instead ofasyncio.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 throughasyncio.to_threadSource-level tests (regex-match the actual backend source via the
open_webui_backendfixture) rather than importingopen_webui.retrieval.loaders.maindirectly, 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+.DoclingLoaderinterleaves sync and async methods, and a lookahead recognizing only plaindefruns straight past anasync defboundary, sweeping a later method's body into the match — I caught this via a false-positive failure on theload_from_task_idtest itself once the async methods were added after it in the source.Verified: all 37 tests pass against the
feat-docling-loader-asyncsource branch, and all 37 correctly fail against the pristine, pre-reworkdevsource — confirmed by pointingOPEN_WEBUI_SOURCE_DIRat 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'spyproject.toml) are clean.