You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(pii): observability for NER detections — backend trace, confidence, debug logs
There was no way to see what the NER detector actually produced, so a
false-positive block (e.g. a phone number scored as SSN) was opaque. Add three
views, all from data the TokenClassify gRPC already returns (no backend rebuild):
- Backend trace: ModelTokenClassify now records a BackendTraceTokenClassify
row (gated on tracing) with the input preview, threshold, and every entity's
group, byte range, confidence and matched text. Wires up the long-standing
TODO; shows in the Traces UI alongside the request it gated.
- Confidence in the audit log: carry the detector score through
rawHit -> Span -> PIIEvent, exposed as `score` on /api/pii/events. Metadata
only — the event still stores a hash, never the value.
- Per-detection DEBUG logs in the redactor: one line per raw hit with group,
range, score, matched text and the policy decision (accepted / dropped
below min_score / no action for group), so the masking/blocking rationale is
visible in the backend logs.
Also drop a redundant same-type assertion in ModelTokenClassify (Load already
returns grpc.Backend) and give TokenEntity json tags for clean trace rendering.
Assisted-by: claude-code:claude-opus-4-8 [Claude Code]
0 commit comments