Test Cases

Ingestion

TC-I01: Single image file - Input: archive/batch_001/page_001.tif - Expected: canonical JSON with source.batch_id = "batch_001", source.page_number = 1, source.input_type = "image"

TC-I02: PDF document - Input: 3-page PDF - Expected: 3 canonical JSON files, page numbers 1–3, same batch_id

TC-I03: Nested folder structure - Input: archive/1898/ledger/, archive/1898/letters/ - Expected: batch_ids preserve folder hierarchy

TC-I04: Unsupported format - Input: archive/unrelated/readme.txt - Expected: skipped, warning logged

Quality Assessment

TC-Q01: Clean scan - Input: 300 DPI sharp text page - Expected: quality_level = "good", no issues flagged

TC-Q02: Blurred scan - Input: synthetically blurred image - Expected: blur_detected = true, quality_level downgraded

TC-Q03: Blank page - Input: empty page (low variance) - Expected: blank_page = true, needs_review = true

TC-Q04: Skewed scan - Input: image rotated 5 degrees - Expected: rotation_detected = true, rotation angle recorded

OCR

TC-OCR01: Printed book page - Input: clean 300 DPI printed page - Expected: CER below 2%, reading order correct

TC-OCR02: Handwritten letter - Input: cursive handwriting, moderate quality - Expected: text extracted, confidence scores present, CER below target threshold

TC-OCR03: Ledger with table - Input: page with numeric columns - Expected: table detected, columns preserved, monetary amounts extracted

Classification

TC-C01: Meeting minutes - Input: paragraphs with "meeting", "motion", "vote" terms, date header - Expected: document_type = "meeting_minutes", confidence > 0.7

TC-C02: Ledger - Input: numeric columns, currency symbols, row structure - Expected: document_type = "ledger", confidence > 0.7

TC-C03: Unknown/ambiguous - Input: mixed content, no clear signals - Expected: falls back to VLM classification or unknown

Quality Validation

TC-QV01: Good OCR - Input: high confidence scores, coherent text, good image quality - Expected: safe_for_rag = true, needs_review = false

TC-QV02: Poor OCR - Input: low confidence, gibberish text, poor image quality - Expected: safe_for_rag = false, needs_review = true

TC-QV03: Borderline - Input: mixed signals (good image, low OCR confidence) - Expected: needs_review = true, human decision required

Semantic Chunking

TC-SC01: Book page paragraph chunks - Input: 3-paragraph book page - Expected: 3 chunks, each containing one paragraph, chunk boundaries at paragraph breaks

TC-SC02: Letter header/body/signature - Input: letter with date, salutation, body, signature - Expected: at least 3 chunks — header chunk, body chunk(s), signature chunk

TC-SC03: Ledger row chunks - Input: ledger page with 20 rows - Expected: chunks preserve row integrity, no chunk splits a row

TC-R01: Simple factual query - Query: "What was discussed at the 1898 town meeting?" - Expected: answer cites meeting minutes from 1898, page numbers included

TC-R02: Filtered query - Query: "Find church records mentioning marriages in 1898" - Expected: results filtered to church records, date range 1898

TC-R03: Query with no results - Query: "What is the airspeed velocity of an unladen swallow?" - Expected: no relevant chunks found, LLM should indicate no archival information available

TC-R04: Citation verification - Query: any - Expected: every factual claim in the answer is backed by a source citation with document path and page number