Engineering Journal
Pdf Processor
Pdf Processor

Postmortem: I Shipped Five Algorithm Ports and the User Saw Nothing

2026-07-19

TLDR

Porting five complex backend algorithm families (line clustering, bimodal word gaps, OCR gates) produced zero perceived user value because two high-visibility document features, stacked math display formulas and typographic text alignment (centered footers, justified body), remained broken. Prioritizing extraction features by visual impact rather than reference library availability prevents wasted engineering cycles.
Heuristic Port CategoryEngineering Work ExecutedUser Perceived ImpactPriority Alignment
Backend Line/Word Clustering5 Algorithm Families PortedZero ("No visible difference")Misaligned
Visual Math & AlignmentStacked fractions & container framesHigh ("Document extracts correctly")Correctly Aligned

Retrospective lessons & process changes

  1. Prioritize by Visible Delta: Evaluate target documents visually before porting algorithm libraries, building high-visibility features first.
  2. Audit Native Code Context: Inspect existing adjacent functions (e.g. _inferAlignment) for scope deficiencies before implementing new modules.
  3. Dump Geometry Before Coding: Print raw coordinate data for complex layout features (console.log bounds) to verify mathematical assumptions on paper first.
// Container Frame Union Alignment Analysis
export function calculateBlockAlignment(blockItems, columnContainerFrame) {
  const frameWidth = columnContainerFrame.xMax - columnContainerFrame.xMin;
  const blockLeftMargin = blockItems[0].vx - columnContainerFrame.xMin;
  const blockRightMargin = columnContainerFrame.xMax - (blockItems[0].vx + blockItems[0].vWidth);

// Equal margins within 8px tolerance indicate centered text if (Math.abs(blockLeftMargin - blockRightMargin) < 8) { return 'center'; } return blockLeftMargin > frameWidth * 0.3 ? 'right' : 'left'; }

Rule of thumb: Prioritize algorithm ports by user-visible document layout changes rather than reference library availability.
Read this post in the full Engineering Journal →