Skip to content

Backend not-empty rule disagrees with Arc .NET on which characters are whitespace #188

Closed

Description

@woksin

Problem

Screenplay decision 0071 (https://github.com/Cratis/Screenplay/blob/main/decisions/0071-whitespace-only-text-does-not-satisfy-not-empty.md) fixes not empty on text to the Unicode White_Space set, the same set .NET char.IsWhiteSpace and FluentValidation's NotEmpty() use. Arc.TypeScript's backend rule uses JavaScript trim() (Source/Core/validation/evaluateRule.ts, empty), which treats U+FEFF as whitespace and U+0085 as a character, so a whitespace-only value is accepted or rejected differently than by Arc .NET and the Arc frontend (Cratis/Arc#3224).

Requested

Treat a string as empty when it consists only of Unicode White_Space characters (for example /^\p{White_Space}*$/u), and add specs for U+0085, U+FEFF and an ordinary whitespace-only value.

Status

State: Done — Delivered by merged PR #194 at 862803d; issue closed completed. Full review and PR CI passed.
Branch: (#194)
Scope: Unicode White_Space for empty/notEmpty string validation; one patch PR.
Plan: Replace the trim()-based string emptiness predicate in Source/Core/validation/evaluateRule.ts with /^\p{White_Space}*$/u for both empty and notEmpty; add for_evaluateRule specs for U+0085, U+FEFF, ordinary whitespace, empty string and mixed text.
Delivered: Nothing yet.
Remaining: To be confirmed.
Follow-ups: None.

Activity

  1. woksin commented on Oct 29, 2026

    @woksin
    ContributorAuthor

    Analysis and proposed solution

    Current behaviour
    Source/Core/validation/evaluateRule.ts:8 treats a string as empty when JavaScript trim() removes its entire content. The notEmpty and empty rules both use that predicate at Source/Core/validation/evaluateRule.ts:27-28. Consequently U+0085 is treated as content, whereas U+FEFF is treated as whitespace.

    Root cause / gap
    ECMAScript trimming and Unicode White_Space are different character sets. The shared predicate implements JavaScript trimming semantics rather than the cross-stack text-validation contract described in this issue. Changing only the notEmpty branch would also leave the complementary empty rule inconsistent.

    Proposed change
    Replace the string-specific trim check in Source/Core/validation/evaluateRule.ts with an anchored Unicode-property expression such as /^\p{White_Space}*$/u. Leave null, number, boolean, array and Guid handling unchanged.

    Add focused specs under Source/Core/validation/for_evaluateRule/when_notEmpty and when_empty, following the describe, asynchronous beforeEach, it and should assertion style demonstrated by Source/Core/validation/for_evaluateRule/when_notEmpty/with_guid_empty.ts:7-15. Verify that U+0085 and ordinary whitespace-only strings fail notEmpty, U+FEFF passes it, and empty returns the inverse. Include empty strings and text mixed with whitespace as controls; preserve the existing non-string regression cases.

    Size, risk and release intent
    S; low implementation risk, with an intentional validation-behaviour correction for affected characters; patch.

    Dependencies and blockers
    Coordinate parity with Cratis/Arc#3224. No backend implementation blocker is evident; the Unicode contract is specified in the linked Screenplay decision.

  2. self-assigned this
    on Oct 29, 2026
  3. woksin commented on Oct 29, 2026

    @woksin
    ContributorAuthor

    Delivered in #194: empty and notEmpty now use Unicode White_Space, including regression coverage for U+0085 and U+FEFF.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions