Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BetterStatus ¶
func BetterStatus(a, b report.ValidationStatus) report.ValidationStatus
BetterStatus returns whichever of a or b has higher priority. Priority order: valid > needs_validation > revoked > unknown > invalid > error > "". This is used for rolling up per-component validation results into an overall finding-level status for composite rules.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache prevents duplicate HTTP requests for the same rule+secret combination. It uses singleflight to coalesce concurrent requests for the same key so that only one goroutine performs the actual evaluation.
type Pool ¶
type Pool struct {
Debug bool
// Emit receives fully-resolved, enriched findings.
// Pool never synchronizes or retries around this callback; callers must make
// it safe for concurrent worker use.
Emit func(report.Finding)
// contains filtered or unexported fields
}
Pool manages a set of workers that validate findings asynchronously.
func NewPool ¶
func NewPool(workers int, runtime *exprruntime.Runtime) *Pool
NewPool creates a validation pool with the given number of workers.
func (*Pool) Close ¶
func (p *Pool) Close()
Close signals that no more jobs will be submitted and waits for all workers to finish.
func (*Pool) Submit ¶
func (p *Pool) Submit(finding report.Finding, program exprruntime.Program)
Submit queues a job for validation. RequiredSets (if any) are already on the finding.
func (*Pool) SubmitContext ¶
func (p *Pool) SubmitContext(ctx context.Context, finding report.Finding, program exprruntime.Program) error
SubmitContext queues a job for validation unless the provided context has already been canceled.
type Result ¶
type Result struct {
Status report.ValidationStatus // valid, invalid, revoked, unknown, error
Reason string // human-readable explanation
Metadata map[string]any // extra fields from the validation result map
}
Result holds the outcome of a validation expression evaluation.
func ParseResult ¶
ParseResult interprets the expression output value into a Result.