diff

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package diff compares planned intents against observed live state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasDrift

func HasDrift(entries []Entry) bool

HasDrift reports whether any entry represents a state needing action.

Match, Present, and Ignored are clean; everything else is drift.

Types

type Entry

type Entry struct {
	Repo         string
	Kind         plan.Kind
	Name         string
	Status       Status
	DesiredValue string // populated for Mismatch on vars
	LiveValue    string // populated for Mismatch on vars

	// Override is non-empty when this entry resolved through a cross-layer
	// override:
	//   - OverrideManaged: per-repo.managed shadowed all-repos.managed.
	//   - OverrideIgnored: per-repo.ignored shielded all-repos.managed.
	// In both cases the implicit layer pair is per-repo over all-repos.
	Override Override
}

Entry is one diff result row.

func Compute

func Compute(repo string, intents []plan.Intent, desiredVars map[string]string, live Live, ignored config.Ignored) []Entry

Compute produces diff entries for a single repo.

desiredVars maps variable name → resolved desired value. Pass nil if no vars are intended.

type Live

type Live struct {
	Vars       map[string]string
	Secrets    []string
	Dependabot []string
}

Live captures observed state for a single repo.

Vars is name → value because the GitHub API returns variable values. Secrets and Dependabot list names only — values are never exposed.

type Override

type Override string

Override records that an entry's effective layer differs from the all-repos default — used by audit to surface layered drift.

const (
	// OverrideNone is the zero value: no cascade override applies.
	OverrideNone Override = ""
	// OverrideManaged indicates a per-repo.managed entry shadowed an
	// all-repos.managed entry of the same name.
	OverrideManaged Override = "managed"
	// OverrideIgnored indicates a per-repo.ignored entry shielded an
	// all-repos.managed entry of the same name.
	OverrideIgnored Override = "ignored"
)

type Status

type Status string

Status names a per-entry result.

const (
	Match    Status = "match"    // vars: desired == live
	Mismatch Status = "mismatch" // vars: desired != live
	Present  Status = "present"  // secrets/dependabot: name exists on github
	Missing  Status = "missing"  // intent name absent on github
	Extra    Status = "extra"    // on github, not in YAML, not ignored
	Ignored  Status = "ignored"  // on github and explicitly ignored
)

Jump to

Keyboard shortcuts

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