engine

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Score

func Score(findings []Finding) (score int, ready bool)

Score implements the spec §6 formula:

score = max(0, 100 − min(75, 25·#blockers) − min(20, 5·#warnings))
ready = #blockers == 0

Info findings are listed but never scored.

func TeamScores

func TeamScores(r Report) map[string]TeamScore

TeamScores groups a report's findings by team and scores each subset with Score. A finding attributed to N teams counts for each of them; a finding with no teams is attributed to the empty-string team "" (callers render it as "unattributed"). Pure: no I/O, no clock — same contract as Evaluate. The result is deliberately NOT part of engine.Report; servers and CLIs compute it at presentation time.

Types

type CapabilityGap

type CapabilityGap struct {
	Capability inventory.Capability `json:"capability"`
	Reason     string               `json:"reason"`
}

type Category

type Category string
const (
	CatRemovedAPI         Category = "removed-api"
	CatDeprecatedAPI      Category = "deprecated-api"
	CatDeprecatedAPIInUse Category = "deprecated-api-in-use"
	CatEOLAddon           Category = "eol-addon"
	CatEOLApproaching     Category = "eol-approaching"
	CatVersionSkew        Category = "version-skew"
	CatChartIncompat      Category = "chart-incompat"
	CatKBStale            Category = "kb-stale"
)

type Finding

type Finding struct {
	Category Category `json:"category"`
	Severity Severity `json:"severity"`
	// Key is the finding's stable, count-free identity: it never embeds
	// object counts, node counts, or other volatile numbers, so the same
	// underlying problem keeps the same Key across snapshots even as Title
	// fluctuates ("3 objects" → "2 objects"). Notification delta diffing
	// keys on it. Convention: category + "/" + stable discriminator
	// (e.g. "removed-api/extensions/v1beta1/Ingress", "eol-addon/ingress-nginx").
	Key         string   `json:"key,omitempty"`
	Title       string   `json:"title"`           // one line, deterministic
	Detail      string   `json:"detail"`          // evidence sentence(s), deterministic
	Teams       []string `json:"teams,omitempty"` // sorted, deduped
	Namespaces  []string `json:"namespaces,omitempty"`
	Remediation string   `json:"remediation,omitempty"`
	Citations   []string `json:"citations,omitempty"`
}

type Report

type Report struct {
	ClusterID   string            `json:"clusterId"`
	Target      inventory.Version `json:"target"`
	KBVersion   string            `json:"kbVersion"`
	Score       int               `json:"score"`
	Ready       bool              `json:"ready"`
	Findings    []Finding         `json:"findings"` // sorted: severity desc, category, title
	NotAssessed []CapabilityGap   `json:"notAssessed,omitempty"`
}

func Evaluate

func Evaluate(inv inventory.Inventory, k kb.KB, target inventory.Version, now time.Time) Report

Evaluate is the pure evaluation entrypoint: no I/O, no clock reads — now is injected for EOL-window math. Output is fully deterministic for a given (inventory, kb, target, now).

type Severity

type Severity string
const (
	SevBlocker Severity = "blocker"
	SevWarning Severity = "warning"
	SevInfo    Severity = "info"
)

type TeamScore

type TeamScore struct {
	Score    int  `json:"score"`
	Ready    bool `json:"ready"`
	Blockers int  `json:"blockers"`
	Warnings int  `json:"warnings"`
}

TeamScore is one team's slice of a report, scored with the same spec §6 formula as the cluster score, over only that team's findings.

Jump to

Keyboard shortcuts

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