Skip to content

Commit c014d64

Browse files
authored
fix(frontend): detect titled names across PII locales (#252)
* fix(frontend): detect titled names across PII locales * fix: scan configured PII locales before submission * feat(frontend): detect untitled local person names * fix(frontend): satisfy CI formatting and harden name tests * fix(frontend): address PII review feedback * chore: address review feedback and bump versions
1 parent 6c981d9 commit c014d64

20 files changed

Lines changed: 2699 additions & 31 deletions

.planning/active/2026-04-30-local-browser-pii-guard-implementation-plan.md

Lines changed: 1673 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Untitled Local Person Name PII Implementation Plan
2+
3+
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4+
5+
**Goal:** Add configurable browser-only review-confidence detection for untitled person names.
6+
7+
**Architecture:** Keep deterministic detection in `frontend/src/pii/`. Add config data in `ruleConfig.js`, scanning logic in `detector.js`, and tests in existing Vitest suites. No network or model dependency is introduced.
8+
9+
**Tech Stack:** Vue 3 frontend, Vitest, existing PII detector/redactor modules.
10+
11+
---
12+
13+
### Task 1: Add Failing Detector Tests
14+
15+
**Files:**
16+
- Modify: `frontend/src/test/pii/detector.test.js`
17+
18+
- [ ] Add tests for untitled names:
19+
- `Bernt Popp ist dumm` with locale `en`
20+
- `Jean Dupont a des crises` with locale `fr`
21+
- `María García tiene convulsiones` with locale `es`
22+
- `Jan van Dijk heeft aanvallen` with locale `nl`
23+
24+
- [ ] Add false-positive tests:
25+
- `Pectus Carinatum was noted.`
26+
- `Down Syndrome was discussed.`
27+
- `BioLORD Model returned results.`
28+
- `HP:0002779 Tracheomalacia`
29+
30+
- [ ] Run:
31+
`npm run test:run -- src/test/pii/detector.test.js -t "untitled"`
32+
33+
- [ ] Expected: FAIL because untitled name detection does not exist yet.
34+
35+
### Task 2: Implement Config-Driven Untitled Name Detection
36+
37+
**Files:**
38+
- Modify: `frontend/src/pii/ruleConfig.js`
39+
- Modify: `frontend/src/pii/detector.js`
40+
41+
- [ ] Add exported config for possible names:
42+
- `UNTITLED_NAME_RULE_CONFIG`
43+
- locale particles
44+
- locale context words
45+
- blocked phrase words
46+
- minimum score
47+
48+
- [ ] Add detector helpers:
49+
- extract capitalized-token candidate spans
50+
- score candidates from config
51+
- reject blocked/domain/identifier candidates
52+
- emit `person_name` review findings only
53+
54+
- [ ] Run:
55+
`npm run test:run -- src/test/pii/detector.test.js -t "untitled"`
56+
57+
- [ ] Expected: PASS.
58+
59+
### Task 3: Add Submission-Guard Tests
60+
61+
**Files:**
62+
- Modify: `frontend/src/test/components/QueryInterface.test.js`
63+
64+
- [ ] Add Query mode test that `Bernt Popp ist dumm` opens PII review and does not call `queryHpo`.
65+
- [ ] Add Full Text mode test that `Bernt Popp ist dumm` opens PII review and does not call `processText`.
66+
- [ ] Run:
67+
`npm run test:run -- src/test/components/QueryInterface.test.js -t "untitled name"`
68+
- [ ] Expected: PASS after Task 2.
69+
70+
### Task 4: Focused Verification and Commit
71+
72+
**Files:**
73+
- All modified frontend PII files and planning files.
74+
75+
- [ ] Run:
76+
`npm run test:run -- src/test/pii src/test/components/QueryInterface.test.js`
77+
- [ ] Run:
78+
`npm run lint -- src/pii/detector.js src/pii/ruleConfig.js src/test/pii/detector.test.js src/test/components/QueryInterface.test.js`
79+
- [ ] Run:
80+
`git diff --check`
81+
- [ ] Commit:
82+
`git commit -m "feat(frontend): detect untitled local person names"`

0 commit comments

Comments
 (0)