Repository navigation
v2.6.0
PDF Craft v2.6.0
PDF Craft 2.6.0 introduces shared retry and error-recovery policies, explicit
missing translations, and task-wide protection against reporting success when
all primary work fell back. It also corrects PDF preview font-size units.
Upgrade note: this release removes public arguments and changes default error
handling. Update callers using the English migration guide
or 中文迁移指南.
Retry and recovery policies
RetryPolicy(translation=3, analysis=3, fill=3)supplies business retry budgets.
Values mean additional attempts after the first; 0 allows one attempt. Analysis
covers TOC/title inference, metadata JSON, footnote repair and JEV requests.
Fill covers XML structure repair. Translation is reserved; no new semantic
translation-quality loop is introduced. LLM transport retries remain separate.ErrorPolicygroups analysis, translation, XML fill, OCR, PDF page-rendering and
PDF writeback failures. Each field accepts a bool or a synchronous/asynchronous
decision callback. The execution'serror_policyalso accepts a bool, callback
orNonedirectly. Defaults are strict: final failures raise unless recovery
is explicitly allowed.- Both Craft façades and composable execution APIs accept policies. Per-call
overrides do not mutate shared translators. Omitted error policies inherit the
instance default; explicitNoneorFalserestores strict behavior. - Removed arguments include component
max_retries,JEV.retry_times, extraction
ignore flags, PDFignore_errors,ignore_translated_error, and
on_fill_failed/FillFailedEvent. The migration guide explains replacements,
including the old XML total-attempt versus new additional-retry distinction.
Explicit recovery and source locations
- Analysis can retain statistical TOC results, native PDF metadata, or the
pre-refinement algorithmic result when permitted. Failed JEV evaluations are
not low scores and do not automatically send every page to LLM repair. - Translation or XML-fill failure leaves no accepted translation for the affected
unit. PCEX coverage distinguishes missing translations from accepted ones;
replacement rendering uses the source, and bilingual rendering shows it once.
EPUB keeps failed source fragments while committing accepted fragments. - Decision callbacks receive detached
FailureContextvalues: structured error
details, failed targets, proposed fallback and affected locations. Paragraphs
retain all cross-page regions. EPUB retains archive/fragment identity and
reliable CFI without requiringon_body; unavailable CFI remainsNone. - Page furniture failures retain page indexes, source boxes, known dimensions and
DPI, including streaming PDF translation and reusable templates. Invalid folio
markers, identities, section counts and empty translated fields now obey the
same error policy instead of silently recovering.
Task completion and PDF previews
- A task whose primary targets all failed and recovered raises
AllFallbackError
even witherror_policy=True. Extraction covers local and vendor OCR; PDF
writeback retains its page-level specialization. Successful metadata or EPUB
headings cannot conceal a wholly untranslated body. Partial success, cache
hits, valid unchanged translations and genuinely absent targets remain distinct. - Cancellation, callback errors, fatal service failures and failed recovery still
propagate. Staged publication protects existing final outputs on failure. - PDF preview font sizes now use Qt logical pixels before conversion to source
OCR coordinates, matching the exported baselines and line positions.
PCEX remains format v4. Content callback payloads and archive compatibility are
unchanged. Related work: #521,
#522, and
#523.
Full Changelog: v2.5.1...v2.6.0