#118·Crucix

Avoid using substring check on headline

Author: myths-zeroCreated May 30, 2026Updated May 30, 2026

When checking headlines we currently use a substring match which incorrectly flags lines and causes truncation or partial-match behavior. Example lines that should not match but do:

• ⚡️— NEW: US MUNITIONS STOCKPILE WON’T RECOVER FOR YEARS AFTER IRAN WAR - • ❗️China is building an extensive network of launch pads, bunkers, and commun

https://github.com/calesthio/Crucix/blob/3db7068817e0c815df353fa0f19657c85142789d/server.mjs#L122

Expected behavior:

  • Headline filtering should not rely on simple substring checks that can produce false positives on longer headlines or emojis.
  • Only exact matches or appropriate tokenized/word-boundary checks should trigger the condition.
  • Preserve full headline text when no true match is found.

Suggested fix:

  • Replace substring check with a stricter test (e.g., regex with word boundaries or equality on normalized tokens).
  • Normalize text before comparing (trim, collapse whitespace, remove trailing punctuation) and consider Unicode-aware matching to handle emoji and punctuation.
  • Add unit tests covering examples above and similar emoji/punctuation cases.

Steps to reproduce:

  • Trigger brief command.
  • Feed or log the example headline lines.
  • Observe that the code path at line 122 treats them as matches and truncates or alters the headline.