Add unit tests for src/backend/pii/masking_service.go
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 432
- Forks
- 51
- PR merge metrics
- No merged PRs in 30d
Description
src/backend/pii/masking_service.go orchestrates detection + generator lookup + mapping persistence, but lacks a dedicated masking_service_test.go. Sibling files (database.go, generators, detectors) all have tests.
What to add
Create src/backend/pii/masking_service_test.go covering:
- A string containing 2–3 PII types — each is masked, original/masked pairs are stored in the mapper
- Repeated identical PII — should map to the same dummy value within a session
- No PII in input — output equals input, no mappings stored
- Mixed-language / unicode input — does not panic and round-trips correctly
Hints
- Stub the detector to return a fixed
[]Entityrather than running ONNX in tests. - Reuse
database_test.gopatterns. - Run
go test ./src/backend/pii/....
Difficulty: good first issue, ~1–2 hours.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/backend/pii/masking_service.go and the patterns in database_test.go, then run go test ./src/backend/pii/.... Create masking_service_test.go with a stubbed detector and verify masking, repeated-value reuse, no-PII behavior, and mixed-language or Unicode round-tripping, including mapper contents.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend, security, testing-qa
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100