Commit graph

11 commits

Author SHA1 Message Date
jedarden
34c6a3719d feat(bf-2ypn2): add Phase 7 profiles exit gate fixtures
Create test fixture directories and integration tests for Phase 7 profile
validation exit gate:

Invalid profiles (tests/fixtures/profiles/invalid/):
- unknown-key.yaml: unrecognized extraction tuning key
- bad-combinator.yaml: malformed match combinators (scalar not list)
- secret-key.yaml: forbidden api_key (PROFILE_SECRETS_FORBIDDEN)
- malformed.yaml: unclosed bracket (YAML syntax error)

Valid profiles (tests/fixtures/profiles/valid/):
- minimal.yaml: smallest valid profile (name, description, priority only)
- invoice-minimal.yaml: simplified invoice with match and extraction

Resolution fixtures (tests/fixtures/profiles/resolution/):
- custom-invoice.yaml: priority 100 overrides built-in (priority 50)
- README.md: documents resolution priority order

Integration tests (tests/integration/advanced/profiles.rs):
- test_invalid_profiles_rejected: validates all 4 invalid profiles fail
- test_valid_profiles_accepted: validates all 2 valid profiles pass
- test_profile_resolution_order: tests --profile-dir override behavior
- test_invalid_fixture_error_types: validates specific error messages

Acceptance criteria:
✓ pdftract profiles validate rejects all 4 invalid files
✓ pdftract profiles validate accepts all 2 valid files
✓ Profile resolution order test passes

Closes bf-2ypn2
2026-07-04 23:56:32 -04:00
jedarden
4f1c03b996 fix(bf-84xr8): fix unmapped glyph PDF encoding format
- Fix /Differences array construction in generate_unmapped_glyphs.py
- Changed from '[code glyph code glyph ...]' to '[starting_code glyph1 glyph2 ...]' format
- All 7 unmapped glyphs from design spec now properly encoded without ToUnicode CMap
- Fixture validation passes: no ToUnicode, correct encoding format, all glyphs present

Closes bf-84xr8. Verification: notes/bf-84xr8.md
2026-07-03 19:32:41 -04:00
jedarden
882196a23c feat(bf-3cwge): add unmapped glyph generator script
- Implement parameterized generator for unmapped glyph PDF fixtures
- Support custom glyph names via --glyphs JSON parameter
- Support custom font titles via --title parameter
- Include built-in test set matching design specification (notes/bf-68f9i-design.md)
- Generate valid PDF 1.4 with Type1 custom encoding
- Passes all acceptance criteria:
  * Script exists in tests/fixtures/encoding/
  * Accepts parameters for glyph names and encoding
  * Generates valid PDF with specified structure
  * Tested with dry runs (default and custom glyphs)
  * Committed to git

Closes bf-3cwge
2026-07-03 19:28:17 -04:00
jedarden
7788719e0a docs(bf-ad2pp): analyze unmapped glyph fixture requirements
- Read design documents notes/bf-68f9i-design.md and notes/bf-68f9i-glyphs.md
- Identified 7 unmapped glyphs across 4 failure categories
- Identified 3 mapped AGL glyphs for comparison
- Verified existing generator implementation (gen_unmapped_comprehensive.rs)
- Confirmed fixture files exist and are correctly structured
- Documented implementation analysis in notes/bf-ad2pp.md

Closes bf-ad2pp
2026-07-03 19:17:02 -04:00
jedarden
0ea2ae7b5c docs(bf-54x8x): document no-mapping.pdf fixture structure and regeneration 2026-07-03 18:36:07 -04:00
jedarden
3ff4d1828f docs(bf-68f9i): document selected unmapped glyphs for test fixture
Created comprehensive glyph selection document for unmapped glyph test fixture.
Selected 4 unmapped glyph examples:
- PUA glyphs: /g001, /g002, /g003
- Custom encoding: /CustomA, /CustomB
- Orphaned codes: /NotAGlyph
- Non-AGL algorithmic: /glyph_0041

Selected 4 mapped AGL glyphs for comparison:
- /A, /B, /space (direct AGL entries)
- /uni0041 (algorithmic pattern)

Explained why each unmapped glyph fails all 4 mapping levels and provided
recommended fixture structure with expected output.

Closes bf-68f9i
2026-07-03 17:52:13 -04:00
jedarden
6c668c7e42 docs(bf-ttbb5): document no-mapping.pdf generation verification
Successfully executed generate_unicode_recovery_fixtures_bin to create
no-mapping.pdf fixture (650 bytes). Validated PDF structure includes
custom /CustomNoMap font with /Differences encoding, non-AGL glyph
names, and no ToUnicode entry. Ground truth contains U+FFFD × 3.

Closes bf-ttbb5.
2026-07-03 16:13:27 -04:00
jedarden
990d73acf1 fix(bf-f0xqd): correct no-mapping.pdf ground truth to U+FFFD
The no-mapping.pdf fixture uses custom glyph names (/g001, /g002, /g003)
that are not in the Adobe Glyph List and cannot be recovered through any
Unicode recovery mechanism (no ToUnicode CMap, no standard encoding,
no AGL match).

The ground truth has been corrected from 'ABC' to three U+FFFD replacement
characters (���), which is the expected output when all encoding recovery
methods fail per the Failure Mode Taxonomy.

Also updated PROVENANCE.md with new SHA256 hashes for encoding fixtures
that were regenerated on 2026-07-02.

This fixture correctly exercises the ENCODING_NO_MAPPING failure mode as
specified in the plan (line 733).

Closes bf-f0xqd.
2026-07-03 15:55:29 -04:00
jedarden
16d0f702c0 docs(bf-5pyzm): verify tagged PDF fixtures are complete and documented
Add verification note documenting:
- All 4 tagged PDF fixtures (UA-simple, UA-table, A-2a, MCID-ordering)
- SHA256 checksums for all fixture files
- Expected JSON structure_tree outputs
- Generator script and binary
- PROVENANCE.md documentation status

Acceptance criteria:
- PASS: fixtures/tagged/ contains 4 tagged PDFs with expected.json files
- WARN: pdftract extract --json structure_tree output (Phase 7.1 implementation pending)

Fixtures ready for Phase 7.1 StructTree extraction integration.
Closes bf-5pyzm
2026-07-03 15:06:48 -04:00
jedarden
b115b5a677 fix(bf-512z1): fix encoding fixture ground truth and add provenance
- no-mapping.txt: fix garbled unicode to correct 'ABC' output
- shape-match.txt: fix from 'Shape' to 'S' (actual PDF content)
- Add PROVENANCE.md entries for all 4 encoding fixtures
- PDFs remain unchanged (already valid)

Fixes ground truth for Level 2-4 Unicode recovery fixtures:
- no-mapping.pdf: PDF with no ToUnicode, no standard encoding
- agl-only.pdf: PDF with AGL glyph names only
- fingerprint-match.pdf: PDF with embedded font for fingerprint matching
- shape-match.pdf: PDF with subset font for shape recognition

Closes bf-512z1
2026-06-09 01:13:51 -04:00
jedarden
d0f52751ce fix(pdftract-39gey): fix indent trigger to not split drop-cap paragraphs
The indent trigger was using .abs() which fired on both increased indent
(non-indented → indented) AND decreased indent (indented → non-indented).
This caused drop-cap style paragraphs (indented first line, flush-left
continuation) to incorrectly split into two blocks.

Per plan Phase 4.4 heuristic #2, indent change should only trigger when the
current line is MORE indented (to the right, larger x0) than the block
average - i.e., a new paragraph starting after non-indented text. It should
NOT trigger for decreased indent (first line indented, rest flush-left).

Fix: Remove .abs() and only check if line_x0 - block_avg_x0 > threshold.

Tests:
- test_indented_first_line_new_block: PASS (non-indented → indented splits)
- test_indented_first_line_of_paragraph_not_split: PASS (drop cap stays together)
- All 179 line module tests: PASS
2026-06-07 13:43:19 -04:00