Skip to content

Trim whitespace on string filter values#47

Open
guiziwebbot[bot] wants to merge 2 commits into
mainfrom
fix/trim-string-filter-value
Open

Trim whitespace on string filter values#47
guiziwebbot[bot] wants to merge 2 commits into
mainfrom
fix/trim-string-filter-value

Conversation

@guiziwebbot

@guiziwebbot guiziwebbot Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • StringFilterValueFormatter now trims leading/trailing whitespace from the LLM-provided string value before building the FilterFormatResult.
  • A value that is only whitespace is treated as empty (same behaviour as an empty value), so contains/equal filters no longer miss matches due to stray spaces.

Test plan

  • vendor/bin/ecs check src — no errors
  • vendor/bin/phpstan analyse -c phpstan.neon — no errors
  • vendor/bin/phpunit --testsuite unit — 147 tests, 210 assertions, all passing (added 3 new tests: trims whitespace, whitespace-only value returns null, empty operator trims value)

No admin UI impact (backend filter-value formatting only), so no Playwright verification was performed.

Closes #45

Leading/trailing spaces in an LLM-provided string filter value are
kept as-is, so a `contains`/`equal` filter can miss matches. Trim the
value before building the FilterFormatResult, and treat a
whitespace-only value as empty like the existing empty-value handling.

Closes #45
Plain trim() doesn't strip U+00A0. Normalize it to a regular space
before trimming so values like " john " match consistently.
@guiziwebbot

guiziwebbot Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Suite à la demande sur l'issue #45 (« ajoute un cas de test avec des espaces insécables ») :

  • PHP trim() ne supprime pas U+00A0 (espace insécable) par défaut — un test avec ce caractère aurait échoué sur l'implémentation actuelle. J'ai donc normalisé les espaces insécables en espace normal avant le trim() dans StringFilterValueFormatter.
  • Ajouté deux tests : testFormatTrimsNonBreakingSpaces et testFormatNonBreakingSpaceOnlyValueReturnsNull.

Gate statique (réellement exécuté) :

  • ecs (src) : aucune erreur
  • phpstan : aucune erreur
  • phpunit unit : 149 tests, 212 assertions, OK

Pas de changement d'UI admin, donc pas de vérification Playwright nécessaire.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs review À toi de reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trim whitespace on string filter values

1 participant