Skip to content

feat(scrub): match national phone numbers; 00 prefix only at a token start - #4

Merged
anttiviljami merged 1 commit into
mainfrom
feat/national-phone-numbers
Oct 24, 2026
Merged

anttiviljami merged 1 commit into
mainfrom
feat/national-phone-numbers

Conversation

@anttiviljami

Copy link
Copy Markdown
Member

Summary

scrub (and the catch-all pass in schema-aware mode) found config-analytics-api had to work around two gaps, see its transform/redact.ts TODO:

  • National phone numbers are missed. PHONE_PATTERN only knows +/00 prefixes, so 030 1234567 or 0221/123456, the usual way German configs write a hotline, pass through. New NATIONAL_PHONE_PATTERN matches trunk-prefix numbers with a separator after the area code: 030 1234567, 0221/123456, 0170-1234567, (0221) 123 456, 089 123 456 78.
    • It needs that separator, so bare digit runs (ids, postal codes) are left alone. The trade-off: 0301234567 written as one run is not caught (documented in the README).
    • It needs 0[1-9], so the +00 000 … pseudonyms don't re-match, and scrub stays idempotent.
    • Boundaries skip URLs, times, dates, versions and amounts.
  • The 00 prefix matched inside digit runs. 17297001234567890 became 17297+00 000 … and A-2007891234567 became A-2+00 000 …. The 00 form now only matches at a token start; + is unchanged.

Test plan

  • npm test: 33 pass. The 2 new tests fail on main: national numbers are not scrubbed, and ids/timestamps get mangled.
  • npm run lint
  • Idempotency asserted for every national format.

Generated by Claude Code

…start

- NATIONAL_PHONE_PATTERN: German/Austrian trunk-prefix numbers with a separator
  after the area code (030 1234567, 0221/123456, (0221) 123 456)
- PHONE_PATTERN: the 00 international prefix no longer matches inside digit runs
  (ids, timestamps, order numbers)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014BM517C36Je3UT1YZegY7m
@anttiviljami
anttiviljami merged commit b36022d into main Oct 24, 2026
5 checks passed
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