commitpolicy

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package commitpolicy owns exact commit-policy facts, evaluation outcomes, and human rendering.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Presentation

func Presentation(policy Policy, outcome Outcome) (presentation.Document, error)

Presentation maps the policy-owned outcome into representation-only shapes. Rendering remains exclusively presentation's concern.

Types

type Category

type Category string

Category classifies an operational refusal without reducing it to a violation.

const (
	ConfigFailure           Category = "config"
	BaselineFailure         Category = "baseline"
	RevisionFailure         Category = "revision-resolution"
	TagPeelFailure          Category = "tag-peel"
	LinkedWorktreeFailure   Category = "linked-worktree"
	TrustFileFailure        Category = "temporary-trust-file"
	SignatureProcessFailure Category = "signature-process"
)

type Commit

type Commit struct {
	ID                string
	Author, Committer Person
	Signature         SignatureVerdict
}

Commit is the immutable fact set evaluated for one full object ID.

type Field

type Field string

Field identifies the exact commit fact that violated policy.

const (
	AuthorField    Field = "author"
	CommitterField Field = "committer"
	SignatureField Field = "signature"
)

type Identity

type Identity struct{ Name, Email string }

Identity is one exact permitted Git name and email pair.

type Outcome

type Outcome struct {
	Disabled   bool
	Violations []Violation
	Refusal    *Refusal
}

Outcome is the complete result of one policy operation.

func Evaluate

func Evaluate(policy Policy, commits []Commit) Outcome

Evaluate applies policy to unique commit facts and returns every mismatch in stable commit and field order.

func (Outcome) OK

func (o Outcome) OK() bool

OK reports whether the operation had neither violations nor an operational refusal.

type Person

type Person struct{ Name, Email string }

Person is the byte-for-byte author or committer identity recorded in a commit.

type Policy

type Policy struct {
	AllowedIdentities []Identity
	RequireSigned     bool
	AllowedSigners    []Signer
}

Policy is the validated exact-commit policy supplied by project composition.

type Refusal

type Refusal struct {
	Category                  Category
	Observed                  string
	RefsChanged, IndexChanged bool
	Actions                   []string
	Cause                     error
}

Refusal reports an operational failure, its preserved cause, and reconciliation facts.

type SignatureVerdict

type SignatureVerdict int

SignatureVerdict is the native SSH verification result for one commit.

const (
	SignatureValid SignatureVerdict = iota
	SignatureMissing
	SignatureMalformed
	SignatureWrongKey
)

type Signer

type Signer struct{ Principal, Key string }

Signer is one permitted SSH signing principal and public key pair.

type Violation

type Violation struct {
	Commit   string
	Field    Field
	Observed string
}

Violation is one stable, actionable policy mismatch.

Jump to

Keyboard shortcuts

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