- Create benches/results/.gitkeep and README.md - Create benches/competitors/run_all.py Python orchestration script - Script runs competitor benchmarks (pdftract, pdfminer.six, pypdf, pdfplumber) - Emits benches/results/<commit-sha>.json with throughput metrics - Add tier4-competitor-runner to pdftract-ci Argo WorkflowTemplate - Runs only on main branch to track performance over time - Acceptance criteria: ratio_pdfminer ≥ 10.0, ratio_pypdf ≥ 5.0 Closes bf-2f5ew Files created: - benches/results/.gitkeep - benches/results/README.md - benches/competitors/run_all.py - notes/bf-2f5ew.md Files modified: - .ci/argo-workflows/pdftract-ci.yaml
3.5 KiB
3.5 KiB
Bead Verification: bf-56jda
Task
Create test file structure for encryption error tests
Completed Work
1. Created comprehensive test file
- File:
/home/coding/pdftract/crates/pdftract-cli/tests/test_encryption_errors.rs - Size: ~400 lines of well-structured test code
2. Test Structure Organization
The test file is organized into 5 main modules:
unsupported_handlers- Tests for unsupported encryption handlers (e.g., Adobe.APS)supported_encryption- Tests for PDFs with supported encryption (RC4, AES-128, AES-256) when correct passwords are providedpassword_errors- Tests for wrong/missing password scenariosfixture_validation- Validates the encrypted test fixtures exist and are valid PDFsintegration_tests- Placeholder for future integration tests
3. Helper Functions
Created reusable helper functions:
workspace_root()- Gets workspace root directoryencrypted_fixture_dir()- Gets encrypted fixtures directory pathencrypted_fixture(name)- Gets path to specific encrypted fixturepdftract_bin()- Gets path to pdftract CLI binary
4. Test Coverage
The test file covers:
- Livecycle PDF (unsupported Adobe.APS handler) → ENCRYPTION_UNSUPPORTED error
- RC4-encrypted PDF (EC-04-rc4-encrypted.pdf) → Password-based decryption
- AES-128-encrypted PDF (EC-05-aes128-encrypted.pdf) → Password-based decryption
- AES-256-encrypted PDF (EC-06-aes256-encrypted.pdf) → Password-based decryption
- Empty-password PDF (EC-empty-password.pdf) → Auto-open detection
5. Test Compilation Verification
cargo test --test test_encryption_errors
Result: ✅ PASS - 3 passed; 0 failed; 10 ignored; 0 measured
The fixture validation tests pass immediately. The other tests are marked with #[ignore] and appropriate reasons, waiting for implementation of:
- ENCRYPTION_UNSUPPORTED exit code (3) implementation
- Password-based decryption implementation
- Empty password handling implementation
References
- Parent bead: bf-19bx2
- Plan line 258, Failure Mode Taxonomy: ENCRYPTION_UNSUPPORTED
- Plan line 732: Encryption-unsupported diagnostic and CLI exit code 3
- Plan line 1132: RC4 and AES-128/256 decryption implementation
- Plan line 1149: Encrypted file with unknown handler error handling
Acceptance Criteria Status
- ✅ Test file exists in appropriate location (
crates/pdftract-cli/tests/test_encryption_errors.rs) - ✅ Module compiles with
cargo test(verified with actual test run) - ✅ Basic test structure is in place (5 modules with clear documentation)
Git Commit
git add crates/pdftract-cli/tests/test_encryption_errors.rs notes/bf-56jda.md
git commit -m "test(bf-56jda): create encryption error test structure
- Added comprehensive test file for encryption error cases
- Organized tests into 5 modules: unsupported_handlers, supported_encryption, password_errors, fixture_validation, integration_tests
- Created helper functions for workspace paths and fixture management
- Added fixture validation tests that pass immediately
- Marked implementation-dependent tests with #[ignore] and clear reasons
- References plan lines 258, 732, 1132, 1149 for ENCRYPTION_UNSUPPORTED handling
Closes bf-56jda"
Notes
The test structure is ready to be used as the implementation progresses. Each test has clear documentation about what it expects and what needs to be implemented. The fixture validation tests provide immediate value by ensuring the test fixtures are present and valid PDFs.