Commit 0f5838e
committed
test(security): recognize phrase_injection as a gated detect category (Spec 077 US1)
Related #784
Related: Spec 077 (specs/077-scanner-simplification)
The detect-corpus validator (specs/065-evaluation-foundation/datasets) hardcodes
the set of coherent malicious categories and the gated-category coverage rules.
Spec 077 US1 promoted phrase_injection to a real gated hard category (registered
in cmd/scan-eval gateChecks + categoryCheck), so the validator must recognize it
or reject the new corpus entries.
## Changes
- validDetectCategory: accept malicious category "phrase_injection".
- gatedDetectCategories: add "phrase_injection" (now measured by the gate;
capability_mismatch stays excluded — soft/measured-not-gated).
- hardNegPrefix: map "phrase_injection" -> "hn_phrase".
- Rename the two branch-local phrase_injection hard-negatives
(hn_send_email/hn_upload_file -> hn_phrase_*) to satisfy the id-prefix
convention. Pre-existing corpus entries untouched (append-only respected).
This STRENGTHENS coverage: the gate now requires phrase_injection to carry both
malicious samples and resembling hard-negatives.
## Testing
- go test ./... — all ok (exit 0); previously-failing
TestDetectCorpus_SchemaAndProvenance + TestDetectCorpus_GatedCoverage pass.
- scan-eval --gate — recall 1.0000, fp 0.0000 (phrase_injection gated 7/7).
- golangci-lint v2 clean.1 parent 0c0d520 commit 0f5838e
2 files changed
Lines changed: 11 additions & 8 deletions
Lines changed: 9 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| 38 | + | |
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
| |||
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
70 | | - | |
| 73 | + | |
71 | 74 | | |
72 | 75 | | |
73 | 76 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
642 | 642 | | |
643 | 643 | | |
644 | 644 | | |
645 | | - | |
| 645 | + | |
646 | 646 | | |
647 | 647 | | |
648 | 648 | | |
| |||
657 | 657 | | |
658 | 658 | | |
659 | 659 | | |
660 | | - | |
| 660 | + | |
661 | 661 | | |
662 | 662 | | |
663 | 663 | | |
| |||
0 commit comments