Skip to content

fix(bot): reject empty keywords in arrays - #1275

Merged
leifermendez merged 1 commit into
codigoencasa:builderbotfrom
harsh-thakkar7:fix/1255-empty-keyword-array
Oct 26, 2026
Merged

leifermendez merged 1 commit into
codigoencasa:builderbotfrom
harsh-thakkar7:fix/1255-empty-keyword-array

Conversation

@harsh-thakkar7

Copy link
Copy Markdown
Contributor

Que tipo de Pull Request es?

  • Mejoras
  • Bug
  • Docs / tests

Descripci贸n

Refs #1255 (the remaining empty-array-entry case).

The existing guard rejects addKeyword('') and addKeyword([]), but an empty string inside a non-empty array still passes. FlowClass turns that entry into an empty regular expression, allowing unrelated incoming messages to match the flow.

Changes

  • Reject empty strings anywhere in the keyword array with the existing KEYWORD_CANNOT_BE_EMPTY error.
  • Add regression coverage for both [''] and ['hola', ''].
  • Preserve existing behavior for valid keywords and the existing error contract.

Verification

  • The new regression failed before the production change because no error was thrown.
  • Targeted UVU tests: 16/16 passed.
  • pnpm test: all 29 monorepo test projects passed.
  • pnpm --filter @builderbot/bot build: passed.
  • ESLint and Prettier checks for both changed files: passed.

@leifermendez leifermendez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aprobado. La validaci贸n evita que una entrada vac铆a en el array convierta el flujo en un match accidental y conserva el error KEYWORD_CANNOT_BE_EMPTY. Verificaci贸n del commit revisado: 16/16 tests de m茅todos y 209/209 tests del paquete aprobados (1 omitido por la suite), m谩s comparaci贸n base/head del matching y compatibilidad de entradas v谩lidas. El rechazo de configuraciones que depend铆an de keywords vac铆as es intencional.

@leifermendez
leifermendez merged commit 8d191b3 into codigoencasa:builderbot Oct 26, 2026
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