Repository navigation
Description
Probe-type-specific validators are silently inert when attached to the wrong probe type.
http_validator type-asserts its input to *http.Response, and the new dns_validator (#1396) asserts *dns.Msg. When the assertion fails, Validate returns an error, and RunValidators logs it and continues:
So the validator never contributes a failure. A user who attaches dns_validator { authoritative: true } to an HTTP probe sees 100% success forever, with one log line per probe run. Same for http_validator on a non-HTTP probe. Related: validators are not supported at all for UDP / UDP_LISTENER probes, and configuring one there is silently ignored too.
This should be a config error at startup, not a runtime log.
Suggested approach
Check it in BuildProbeOptions, next to the existing negative_test check, which is the same shape:
var validatorProbeTypes = map[string][]configpb.ProbeDef_Type{
"http_validator": {configpb.ProbeDef_HTTP},
"dns_validator": {configpb.ProbeDef_DNS},
}BuildProbeOptions already has both halves in scope right where it calls validators.Init: p.GetValidator() (raw protos, oneof still intact) and p.GetType().
Notes on why there rather than elsewhere:
- Not in each probe's
Init: by thenopts.Validatorsis[]*validators.Validator, i.e. just{Name, Validate}—initValidatorhas erased the oneof type, so a probe can't tell what it was handed without adding a type field to the struct. It would also mean every probe rejecting every foreign validator (N x M) instead of one table. - Not in
validators.Init: keeps the validator framework from having to know about probe types.probes/optionsalready imports both.
The same table can cover the UDP case (no validators supported).
Activity
Guflly commentedon Aug 2, 2026
I'd like to work on this. I'll add config-time validation for incompatible probe and validator types, with focused tests.