Skip to content

Compare mode: convert office/text documents like the folder-scan path does - #60

Merged
valandi merged 2 commits into
mainfrom
fix/compare-mode-document-conversion
Oct 28, 2026
Merged

valandi merged 2 commits into
mainfrom
fix/compare-mode-document-conversion

Conversation

@valandi

@valandi valandi commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

Problem

"Compare two documents" (GUI toggle, -doc1/-doc2) rejected every input that wasn't an image or PDF:

Comparing Doc 1 (baseline): IEM quote export sample 1 (1).docx
Error: Unsupported file type for comparison: ... (only images and PDFs are supported)

CompareRunner had its own image/PDF-only buildTests() and never consulted the ConversionRegistry that Suite uses for normal runs, so a .docx was rejected by extension before LibreOffice was ever looked for — installing LibreOffice changed nothing. The same file worked fine in a normal -f run.

Fix

  • New PdfConversion owns the default converter registry and the convert-to-temp-PDF step. Suite.tryConvert() and CompareRunner both go through it so the two paths can't drift apart again.
  • CompareRunner converts doc1/doc2 up front; the precheck, page-range validation and test objects all see the converted PDF, while test names still report the original filename (via PdfFileTest's source argument). Works with -ss split-steps too.
  • A document that can't be converted fails the compare run with the reason (compare mode has nothing to skip to). LibreOffice missing appends the install hint, now a shared constant also used by the CLI skip summary.
  • Truly unsupported extensions (.zip etc.) still fail, with a message that lists the convertible formats.
  • README compare section + CHANGELOG (Unreleased) updated.

Tests

CompareRunnerTest — 3 new: TXT→PDF conversion in compare mode (no LibreOffice needed), same with split-steps, and LibreOffice-missing via an injected registry failing before any Eyes call with the install hint. The old ".txt is unsupported" test now uses .zip.

Full suite: 653 tests, 0 failures.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PsLo6sSNLARaybn6YaHpaT

valandi and others added 2 commits October 28, 2026 16:53
… does

"Compare two documents" (GUI toggle, -doc1/-doc2) rejected every input that
wasn't an image or PDF with "Unsupported file type for comparison ... (only
images and PDFs are supported)". CompareRunner had its own image/PDF-only
buildTests() and never consulted the ConversionRegistry that Suite uses, so
a .docx failed by extension before LibreOffice was ever looked for -
installing it changed nothing.

- New PdfConversion holds the default registry and the convert-to-temp-PDF
  step; Suite.tryConvert and CompareRunner both use it so the two paths
  can't drift apart again.
- CompareRunner converts doc1/doc2 up front; precheck, page-range
  validation and the test objects see the converted PDF, while test names
  still report the original file (PdfFileTest's source argument).
- A document that can't be converted fails the compare run with the
  reason. When the reason is a missing LibreOffice the install hint is
  appended (now a shared constant used by the CLI skip summary too).
- Unsupported extensions (e.g. .zip) still fail, with a message listing
  the convertible formats.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PsLo6sSNLARaybn6YaHpaT
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PsLo6sSNLARaybn6YaHpaT
@valandi
valandi merged commit 5a0d8ce into main Oct 28, 2026
13 of 14 checks passed
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