Skip to content

Spec 001 T035: compare - #165

Closed
adamjohnwright wants to merge 2 commits into
mainfrom
t035/compare
Closed

adamjohnwright wants to merge 2 commits into
mainfrom
t035/compare

Conversation

@adamjohnwright

Copy link
Copy Markdown
Contributor

Spec 001, task T035 (FR-012, contracts/cli.md).

What: pdf-export compare <reference> <new> (src/compare/): each side a PDF or a folder (folders compared file by file by name, as the contract says), reduced to FR-012's parts without knowing which program wrote it: the cover (title, diagram, excerpt note, distinct names as a count and a hash), the introduction's release and counts, the analysis properties, each section's parts by their labels in FR-005's order, the contents' entries and targets, the figures' kinds, and short entries. Text is compared after NFKC with white space and never-drawn characters (the cover's U+2060) removed; a reordered list is a difference of kind order; --expected takes recorded differences. Names, the literature and the edit history appear only as counts and hashes, never as text.

Tests: test/compare/compare.test.ts (19) on a hand-built sample with placeholder names, printed by our layout and as a reference in event-pdf's shape; 21 mutants, all caught (tasks.md).

Gaps for T040: event-pdf's real labels are not known here and must be added to the reducer; our analysis part doesn't print its resource, which FR-012 lists.

🤖 Generated with Claude Code

adamjohnwright and others added 2 commits November 4, 2026 04:19
pdf-export compare <reference> <new> [--expected <file>], as contracts/cli.md
has it: each side a PDF or a folder, a folder compared file by file by name.
Both sides are read with pdf.js (lines, links, figures as clusters of images
and painted paths) and reduced to FR-012's parts: the cover's title, diagram,
excerpt note and distinct names (counted and hashed; U+2060 and no-break
spaces normalised); the introduction's release and counts; the analysis's
properties; each section's parts by their labels and their text; the
contents' entries and targets; each figure's kind. The literature and edit
history, which name people, are held as hashes. The JSON report gives each
difference by part, field and kind with a count and stable identifiers, list
order as a kind of its own; no section text and no name is printed.
--expected takes the recorded differences, with their reasons.

Tests print a sample document with pdf-export's layout and as a reference
in event-pdf's shape (placeholder names, wording written anew): each part's
difference is caught, and no name appears in any report. 21 mutants, each
caught.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adamjohnwright

Copy link
Copy Markdown
Contributor Author

Replaced after review: the cover title and analysis values could print text read from the PDF, names included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant