finding

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package finding defines the typed result of Pacto engine reasoning. It is a pure data package: zero external dependencies, no knowledge of collectors, reporters, k8s, OCI, or persistence. Reporters at the edge project Finding into external shapes (SARIF, PolicyReport); this package never imports them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category string

Category groups related codes into a coarse kind for consumers.

const (
	CategoryInterfaceMismatch      Category = "InterfaceMismatch"
	CategoryStateMismatch          Category = "StateMismatch"
	CategoryPolicyViolation        Category = "PolicyViolation"
	CategoryConfigurationViolation Category = "ConfigurationViolation"
	CategoryMissingConfiguration   Category = "MissingConfiguration"
	CategoryInvalidReference       Category = "InvalidReference"
	CategoryUnresolvedReference    Category = "UnresolvedReference"
	CategoryReferenceCycle         Category = "ReferenceCycle"
	CategoryDuplicateName          Category = "DuplicateName"
	CategoryInvalidVersion         Category = "InvalidVersion"
	CategoryInvalidReadiness       Category = "InvalidReadiness"
	CategoryMissingEvidence        Category = "MissingEvidence"
	CategoryInvalidFile            Category = "InvalidFile"
	CategorySchemaViolation        Category = "SchemaViolation"
	CategoryRuntimeDrift           Category = "RuntimeDrift"
	CategoryInvalidDependency      Category = "InvalidDependency"
	CategoryInvalidCapability      Category = "InvalidCapability"
	CategoryInconclusive           Category = "Inconclusive" // family 2; distinct from CategoryMissingEvidence
)

func CategoryOf

func CategoryOf(c Code) Category

CategoryOf returns the coarse category for a code, or "" if unknown.

type Code

type Code string

Code is a stable, specific finding identifier (e.g. STATELESS_PERSISTENT_CONFLICT).

const (
	// Durable v2 codes (may occur for v2 Operational Contracts).
	CodeUnsupportedPactoVersion      Code = "UNSUPPORTED_PACTO_VERSION"
	CodeSchemaError                  Code = "SCHEMA_ERROR"
	CodeSchemaViolation              Code = "SCHEMA_VIOLATION"
	CodeYamlParseError               Code = "YAML_PARSE_ERROR"
	CodeInvalidSemver                Code = "INVALID_SEMVER"
	CodeInvalidConfigRef             Code = "INVALID_CONFIG_REF"
	CodeInvalidPolicyRef             Code = "INVALID_POLICY_REF"
	CodeInvalidOciRef                Code = "INVALID_OCI_REF"
	CodeTagNotDigest                 Code = "TAG_NOT_DIGEST"
	CodeDuplicateInterfaceName       Code = "DUPLICATE_INTERFACE_NAME"
	CodeDuplicateConfigurationName   Code = "DUPLICATE_CONFIGURATION_NAME"
	CodeDuplicatePolicyName          Code = "DUPLICATE_POLICY_NAME"
	CodeDuplicateDependencyName      Code = "DUPLICATE_DEPENDENCY_NAME"
	CodeEmptyCompatibility           Code = "EMPTY_COMPATIBILITY"
	CodeInvalidCompatibility         Code = "INVALID_COMPATIBILITY"
	CodeValuesWithoutSchema          Code = "VALUES_WITHOUT_SCHEMA"
	CodeConfigValuesValidationFailed Code = "CONFIG_VALUES_VALIDATION_FAILED"
	CodeInvalidInterfaceSpec         Code = "INVALID_INTERFACE_SPEC"
	CodeInvalidConfigJson            Code = "INVALID_CONFIG_JSON"
	CodeInvalidConfigSchema          Code = "INVALID_CONFIG_SCHEMA"
	CodeInvalidPolicyJson            Code = "INVALID_POLICY_JSON"
	CodeInvalidPolicySchema          Code = "INVALID_POLICY_SCHEMA"
	CodeFileNotFound                 Code = "FILE_NOT_FOUND"
	CodeInvalidReadinessExpires      Code = "INVALID_READINESS_EXPIRES"
	CodeInvalidReadinessRevision     Code = "INVALID_READINESS_REVISION"
	CodeDuplicateReadinessId         Code = "DUPLICATE_READINESS_ID"
	CodeEmptyReadinessEvidence       Code = "EMPTY_READINESS_EVIDENCE"
	CodeEmptyReadinessDescription    Code = "EMPTY_READINESS_DESCRIPTION"
	CodePolicyEnforcementError       Code = "POLICY_ENFORCEMENT_ERROR"
	CodePolicyViolation              Code = "POLICY_VIOLATION"
	CodePolicyRefNotEnforced         Code = "POLICY_REF_NOT_ENFORCED"
	CodePolicyRefUnresolved          Code = "POLICY_REF_UNRESOLVED"
	CodePolicyRefCycle               Code = "POLICY_REF_CYCLE"
	CodeInvalidInterfaceType         Code = "INVALID_INTERFACE_TYPE"
	CodeInterfaceRefRequired         Code = "INTERFACE_REF_REQUIRED"
	CodeInvalidCapabilityType        Code = "INVALID_CAPABILITY_TYPE"
	CodeCapabilityRefRequired        Code = "CAPABILITY_REF_REQUIRED"
	CodeCapabilityRefInvalid         Code = "CAPABILITY_REF_INVALID"
	CodeDuplicateCapability          Code = "DUPLICATE_CAPABILITY"
	CodeUnsupportedPolicyTarget      Code = "UNSUPPORTED_POLICY_TARGET"

	// Family 1 — confirmed violations (emitted only by Evaluate). Registry: {RuntimeDrift, Error}.
	CodeWorkloadMismatch      Code = "WORKLOAD_MISMATCH"
	CodePersistenceMismatch   Code = "PERSISTENCE_MISMATCH"
	CodeDependencyUnreachable Code = "DEPENDENCY_UNREACHABLE"
	CodeCapabilityAbsent      Code = "CAPABILITY_ABSENT"
	CodeInterfaceAbsent       Code = "INTERFACE_ABSENT"
	CodeConfigurationAbsent   Code = "CONFIGURATION_ABSENT"
	CodeConfigurationMismatch Code = "CONFIGURATION_MISMATCH"

	// Family 2 — insufficient/unreliable evidence (emitted by Evaluate). Registry: {Inconclusive, Unknown}.
	CodeEvidenceMissing               Code = "EVIDENCE_MISSING"
	CodeObservationUnsupported        Code = "OBSERVATION_UNSUPPORTED"
	CodeCollectionFailed              Code = "COLLECTION_FAILED"
	CodeEvidenceStale                 Code = "EVIDENCE_STALE"
	CodeEvidenceInsufficient          Code = "EVIDENCE_INSUFFICIENT"
	CodeExtensionEvaluatorUnavailable Code = "EXTENSION_EVALUATOR_UNAVAILABLE"

	// Structural (crossfield) — capability binding. Registry: {InvalidCapability, Error}.
	CodeCapabilityInterfaceUnknown Code = "CAPABILITY_INTERFACE_UNKNOWN" // binding.interface references no declared interface
	CodeCapabilityPathInvalid      Code = "CAPABILITY_PATH_INVALID"      // binding.path fails the net/url SSRF check

)
const (
	CodeStatelessPersistent Code = "STATELESS_PERSISTENT_CONFLICT"
)

One representative durable v2 code; the full set (including evidence-based and legacy-v1 codes) is registered in Task 2.2.

type EvidenceRef

type EvidenceRef struct {
	Source     string
	ObservedAt string
}

EvidenceRef links a finding to the evidence that supports it.

type Finding

type Finding struct {
	Code         Code
	Severity     Severity
	Category     Category
	Subject      SubjectRef
	ContractPath string
	Message      string
	EvidenceRefs []EvidenceRef
}

Finding is a typed conclusion produced by the engine. Contract-only findings leave EvidenceRefs empty; evidence-based findings (Phase 5, Evaluate) populate it.

type Severity

type Severity string

Severity ranks a finding.

const (
	SeverityError   Severity = "error"
	SeverityWarning Severity = "warning"
	SeverityInfo    Severity = "info"
	SeverityUnknown Severity = "unknown" // required assertion could not be evaluated
)

func DefaultSeverity

func DefaultSeverity(c Code) Severity

DefaultSeverity returns the code's default severity (error if unknown).

type SubjectRef

type SubjectRef struct {
	Kind string // e.g. service, interface, dependency, configuration, policy
	Name string
}

SubjectRef identifies the thing a finding is about.

Jump to

Keyboard shortcuts

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