shouldSpill function

bool shouldSpill(
  1. String text,
  2. SpillsConfig config
)

True when text spills: longer than the threshold and not empty/whitespace (issue #678 AC1 boundary both sides, AC2 empty never spills). Pure function.

Implementation

bool shouldSpill(String text, SpillsConfig config) {
  // Kill-switch / zero threshold = legacy: nothing ever spills (AC1).
  if (!config.isActive) return false;
  // Empty / whitespace-only results never spill (AC2).
  if (text.trim().isEmpty) return false;
  return text.length > config.threshold;
}