diff

package
v0.1.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SeverityStrings

func SeverityStrings() []string

SeverityStrings returns a slice of all String values of the enum

func ShouldBlockDiff

func ShouldBlockDiff(after *pipelinespec.Pipeline, result *CheckResult) bool

ShouldBlockDiff decides whether a semantic diff should fail preflight/CI. Breaking semantic changes block because the current pipeline contract would no longer hold.

func StepDiffKindStrings

func StepDiffKindStrings() []string

StepDiffKindStrings returns a slice of all String values of the enum

Types

type CheckResult

type CheckResult struct {
	Severity Severity  `json:"severity"`
	Findings []Finding `json:"findings"`
}

CheckResult is the overall outcome of a semantic check against a DiffResult.

func Check

func Check(d *DiffResult) *CheckResult

Check evaluates the semantic impact of a DiffResult and returns a structured result. It classifies each change by severity so callers can decide whether to block (e.g. in CI).

func (*CheckResult) Format

func (r *CheckResult) Format() string

Format returns a human-readable text summary suitable for CI logs or PR comments.

type DiffResult

type DiffResult struct {
	HasChanges bool
	Metadata   []FieldChange
	Steps      []StepDiff
}

DiffResult is the structured output of a semantic pipeline comparison.

func Diff

func Diff(before, after *pipelinespec.Pipeline) *DiffResult

Diff computes the semantic difference between two pipeline specs. Both before and after must be non-nil. Steps are matched by slug.

type FieldChange

type FieldChange struct {
	Field  string
	Before string
	After  string
}

FieldChange is a single field that changed between two pipeline versions.

type Finding

type Finding struct {
	Severity Severity `json:"severity"`
	Message  string   `json:"message"`
}

Finding is a single observed issue with a severity and human-readable message.

type Severity

type Severity int

Severity represents the impact level of a pipeline change.

const (
	// SeveritySafe means the change is additive or cosmetic with no behavioral risk.
	SeveritySafe Severity = iota // safe
	// SeverityWarning means the change alters behavior and warrants careful review.
	SeverityWarning // warning
	// SeverityBreaking means the change removes or incompatibly alters the pipeline contract.
	SeverityBreaking // breaking
)

func SeverityString

func SeverityString(s string) (Severity, error)

SeverityString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func SeverityValues

func SeverityValues() []Severity

SeverityValues returns all values of the enum

func (Severity) IsASeverity

func (i Severity) IsASeverity() bool

IsASeverity returns "true" if the value is listed in the enum definition. "false" otherwise

func (Severity) MarshalJSON

func (i Severity) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for Severity

func (Severity) String

func (i Severity) String() string

func (*Severity) UnmarshalJSON

func (i *Severity) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for Severity

type StepDiff

type StepDiff struct {
	Slug   string
	Kind   StepDiffKind
	Fields []FieldChange // populated for Modified steps only
}

StepDiff describes what changed for a given step.

type StepDiffKind

type StepDiffKind int

StepDiffKind describes the type of change for a step.

const (
	StepAdded    StepDiffKind = iota // added
	StepRemoved                      // removed
	StepModified                     // modified
)

func StepDiffKindString

func StepDiffKindString(s string) (StepDiffKind, error)

StepDiffKindString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func StepDiffKindValues

func StepDiffKindValues() []StepDiffKind

StepDiffKindValues returns all values of the enum

func (StepDiffKind) IsAStepDiffKind

func (i StepDiffKind) IsAStepDiffKind() bool

IsAStepDiffKind returns "true" if the value is listed in the enum definition. "false" otherwise

func (StepDiffKind) MarshalJSON

func (i StepDiffKind) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for StepDiffKind

func (StepDiffKind) String

func (i StepDiffKind) String() string

func (*StepDiffKind) UnmarshalJSON

func (i *StepDiffKind) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for StepDiffKind

Jump to

Keyboard shortcuts

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