Corpus Minimisation Functions

function HPDFMinimizeCorpusCase(const Input: TBytes;
  const Predicate: THPDFFailurePredicate; MaximumAttempts: Integer;
  out AInfo: THPDFCorpusMinimizationInfo): TBytes;

The reducer first removes complete indirect-object spans and then applies progressively smaller byte-range reductions

A candidate is accepted only when the predicate still reports the original failure signature

AInfo reports attempts, accepted reductions, removed object spans, removed byte ranges, original and final sizes and the preserved signature

Continuous corpus storage

function HPDFDefaultCorpusStoreOptions: THPDFCorpusStoreOptions;

function HPDFMinimizeAndStoreCorpusCase(const Input: TBytes;
  const Predicate: THPDFFailurePredicate;
  const CorpusDirectory: string;
  const Options: THPDFCorpusStoreOptions;
  out AInfo: THPDFCorpusCaseInfo): Boolean;

function HPDFCorpusCaseInfoToJSON(
  const AInfo: THPDFCorpusCaseInfo): AnsiString;
type
  THPDFCorpusStoreAction = (csaAdded, csaReplaced, csaKeptExisting);

  THPDFCorpusStoreOptions = record
    MaximumAttempts: Integer;
    MaximumInputBytes: Int64;
    MaximumStoredBytes: Int64;
    LockRetryCount: Integer;
  end;

The store derives a stable case ID from the SHA-256 digest of the failure signature, revalidates any existing case, minimises both the existing and incoming candidates, and keeps the smallest result

A cross-process lock serialises decisions for one corpus directory, whilst write-through temporary files and atomic replacement prevent readers from observing partial PDF or metadata files

THPDFCorpusStoreOptions bounds minimisation attempts, incoming bytes, stored bytes and lock retries, and THPDFCorpusCaseInfo.Action reports whether the case was added, replaced or retained

The sidecar schema hotpdf.corpus.case.v1 records the case ID, exact failure signature, content SHA-256 and stored byte count in stable field order

HPDFCompareRegressionResultsDeterministic compares repeated cross-engine signatures across parse, render, text and save domains and rejects unstable or failed runs