contract

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDisabled             = errors.New("contract enforcement is disabled")
	ErrInvalidDatasetFilter = errors.New("dataset filter must be in namespace/name form")
)

Functions

func Enabled

func Enabled() bool

func EnforcementMode

func EnforcementMode() string

EnforcementMode reads the W2-delta REST gate directly until C1's env accessor lands in pkg/env and W3 can unify callers on that typed field.

func RecordFindings

func RecordFindings(graph internalcontract.Graph)

func ScopeGraphToDefinitions

func ScopeGraphToDefinitions(graph internalcontract.Graph, defs []schema.Definition) internalcontract.Graph

ScopeGraphToDefinitions narrows a derived contract graph to the contracts the given definition batch actually participates in. Graph derivation unions the incoming definitions with every job persisted on the server, so the raw graph carries breaking producer/consumer pairs between jobs the caller never mentioned. Lint and check surfaces gate on breaking findings, so they must report the scoped subgraph: the batch's own jobs plus their direct producers and consumers on the server.

Types

type Finding

type Finding struct {
	EdgeID    string                       `json:"edgeId,omitempty"`
	EdgeClass internalcontract.EdgeClass   `json:"edgeClass,omitempty"`
	From      string                       `json:"from,omitempty"`
	To        string                       `json:"to,omitempty"`
	Dataset   *internalcontract.DatasetRef `json:"dataset,omitempty"`
	Kind      schemacompat.FindingKind     `json:"kind,omitempty"`
	Path      string                       `json:"path,omitempty"`
	Key       string                       `json:"key,omitempty"`
	Detail    string                       `json:"detail,omitempty"`
	Verdict   schemacompat.Verdict         `json:"verdict"`
}

func FilterFindingsForAlias

func FilterFindingsForAlias(all []Finding, alias string) []Finding

FilterFindingsForAlias filters an already-materialized findings list, so callers iterating many aliases compute FindingsFromGraph once. The node ID comes from the graph package's canonical helper rather than a duplicated format string.

func FindingsForAlias

func FindingsForAlias(graph internalcontract.Graph, alias string) []Finding

func FindingsFromGraph

func FindingsFromGraph(graph internalcontract.Graph) []Finding

type FindingsSummary

type FindingsSummary struct {
	Breaking []Finding `json:"breaking"`
	Warnings []Finding `json:"warnings"`
	Edges    int       `json:"edges"`
}

func SummaryFromGraph

func SummaryFromGraph(graph internalcontract.Graph) FindingsSummary

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context) *Service

func (*Service) Graph

func (s *Service) Graph(dataset string, incoming []schema.Definition) (*internalcontract.Graph, error)

func (*Service) WithDatabase

func (s *Service) WithDatabase(conn *gorm.DB) *Service

Jump to

Keyboard shortcuts

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