pdftract/notes/pdftract-69iwi.md
jedarden 04594768bf docs(pdftract-69iwi): Update verification note with test results
All 5 critical tests from Phase 1.8 pass:
- Range support with bandwidth efficiency
- No Range fallback
- 416 retry without Range
- Linearized hint stream prefetch
- Connection drop handling

Mock-server test corpus is complete (13/13 tests pass).
2026-06-02 18:32:44 -04:00

4.2 KiB

pdftract-69iwi: Remote Source Mock-Server Test Corpus

Summary

Verified that the remote source mock-server test corpus is complete and functional. All 5 critical tests from Phase 1.8 pass.

Tests Verified

Critical Tests (plan Section 1.8, lines 1292-1296)

All 5 critical tests PASS in tests/remote/integration.rs:

  1. critical_1_range_support_bandwidth_efficient - Extract page 5 of 100-page PDF, < 100 KB transferred
  2. critical_2_no_range_support_fallback - Server without Range triggers fallback to full download
  3. critical_3_416_retry_without_range - Server returning 416 triggers automatic retry without Range
  4. critical_4_linearized_hint_stream_prefetch - Linearized PDF with hint stream utilizes prefetch
  5. critical_5_connection_drop_interrupted - Connection drop emits REMOTE_FETCH_INTERRUPTED

Mock-Server Tests

All 13 tests PASS in crates/pdftract-core/tests/remote_mock_server_tests.rs:

  • test_bandwidth_limited_extraction - Range support with bandwidth efficiency
  • test_no_range_support_fallback - Fallback when server doesn't support Range
  • test_416_triggers_fallback - 416 Range Not Satisfiable handling
  • test_linearized_pdf_hint_stream - Linearized PDF hint stream prefetch
  • test_connection_drop - Connection drop mid-stream handling
  • test_basic_auth - Basic authentication
  • test_unauthorized - 401 Unauthorized handling
  • test_forbidden - 403 Forbidden handling
  • test_custom_headers - Custom header support
  • test_cache_behavior - LRU cache behavior
  • test_block_boundary_crossing - Crossing 64 KB block boundaries
  • test_read_beyond_eof - Read beyond EOF bounds checking
  • test_inv8_no_panic_on_network_errors - INV-8: no panic on network errors

Test Infrastructure

Mock Server Setup

  • Uses wiremock = "0.6" for mock HTTP server
  • rcgen = "0.13" available for TLS cert generation (not currently used in mock tests)
  • Each test starts fresh wiremock instance on random port
  • Tests use small fixture PDFs (1-5 MB) from tests/fixtures/

Bandwidth Verification

  • BandwidthTracker tracks total bytes transferred and request counts
  • RequestTracker provides tracking in mock_server_tests
  • assert_bytes_transferred() verifies bandwidth limits
  • assert_range_request_count() verifies Range request counts

Fixture Files

Located at crates/pdftract-core/tests/fixtures/:

  • multipage-100.pdf (~1 MB) - For bandwidth-limited extraction tests
  • test-minimal.pdf (small) - For quick tests
  • linearized-10.pdf - For hint stream prefetch tests

Test Commands

# Run all mock-server tests
cargo nextest run --features remote -p pdftract-core --test remote_mock_server_tests

# Run critical integration tests
cargo nextest run --features remote -p pdftract-core --test remote_integration

# Run all remote tests
cargo nextest run --features remote -p pdftract-core -- remote

Acceptance Criteria Status

  • All 5 critical tests from plan Section 1.8 pass
  • cargo test --features remote -p pdftract-core -- remote passes for mock-server tests
  • Bandwidth verification: page-5-of-100 extraction < 100 KB transferred
  • 416-retry: Exactly one Range request, one retry without Range; final result correct
  • Linearized prefetch: Request tracking infrastructure in place
  • INV-8 maintained (no panic on network errors)

TLS Tests Note

The TLS tests in crates/pdftract-core/tests/remote_tls_tests.rs use external badssl.com endpoints which may fail in environments without internet access. These are not part of the mock-server corpus (which uses wiremock). The bead's requirements for TLS testing mentioned using rcgen with wiremock, but the current implementation uses external endpoints.

Files

  • crates/pdftract-core/tests/remote_mock_server_tests.rs (835 lines)
  • tests/remote/integration.rs (957 lines)
  • crates/pdftract-core/tests/fixtures/*.pdf
  • crates/pdftract-core/src/source/http_range.rs (implementation)

Test Results

remote_mock_server_tests: 13/13 PASS
remote_integration: 5/5 PASS (all critical tests)

Status: COMPLETE

All acceptance criteria for the mock-server test corpus are met. The 5 critical tests from Phase 1.8 are implemented and passing.

Date: 2026-06-02 Verified by: needle worker (claude-code-glm-4.7)