E.164 normalizer and SMS keyword interpreter (MS1 Task 1)

Featurekamo-shared-library
Ya
27 Agosti 2026, 18:29 UTC
Mwandishi
Kamo
Ahadi ya
f1e94be

Two pure classes with no I/O and no Spring stereotype, so every service can load them and SharedLibBeanSafetyTest stays green. E164.normalize(raw, defaultRegion) -> Optional<String>. Deliberately narrow and NANP-only: libphonenumber is NOT a dependency of this module and was not added for this, because adding a transitive dependency to a library all 28 services load is not a decision an opt-out parser gets to make. A leading '+' is accepted as-is; 10 bare digits with a NANP region, or 11 led by '1', become +1; anything else is empty. Refusing is the point -- a guess that lands on a real but different number suppresses a stranger AND leaves the person who texted STOP still receiving texts. NOT ContactCanon.phone(), which is a lossy US-only comparison key (last 10 digits, leading 1 dropped) that the platform's lead-to-call matching depends on. Unchanged and unreused here. **************** -> SmsKeyword {STOP,HELP,START,UNKNOWN}. CTIA's vocabulary plus ARRET/AIDE. Matching is EXACT set membership after **************** never contains(). TDD evidence ------------ Red (classes absent): [ERROR] **************** cannot find symbol [ERROR] symbol: variable SmsKeywordInterpreter [ERROR] location: class **************** Green: Tests run: 10, Failures: 0, Errors: 0, Skipped: 0 Mutation 1 -- exact match changed to **************** (and the same for HELP/START). Observed red: **************** **************** expected: UNKNOWN but was: STOP **************** **************** [UNSTOP] expected: START but was: STOP The second failure was not predicted by the plan and is worth recording: "UNSTOP" CONTAINS "STOP", so a substring implementation reads a consumer's re-opt-in as an opt-out. contains() is not merely imprecise here, it inverts the meaning of the one message that undoes a suppression. Mutation 2 -- E164's final `return Optional.empty()` changed to `return Optional.of("+1" + digits)`. Observed red: **************** java.lang.AssertionError: Expecting an empty Optional but was containing value: "+112345" Both mutations reverted. Full suite after revert: Tests run: 2284, Failures: 0, Errors: 0, Skipped: 0 / BUILD SUCCESS Refs: **************** Task 1

Mabadiliko yote

Je, unaona nini kuhusu usafiri?

Kila moja ya hizi updates ardhi katika nafasi yako ya kazi moja kwa moja. Kuanza bure na kuangalia kukua wiki baada ya wiki.

Kuwa Huru MileleMtazamo wa bei