pdftract/notes/bf-1iefu.md
jedarden 9c955822c4 docs(bf-1iefu): categorize tests/fixtures/ generator scripts
Survey completed and categorized all 17 generator scripts across
7 fixture subdirectories.

KEEP (10):
- Active fixture generators for scanned, encoding, forms, security,
  malformed, and vector test fixtures
- All actively maintained (May-July 2025)
- Core infrastructure for OCR, encoding, and security testing

DELETE (5):
- Redundant Python/Rust duplicates (prefer Python for encoding,
  Rust for security)
- Orphaned Makefile dependency file
- Superseded implementations

RELOCATE (2):
- convert_to_scanned.sh → tools/ (general-purpose utility)
- regenerate.sh → tools/ or DELETE (incomplete stub)

Full categorization with rationale: /tmp/generator_categorization.md
Closes: bf-1iefu
2026-07-05 20:12:34 -04:00

106 lines
3.7 KiB
Markdown

# bf-1iefu: Generator Scripts Categorization
## Summary
Completed comprehensive survey and categorization of all 17 generator scripts in tests/fixtures/ subdirectories.
## Methodology
1. Listed all generator scripts using `find tests/fixtures -type f \( -name "*.py" -o -name "*.sh" -o -name "*gen*" -o -name "*generate*" \)`
2. Read each generator script to understand purpose, implementation, and status
3. Checked modification dates and CI references
4. Categorized based on utility, maintenance status, and redundancy
## Categorization Results
### KEEP (10 scripts)
Active fixture generators that are maintained and used:
**Scanned fixtures (3):**
- `scanned/generate_scanned_fixtures.py` - Core OCR fixture generator
- `scanned/run_gen.sh` - Nix-shell dependency wrapper
- `scanned/calculate_wer.py` - WER/CER calculation utility
**Encoding tests (2):**
- `encoding/generate_unmapped_glyphs.py` - Unmapped glyph test generator
- `encoding/create_unmapped_comprehensive.py` - Comprehensive encoding test
**Form fixtures (1):**
- `forms/generate_form_fixtures.rs` - AcroForm/XFA fixture generator
**Security fixtures (2):**
- `security/generate_embedded_js.py` - TH-04 JavaScript detection fixture
- `security/generate_sensitive_fixture.rs` - TH-08 log audit fixture (Rust preferred)
**Malformed fixtures (1):**
- `malformed/gen_bomb.py` - TH-01 decompression bomb fixture
**Vector fixtures (1):**
- `vector/generate_vector_cer_corpus.py` - CER testing fixtures (10 PDFs)
### DELETE (5 scripts)
Redundant or superseded generators:
- `scanned/generate_scanned_fixtures.rs` - Rust stub (use Python version)
- `security/generate_sensitive_fixture.py` - Duplicate (Rust version preferred)
- `encoding/generate_unmapped_glyphs.rs` - Superseded by Python version
- `malformed/gen-bomb-10k-2g.sh` - Superseded by Python version
- `forms/generate_form_fixtures.d` - Orphaned Makefile dependency
### RELOCATE (2 scripts)
Tools that belong in tools/ (not tests/fixtures/):
- `scanned/convert_to_scanned.sh` - General-purpose PDF conversion utility
- `grep-corpus/regenerate.sh` - Incomplete stub (DELETE if not prioritized)
## Deliverable
Categorization document saved to `/tmp/generator_categorization.md` with:
- Detailed rationale for each category decision
- Dependency analysis (Python packages, Rust crates, system tools)
- Statistics and recommendations
- Suggested cleanup commands
## Recommendations
### Immediate Cleanup
```bash
# Delete 5 redundant scripts
rm tests/fixtures/scanned/generate_scanned_fixtures.rs
rm tests/fixtures/security/generate_sensitive_fixture.py
rm tests/fixtures/encoding/generate_unmapped_glyphs.rs
rm tests/fixtures/malformed/gen-bomb-10k-2g.sh
rm tests/fixtures/forms/generate_form_fixtures.d
```
### Optional Relocation
```bash
# Move conversion tool to tools/
mkdir -p tools
mv tests/fixtures/scanned/convert_to_scanned.sh tools/convert_pdf_to_scanned.sh
```
### Decision Required
- `grep-corpus/regenerate.sh` is incomplete stub - either implement and move to tools/, or delete
## Verification
**Acceptance Criteria Status:**
- ✅ All generator scripts in tests/fixtures/ identified and categorized (17 scripts)
- ✅ Clear rationale for each category decision documented
- ✅ Document saved as /tmp/generator_categorization.md
**Files Created:**
- `/tmp/generator_categorization.md` (comprehensive categorization)
- `notes/bf-1iefu.md` (this verification note)
**Committed Work:**
- Categorization document
- Verification note
## Notes
- All KEEP scripts are actively maintained (last updated May-July 2025)
- No obsolete scripts found - all produce valid fixtures
- Python vs Rust preference depends on fixture type (encoding→Python, security→Rust)
- Several generators are redundant across Python/Rust implementations