Documentation
¶
Overview ¶
Package readiness derives operational readiness state from a contract's declared readiness section. It is a pure, provider-neutral library shared by the Pacto CLI and the Pacto operator: given the declared checks and a point in time it computes per-check status, weight totals, and an overall score. It does not verify that the referenced evidence actually exists.
Index ¶
Constants ¶
const DefaultMinScore = 100
DefaultMinScore is the gate threshold used when a contract declares readiness but omits minScore: every weighted check must be current.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckResult ¶
type CheckResult struct {
ID string
Type string
Evidence string
Weight int
Expires string
Description string
Status Status
DaysRemaining *int
}
CheckResult is the derived state of one declared readiness check. It echoes the declared fields and adds the computed Status and, for current checks, the number of whole days remaining until the evidence expires.
type Result ¶
type Result struct {
Score int
TotalWeight int
CurrentWeight int
CurrentCount int
ExpiredCount int
InvalidCount int
// MinScore is the effective gate threshold (the declared readiness.minScore,
// or DefaultMinScore when omitted).
MinScore int
// Passing reports whether the gate is met (Score >= MinScore).
Passing bool
Checks []CheckResult
}
Result is the derived readiness assessment of a contract. Score is the percentage of declared weight that is currently satisfied (0 when no weight is declared, avoiding division by zero).
func Evaluate ¶
Evaluate derives readiness state from the declared readiness section as of now. It returns nil when no readiness is declared (a nil section or no checks), so callers can treat "no readiness" as an absent result. Evidence is considered current through the end of its expires date; the day boundary is computed in UTC so the result is independent of the caller's timezone.