Skip to content

Validate hallucination-control configuration at plugin initialization #8

Description

@deepintai

Context

The semantic cache plugin accepts hallucination-control settings (strictness level, temperature cap, technique list) but does not validate them at startup. Invalid values are silently coerced to defaults (see hallucControlStrictness() at line ~65), which can mask operator configuration mistakes.

What to do

  1. Add a validation function (in main.go or a new validation.go):
    func validateHallucinationControlConfig(config *Config) error
    checking:
    • Strictness is one of "low", "medium", "high".
    • Temperature cap is within a sensible range (0.0-2.0).
    • Every entry in the techniques list is a known technique ID: grounding_directive, anti_fabrication, citation_required, uncertainty_ack, temperature_clamp.
  2. Return a descriptive error naming the offending field and the allowed values.
  3. Call the validator during the plugin's Init/Setup flow so misconfiguration fails fast instead of being silently normalized.

Acceptance criteria

  • Invalid strictness (e.g. "invalid"), out-of-range temp cap (e.g. -1.0, 100.0), and unknown technique IDs each produce a clear validation error.
  • Error messages state which field is invalid and the allowed values.
  • Validation is wired into plugin initialization.
  • Tests demonstrate each rule (valid config + one failing case per rule).
  • go test ./plugins/semanticcache/... passes.

File pointers

  • Config struct + getters: deepintshield_server/plugins/semanticcache/main.go (hallucControlStrictness:65, hallucControlTempCap:78, hallucControlTechniques:92)
  • Technique IDs: deepintshield_server/plugins/semanticcache/hallucination_control.go (constants near lines 18-31)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions