feat(verify_pdf): add --ascii-dates, the non-folding check for the documented date-range rule (#385) (#498)

* feat(verify_pdf): add --ascii-dates, the non-folding check for the documented date-range rule (#385)

05-cv-templates.md records a real Workday import that dropped a role's
end date because `2016--2024` reaches the text layer as 2016<U+2013>2024,
and tells Step 5d to confirm every entry's years are joined by an ASCII
hyphen. Nothing executed that. The natural probe, --contains "2016-2024",
failed identically for "en-dashed" and "absent" before #458 and passes on
both since, because the fold maps the en-dash back to "-" on purpose.

Add --ascii-dates: scan the raw text layer (never the fold) for a year
joined to any Unicode dash or the minus sign and fail naming each hit
with its line and code point. A year on either side of the dash is
enough (Mar 2016 - Jul 2016, 2016 - Present); a numeric range with no
year is not a date. The dump is still written before the check fails.

Wire it in: Step 5d's extraction command carries the flag and the
"Dates recognizable" item points at it, keeping the bare single-year
half as a read-through; the guide's "add this to the step 5d checks"
paragraph names the command (framework_version 1.4.4 -> 1.4.5); the
upstream-only CI assertion runs it on the stock CV.

Demonstrated on the stock template compiled with lualatex through both
extractors: a \cventry{2016--2024} build fails with U+2013 while
--contains "2016-2024" passes on it; the \cventry{2016-2024} build passes
both; the untouched stock CV passes the CI assertion.

Ten new test_verify_pdf.py cases. Proposed by 9scorp4 in Discussion #385.

* fix(verify_pdf): --ascii-dates only joins a year and a dash across horizontal whitespace

`\s*` between the year and the dash also matched a newline, so a heading
ending in an ASCII date ("Heading 1988-1994\n- note") joined the dash
that merely opened the next line and was reported as a U+2013 range; the
mirror shape ("Six Sigma -\n2016 onwards") did the same. Both are real
text-layer shapes: a dash used as a bullet, a wrapped prose line.

Match horizontal whitespace only ([^\S\n]*). Every existing case still
passes; three fixtures pin the two newline shapes and the same-line
spaced dash that must still be caught.

Found in review by yang2632, with the regex and the fixture.
This commit is contained in:
Ayobami Adegoke authored and GitHub committed 2026-09-28 19:06:41 +02:00
1 parent 8cbab6823e
commit a45bbd1a2a
6 files changed
+188 -5

No files matched your search

+21
View File
@@ -15,6 +15,27 @@ per-file diff commands.
### Added
- **`verify_pdf.py --ascii-dates` makes the documented date-range rule executable**
(`tools/verify_pdf.py`, `/apply` Step 5d, `05-cv-templates.md`, CI) - "Date fields must be
ASCII ranges" records a real Workday import that dropped a role's end date because
`2016--2024` reaches the text layer as `2016<U+2013>2024`, and told Step 5d to confirm every
entry's years are joined by an ASCII hyphen. Nothing executed that: the natural probe,
`--contains "2016-2024"`, failed identically for "en-dashed" and "absent" before #458 and
passes on both since, because the fold maps the en-dash back to `-` on purpose. The new flag
reads the raw layer (never the fold), fails on a year joined to any Unicode dash or the
minus sign, and names each hit with its line and code point. A year on either side is
enough (`Mar 2016 – Jul 2016`, `2016 – Present`); a numeric range with no year is not a
date. Step 5d's extraction command now carries the flag (the dump is still written before
the check fails), the "Dates recognizable" checklist item points at it and keeps the bare
single-year half as a read-through, the guide's "add this to the step 5d checks" paragraph
names the command, and the upstream-only CI assertion runs it on the stock CV. Demonstrated
on the stock template: a `\cventry{2016--2024}` build fails with `U+2013`, the
`\cventry{2016-2024}` build passes, and `--contains "2016-2024"` passes on both. Only
horizontal whitespace may sit between the year and the dash, so a year ending one line is
not joined to a dash that opens the next (a bullet, a wrapped prose line) - yang2632's
catch in review, with the regex and fixture. Thirteen new `test_verify_pdf.py` cases.
Proposed by 9scorp4 in Discussion #385.
- **Real Excel workbook integration tests for the salary converter**
(`tests/test_convert_salary_excel_integration.py`, `.github/workflows/ci.yml`) -
generate temporary `.xlsx` files and invoke the documented converter CLI,