WeKnora/docreader/tests
lyingbug 1bf717a54d
feat(chat): open cited documents at the cited passage (#3700)
* feat(chat): open cited documents at the cited passage

Clicking a citation used to show only the parsed chunk. It now opens the
original file in the references panel, jumps to the cited place and
highlights it, narrowed to the sentence the citation supports.

Parsing records where each chunk sits in the original file
(chunks.source_locators): PDF page and paragraph boxes from the docreader,
MinerU and PaddleOCR-VL layouts; Word paragraphs, slides, sheet rows and
EPUB chapters aligned in Go against any parser engine's Markdown; text
offsets for Markdown/TXT; segment times for audio. Pipeline text rewrites
are followed with a line-diff remapper. Scanned PDF pages get their OCR
text as quotes at search time so a sentence can pick its page.

The frontend renders PDFs with pdf.js and every other previewable type
with the existing preview, then highlights with the CSS Custom Highlight
API in a highlighter yellow that stays visible against the brand green.

* fix(docreader): serialize source blocks outside main so tests import it

test_docx_tables stubs docreader.parser in sys.modules, so importing
docreader.main from a later test failed in the full unittest discover run.
The wire conversion now lives in docreader.source_wire, which needs only
the proto.

* fix(chat): tighten source locators from review

- Remap rewritten-line-for-line stretches by line so scanned PDF pages
  no longer drift onto the wrong page.
- Keep the source preview mounted for citations in the file already open.
- Wait for in-flight PDF page renders before looking for the text layer.
- Count image rune offsets in one pass; stream xlsx rows up to maxUnits.
- Start text locators after a UTF-8 BOM, as viewers decode without it.
- Only re-query image children for scanned-page results.
- Seek audio citations without autoplay and drop stale seek listeners.
- Fix the SQLite migration's cross-reference to versioned/000113.

* fix(migrations): renumber chunk source locators after main's chunk_images

main took versioned 000113 and sqlite 000032 for chunk_images, so the
source_locators column moves to versioned 000114 and sqlite 000033.
2026-09-25 13:26:16 +08:00
..
fixtures fix(docreader): preserve vertically merged table cells (#2657) 2026-08-12 10:59:49 +08:00
test_config.py test(docreader): align pdf JPEG quality default assertion 2026-06-17 17:18:57 +08:00
test_docx_merge.py fix(docreader): preserve vertically merged table cells (#2657) 2026-08-12 10:59:49 +08:00
test_docx_tables.py fix(docreader): keep DOCX table content in parsed text (#2898) 2026-08-31 17:56:17 +08:00
test_endecode.py fix(docreader): stop a non-ASCII base64 payload from failing the whole parse 2026-09-22 19:37:21 +08:00
test_epub_parser.py feat: add EPUB and MHTML document support 2026-06-16 11:25:27 +08:00
test_excel_parser.py feat(chat): open cited documents at the cited passage (#3700) 2026-09-25 13:26:16 +08:00
test_html_parser.py fix(knowledge): support local HTML uploads 2026-07-29 20:11:17 +08:00
test_markdown_table_util.py fix: stop markdown table regex catastrophic backtracking (#2770) 2026-08-24 18:08:07 +08:00
test_mhtml_parser.py fix(docreader): handle Header object when stripping mhtml header (#2902) 2026-08-31 17:14:58 +08:00
test_opendataloader_parser.py fix(security): harden outbound URL SSRF protection (#2626) 2026-08-10 13:24:14 +08:00
test_parser_concurrency.py fix(docreader): throttle heavy parser concurrency 2026-05-07 17:36:09 +08:00
test_parser_routing.py fix(parser): default ppt/pptx to markitdown when no engine rules (#2882) 2026-08-31 14:58:15 +08:00
test_pdf_embedded_images.py fix(docreader): keep pdfium bitmap alive while copying SMask pixels 2026-08-24 14:41:54 +08:00
test_pdf_router.py feat(docreader): support forcing PDF scanned-page OCR parsing 2026-06-25 17:30:22 +08:00
test_ppt_convert.py ci: add app frontend and docreader checks 2026-07-30 14:13:15 +08:00
test_sandbox_executor.py fix(docreader): kill timed-out converter process groups (#2990) 2026-09-23 12:02:53 +08:00
test_source_locator.py feat(chat): open cited documents at the cited passage (#3700) 2026-09-25 13:26:16 +08:00
test_ssrf.py feat(security): add a whitelist-only outbound mode that refuses before DNS (#3393) 2026-09-23 12:02:06 +08:00
test_ssrf_proxy.py fix: align client sessions and integration request handling (#3305) 2026-09-16 16:20:57 +08:00
test_tempfile_context.py fix: remove temp file when TempFileContext write fails inside __enter__ (#3495) 2026-09-21 14:21:07 +08:00
test_web_parser.py fix(docreader): fail URL scrape instead of indexing error text (#2883) 2026-08-31 14:12:11 +08:00
test_xmind_parser.py feat(docreader): add XMind outline parsing (#2713) 2026-08-20 19:49:48 +08:00