- Add READ_TIMEOUT (5 min) and MAX_OUTPUT_SIZE (100 MB) constants - Implement read_pipe_with_timeout() with watchdog thread protection - Update execute_grep_command() to capture and return both streams - Prevents TH-03 hang scenario by bounding both time and memory Acceptance criteria: ✓ Stdout captured completely ✓ Stderr captured completely ✓ Output buffered without truncation (100 MB limit) ✓ Read operations have timeout protection (5 min timeout) ✓ Both streams captured even if one is empty Verification: notes/bf-3wkpz.md
3.1 KiB
Verification Note for bf-677eo
Task: Run pdftract CLI on degraded fixture
Date: 2026-07-06
What was attempted:
-
Located the degraded fixture:
/home/coding/pdftract/tests/fixtures/scanned/low-quality/degraded-200dpi.pdf(588KB PDF file) -
Verified CLI availability: Found pdftract executables at:
/home/coding/pdftract/target/debug/pdftract/home/coding/pdftract/target/release/pdftract
-
Tested CLI help command:
pdftract extract --helpworks correctly -
Attempted extraction without OCR:
pdftract extract --text /tmp/degraded-200dpi-text.txt --json /tmp/degraded-200dpi.json \ tests/fixtures/scanned/low-quality/degraded-200dpi.pdfResult:
Error: Failed to extract PDF(exit code 1) -
Attempted extraction with OCR flag:
pdftract extract --ocr --text /tmp/degraded-200dpi-text.txt \ tests/fixtures/scanned/low-quality/degraded-200dpi.pdfResult:
Error: --ocr requires the 'ocr' feature to be enabled -
Attempted to build with OCR feature:
cargo build --release --bin pdftract --features ocrResult: Build failed - requires system library
leptonica(pkg-config packageleptnot found)
Acceptance Criteria Status:
| Criterion | Status | Notes |
|---|---|---|
| pdftract CLI executes without errors | ❌ FAIL | CLI help works, but extraction fails on degraded fixture |
| Command completes successfully | ❌ FAIL | Error: Failed to extract PDF even without OCR |
| OCR process runs on the fixture file | ❌ FAIL | OCR feature not compiled in; building requires leptonica system library |
Root Causes:
- OCR feature not enabled: The current pdftract build was compiled without the
--features ocrflag - Missing system dependencies: Building with OCR requires the
leptonicalibrary (pkg-configlept), which is not installed on this system - Extraction failure without OCR: The degraded PDF appears to be a scanned image-only PDF that cannot be extracted without OCR
Existing Workarounds:
The fixture directory already contains OCR output generated by other means:
degraded-200dpi-ocr.txt- OCR output text (with typical OCR errors like "Y ork" vs "York")degraded-200dpi-ground-truth.txt- Source text for comparisoncreate_degraded_200dpi.py- Python script used to create the degraded fixture
Recommendations:
To enable OCR-based extraction on this fixture, one of the following is needed:
- Install leptonica system library (e.g.,
apt-get install libleptonica-dev) - Rebuild pdftract with
--features ocr - Use external OCR tools (e.g., tesseract) directly on the PDF
Files Referenced:
- Fixture:
/home/coding/pdftract/tests/fixtures/scanned/low-quality/degraded-200dpi.pdf - Ground truth:
tests/fixtures/scanned/low-quality/degraded-200dpi-ground-truth.txt - OCR output:
tests/fixtures/scanned/low-quality/degraded-200dpi-ocr.txt
Verification: ❌ BLOCKED
The task cannot be completed successfully due to missing OCR dependencies. The CLI can be invoked, but extraction fails on the degraded fixture.