Context
The semantic cache plugin computes a hallucination-control "improvement" score (based on hedging language and citation density) that drives a dashboard metric. The two core helpers, splitSentencesFast() and computeHallucControlImprovement(), have no test coverage — the deepintshield_server/plugins/semanticcache/ package has no *_test.go files. Both functions are pure and dependency-free, making them ideal for a first contribution.
What to do
Create deepintshield_server/plugins/semanticcache/hallucination_control_test.go covering:
splitSentencesFast(s string) []string (line ~328): sentence boundaries on ., !, ?, and newlines; empty string; single word with no terminator; trailing/leading whitespace.
computeHallucControlImprovement(response string) float64 (line ~293):
- Response full of hedging language vs. one with none.
- Response with citations (e.g.
[source: ...], https://... URLs) vs. none.
- Mixed hedging + citations.
- Empty string returns a sane value.
- Assert the result is always within
[0, 1].
Acceptance criteria
File pointers
- Implementation:
deepintshield_server/plugins/semanticcache/hallucination_control.go
computeHallucControlImprovement at line ~293
splitSentencesFast at line ~328
- Test-style reference:
deepintshield_server/plugins/guardrails/cache_reuse_test.go
Context
The semantic cache plugin computes a hallucination-control "improvement" score (based on hedging language and citation density) that drives a dashboard metric. The two core helpers,
splitSentencesFast()andcomputeHallucControlImprovement(), have no test coverage — thedeepintshield_server/plugins/semanticcache/package has no*_test.gofiles. Both functions are pure and dependency-free, making them ideal for a first contribution.What to do
Create
deepintshield_server/plugins/semanticcache/hallucination_control_test.gocovering:splitSentencesFast(s string) []string(line ~328): sentence boundaries on.,!,?, and newlines; empty string; single word with no terminator; trailing/leading whitespace.computeHallucControlImprovement(response string) float64(line ~293):[source: ...],https://...URLs) vs. none.[0, 1].Acceptance criteria
deepintshield_server/plugins/semanticcache/hallucination_control_test.go.[0, 1].go test ./...for the plugin passes locally with no external dependencies.File pointers
deepintshield_server/plugins/semanticcache/hallucination_control.gocomputeHallucControlImprovementat line ~293splitSentencesFastat line ~328deepintshield_server/plugins/guardrails/cache_reuse_test.go