profile

package
v0.1.2 Latest Latest
Warning

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

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

Documentation

Overview

Package profile derives an organization's qualification disposition from an MPQT scorecard. Profiles are policy data: evaluation is a pure function that never mutates raw results and never calls a model or target.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Card

type Card interface {
	Dimensions() ([]qual.DimensionScore, error)
	FindingCount(code eval.FindingCode) int
	SeverityCount(s eval.Severity) int
}

Card is the read-only view of a scorecard that profile evaluation consumes. qual.Scorecard satisfies it once Task 12 adds FindingCount/SeverityCount; tests may substitute a fake.

type Disposition

type Disposition string

Disposition is the derived release-policy outcome. There is no valid zero value.

const (
	Qualified  Disposition = "qualified"
	Restricted Disposition = "restricted"
	Rejected   Disposition = "rejected"
	Unverified Disposition = "unverified"
)

func (Disposition) Rank

func (d Disposition) Rank() int

Rank orders the four Disposition constants worst-to-best, for callers that need a minimum-acceptability threshold -- e.g. a CLI's --require flag, which must accept anything at or above a configured floor. It returns -1 for any value that is not one of the four Disposition constants, so a caller can use a negative result to reject an unrecognized --require value.

This is a DIFFERENT axis from Evaluate's own precedence-of-derivation logic (violated > undecided > restriction-applied > default qualified), which decides which single disposition a scorecard resolves to in the first place given a profile's requirements and restrictions. Rank instead compares two already-derived Disposition values against each other; it is never consulted by Evaluate.

type Outcome

type Outcome string

Outcome classifies one requirement's result.

const (
	Met       Outcome = "met"
	Violated  Outcome = "violated"
	Undecided Outcome = "undecided"
)

type Profile

type Profile struct {
	Name         eval.Name
	Revision     eval.Revision
	Requirements []Requirement
	Restrictions []Restriction
}

Profile is a named, versioned set of mandatory requirements and optional restrictions.

func (Profile) Validate

func (p Profile) Validate() error

Validate checks profile identity, at least one mandatory requirement, and every clause.

type Requirement

type Requirement struct {
	Dimension   eval.Name
	MinScore    *float64 // [0,100]
	MinCoverage *float64 // [0,1]

	FindingCode     eval.FindingCode
	MaxFindingCount *int

	Severity         eval.Severity
	MaxSeverityCount *int
}

Requirement is one testable policy clause. Exactly one subject must be set: either Dimension (with MinScore and/or MinCoverage) or FindingCode (with MaxFindingCount) or Severity (with MaxSeverityCount). Nil bounds are "no constraint of that kind".

func (Requirement) Validate

func (r Requirement) Validate() error

Validate rejects a requirement with no subject, more than one subject, a subject without any bound, or an out-of-range bound.

type RequirementResult

type RequirementResult struct {
	Requirement Requirement
	Outcome     Outcome
}

RequirementResult is the per-clause evidence retained in the result.

type Restriction

type Restriction struct {
	Description string
	Requirement Requirement
}

Restriction is a non-mandatory clause: when its requirement is not met, the disposition downgrades from qualified to restricted and the description names the reduced deployment scope.

type RestrictionResult

type RestrictionResult struct {
	Restriction Restriction
	Applied     bool
}

RestrictionResult records whether a restriction applies.

type Result

type Result struct {
	Profile      eval.Name
	Revision     eval.Revision
	Disposition  Disposition
	Requirements []RequirementResult
	Restrictions []RestrictionResult
}

Result is the derived disposition plus per-clause evidence. It contains no mutated scorecard data.

func Evaluate

func Evaluate(card Card, p Profile) (Result, error)

Evaluate derives a disposition. Precedence: any violated mandatory requirement yields Rejected; otherwise any undecided requirement yields Unverified; otherwise restrictions with unmet requirements yield Restricted; otherwise Qualified.

Jump to

Keyboard shortcuts

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