Skip to content

fix(keyword-matcher): fold letter O into digit 0 for numeric trigger keywords - #62

Merged
diwenne merged 2 commits into
mainfrom
fix/numeric-keyword-o-zero-homoglyph-rebased
Sep 14, 2026
Merged

diwenne merged 2 commits into
mainfrom
fix/numeric-keyword-o-zero-homoglyph-rebased

Conversation

@diwenne

@diwenne diwenne commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Rebase of #56 onto current main to resolve merge conflicts (git rebase, not merge, per request).

All commits are authored by @sistemabritto — this PR only replays their original work on top of main after main diverged (Arabic-script normalization in keyword-matcher.ts, and the Meta→multi-provider migration in lib/instagram/provider.ts that the attach-next-reel refactor now targets). No content changes beyond conflict resolution.

Original PR: #56. The Dockerfile/CI infra originally bundled in #56 is omitted here because it already shipped separately as #33 — the rebase detected it as a duplicate patch and dropped it automatically, so this PR is scoped to just the keyword-matcher fix and the attach-next-reel worker-polling refactor.

…keywords

A campaign with a purely numeric keyword like "08" never fired for a
comment spelled "O8" (capital letter O, not the digit zero) — visually
identical on most fonts, and mobile autocapitalize turns a leading "o"
into "O" on top of that. matchKeywords just returned unmatched, the
same result as any genuinely non-matching comment, so nothing surfaced
anywhere until a real commenter reported getting no reply.

Scope the fold to numeric-like keywords only (digits, optionally mixed
with o/O) so a word keyword ("love", "more info") compares exactly
as before — this cannot change matching behavior for any existing
non-numeric campaign.

6 new tests reproduce the production case (O8/o8 matching 08, embedded
in a sentence, matchedKeyword still returns the original keyword, word
keywords unaffected, and no accidental substring match on "108").
Full existing suite still green (144 passed).
@vercel

vercel Bot commented Sep 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openreply Error Error Sep 14, 2026 7:14pm UTC

@diwenne
diwenne merged commit 85a20fb into main Sep 14, 2026
2 of 3 checks passed
@diwenne
diwenne deleted the fix/numeric-keyword-o-zero-homoglyph-rebased branch September 14, 2026 19:14
@railway-app
railway-app Bot temporarily deployed to manychat-alternative / production September 14, 2026 19:42 Inactive

This branch had an error being deployed

1 failed, 1 active, and 1 inactive deployments
Production 4df32184 Deployed Sep 14, 2026 by vercel[bot]
manychat-alternative / production 4df32184 Deployed Sep 14, 2026 by railway-app[bot]
Preview 4df32184 Deployed Sep 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants