validity

package
v1.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package validity provides validity window logic for the Effectiveness Monitor. It determines whether an assessment is still within its validity window and whether the stabilization period has expired.

Business Requirements: - BR-EM-006: Stabilization window before assessment begins - BR-EM-007: Validity window for assessment expiration

Timeline:

EA Created                Stabilization Expires          Validity Deadline
|--- stabilization ------>|--- assessment window -------->|--- expired --->

The stabilization window prevents premature assessment when the system is still settling after remediation. The validity deadline ensures assessments don't run indefinitely.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checker

type Checker interface {
	// Check determines the current window state given the EA creation time,
	// stabilization window duration, and validity deadline.
	// Accepts metav1.Time (QF1008: omit embedded .Time from selector).
	Check(creationTime metav1.Time, stabilizationWindow time.Duration, validityDeadline metav1.Time) WindowState

	// TimeUntilStabilized returns the remaining time until stabilization expires.
	// Returns 0 if already stabilized.
	// Accepts metav1.Time (QF1008: omit embedded .Time from selector).
	TimeUntilStabilized(creationTime metav1.Time, stabilizationWindow time.Duration) time.Duration

	// TimeUntilExpired returns the remaining time until the validity deadline.
	// Returns 0 if already expired.
	TimeUntilExpired(validityDeadline time.Time) time.Duration
}

Checker evaluates the validity window state for an assessment.

func NewChecker

func NewChecker() Checker

NewChecker creates a new validity window checker.

type WindowState

type WindowState int

WindowState represents the current state of an assessment's validity window.

const (
	// WindowStabilizing indicates the stabilization period has not yet expired.
	// The assessment should wait (requeue) until stabilization completes.
	WindowStabilizing WindowState = iota

	// WindowActive indicates the stabilization period has passed and the
	// assessment is within the validity window. Assessment checks should proceed.
	WindowActive

	// WindowExpired indicates the validity deadline has passed.
	// The assessment should complete with whatever data has been collected.
	WindowExpired
)

func (WindowState) String

func (ws WindowState) String() string

String returns the human-readable name of the WindowState.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL