Repository navigation
fix(sanitizer): redact grouped international phone numbers (TSK-008) - #106
Merged
Merged
Conversation
The + international rule only matched an unbroken digit run, so the usual written form (+34 612 345 678, +44 7700 900123) leaked into the Report. It now accepts single spaces, dots or dashes between digits, still bounded to 9-15 digits, and runs before the US 3-3-4 rule so a grouped number is redacted whole. Bare digit runs without + or a label stay untouched. The redactPhoneNumbers docstring now describes every rule it applies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
🤖 hustle review: approve — Regex bounds 9-15 digits linearly, runs before the US rule so grouped international numbers are redacted whole, and tests plus docstring cover every acceptance criterion; the over-redaction trade-off is documented and safe. |
Resolve backlog index conflict: 9 pending tasks after TSK-008 moved to complete and TSK-015 was added on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
🤖 hustle review: approve — The regex change is correct and linear-time. It runs before the US rule, and the tests cover every acceptance criterion, including the negative cases. The docstring and backlog updates match the diff. |
Contributor
|
🎉 This PR is included in version 4.1.6 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
redactPhoneNumbers(src/core/sanitizer.ts) redacted+numbers only when their digits were unbroken. The usual written form of an international number (+34 612 345 678,+44 7700 900123) leaked into theReport, which is sent to Anthropic with the default engine.docs/SPECS.mdpromises phone-number redaction. Fixes TSK-008 / RPT-008.What changed
src/core/sanitizer.ts: the+international rule changed from/(?<![\w.])\+[0-9]{9,14}\b/to/(?<![\w.+])\+[0-9](?:[-. ]?[0-9]){8,14}\b/.\s, so a match never crosses a line break.(?<![\w.+])lookbehind keeps things like semver build metadata (1.0.0+2013…) out of scope.redactPhoneNumbersdocstring now describes all three rules: international+, US 3-3-4, and labelled 10 digits. It also states that bare digit runs are untouched. It previously said "US phone numbers".src/core/sanitizer.test.ts: new parameterized tests for grouped international numbers, surrounding text, and non-phone digit runs.Acceptance criteria
+34 612 345 678,+44 7700 900123andphone +34 612 345 678. Evidence: theredacts the grouped international number in %scases pass, each with exactly 1 redaction and no digits left. All 7 new positive tests failed before the fix (7 failed | 143 passed).+34.612.345.678,+34-612-345-678and+49 30 1234 5678cases pass.+or a label are untouched. Evidence: theleaves %s untouched without a + prefix or a labelcases pass with 0 redactions for1700000000123,612 345 678,build 20261119 took 345 678 msandversion 1.2.3. The existingPhone: 5551234567, US-format and+1 555 123 4567tests still pass.redactPhoneNumbersJSDoc.pnpm check && pnpm testpass. Evidence: typecheck, eslint and prettier are clean.pnpm testgives 26 files and 482 tests passed.pnpm buildsucceeds.Trade-off
Matching is greedy, so trailing digits separated by spaces can be absorbed into the redaction, up to 15 digits in total. For example,
+44 7700 900123 12 itemsloses the12. This over-redacts, which is the safe direction for a sanitizer.Verification
🤖 Generated with Claude Code