Repository navigation
Conversation
`scan` added one to a category's count for every rule match, so a value two rules both recognise was reported twice: `+1 415-555-0100` is a US-format phone number and an international one, and came back as PhoneNumber count 2 for a single identifier. Matches are now collected as byte spans per category and overlapping spans are folded into one before counting. Distinct values, including the same value written twice, still count separately. The US rule also takes its own `+1`: `\b` cannot sit between a space and a `+`, so the match began at the `1` and redaction left a stray `+` behind (`call +[redacted]`). The leading alternation lets the match start on the `+`, and the two rules now cover the same span. Closes tinyhumansai#261
|
Warning Review limit reached
This review includes 4 billable files and costs up to $1.00. Or wait 37 minutes for your next included review. View limit details
Comment |
Tiny Sweeper reviewThis pull request fixes double counting of a single identifier when two rules in the same category match it, and widens the US-style phone pattern so a leading `+1` is part of the match. `pub fn scan(content: &str) -> PiiScanResult` now accumulates `(start, end)` spans per category instead of incrementing a counter, then folds overlapping spans with the new `distinct_spans` helper before deriving counts, score and level. No findings were raised by any review lane: the critique, security, tests and commits lanes all reported empty finding lists. The description lane produced no usable reviewer response (`tinysweeper/description` left unanswered). All lanes flag that the code index is behind this pull request (indexed at `51eef64acaad`), so retrieved context may be out of date. State: Incomplete Review snapshot
Completeness: Incomplete Features
Tests
FindingsNo active actionable findings. Could not review: tinysweeper/description Before merge
Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
There was a problem hiding this comment.
tinysweeper found nothing blocking, but could not review everything, so this is not an approval: tinysweeper/description.
$0.0051 · 411,704 in / 54,992 out · 41,088 cached (10%) · ladder/vectors-oai3, deepseek-v4.1-flash, glm-5.3-flash · 302 embedded
critique: $0.0028 · 226,061 in / 29,455 out · 16,704 cached (7%) · deepseek-v4.1-flash, glm-5.3-flash
security: $0.0007 · 116,005 in / 8,489 out · 22,464 cached (19%) · deepseek-v4.1-flash, glm-5.3-flash
tests: $0.0010 · 59,340 in / 10,096 out · 1,920 cached (3%) · deepseek-v4.1-flash
description: $0.0003 · 6,856 in / 3,916 out · 0 cached (0%) · deepseek-v4.1-flash
Closes #261
Summary
scanincremented a category's count once per rule match. The US-format and international phone rules both match+1 415-555-0100, so one identifier came back asCategoryHit { PhoneNumber, count: 2 }at level Low.Behaviour change
scancollects each validated match as a byte span per category and counts distinct spans: overlapping spans are one value seen by more than one rule; spans that touch or stand apart are separate values.+1 415-555-0100is now count 1. Three different numbers are 3; the same number written twice is still 2.\b(?:\+?1[-.\s]?)?could never start on the+(a word boundary cannot sit between a space and a+), so its match began at the1andredact_identifiers("call +1 415-555-0100")leftcall +[redacted]. The rule now begins(?:\+|\b)(?:1[-.\s]?)?, which takes the+when it is there and otherwise behaves as before. With both rules covering the same span, redaction removes the whole value and the counts above fold cleanly.Verification
New tests:
distinct_spansunit cases (empty, single, nested, partial overlap, touching, unsorted separate);a_value_matched_by_two_rules_counts_once(count 1, level Low);distinct_values_in_one_category_each_count(3 distinct, and a repeated value as 2);a_doubly_matched_value_is_redacted_wholefor both+1 415-555-0100and+1 415.555.1234. Onmainthe count test reports 2 and both redactions leave a+.Independent of #265 (international digit bounds) at the file level: the two touch different rules, and both branches are cut from current
main.