Help us shape the future of Go! Take the 2026 Go Developer Survey

mergecontrol

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const CheckFreshness = 24 * time.Hour

Variables

This section is empty.

Functions

func StaleChecks

func StaleChecks(checks []forge.Check, head string, now time.Time) bool

Types

type Authority

type Authority struct {
	Blockers               []string
	CIConfigSHA256         string
	ExecutionPublisher     string
	CompanionsBlocked      bool
	PathsVerified          bool
	ValidationHead         string
	ValidationTarget       string
	ValidationReference    string
	MergeControlled        bool
	CooperationVerified    bool
	Qualified              bool
	ExactHeadEnforced      bool
	QualificationReference string
	ReforgeEnforced        bool
	Paths                  []string
	Usage                  policy.Limits
}

type AuthorityBlocker

type AuthorityBlocker struct{ Reason string }

func (*AuthorityBlocker) Error

func (b *AuthorityBlocker) Error() string

type Companion

type Companion struct {
	TaskID           string             `json:"task_id"`
	FindingID        string             `json:"finding_id"`
	ChangeID         string             `json:"change_id"`
	HeadSHA          string             `json:"head_sha"`
	ObservedHeadSHA  string             `json:"observed_head_sha"`
	Branch           string             `json:"branch"`
	TargetBranch     string             `json:"target_branch"`
	SourceChangeID   string             `json:"source_change_id"`
	SourceHeadSHA    string             `json:"source_head_sha"`
	SourceBranch     string             `json:"source_branch"`
	OwnerReplacement bool               `json:"owner_replacement"`
	ReplacesBranch   string             `json:"replaces_branch,omitempty"`
	MergeSHA         string             `json:"merge_sha"`
	Supersession     []ReplacementProof `json:"supersession,omitempty"`
	State            string             `json:"state"`
}

type Configuration

type Configuration struct {
	RepositoryID          string            `json:"repository_id"`
	Version               int64             `json:"version"`
	Enabled               bool              `json:"enabled"`
	InspectorConnectionID string            `json:"inspector_connection_id,omitempty"`
	CheckPublishers       map[string]string `json:"check_publishers"`
	CooperationReference  string            `json:"cooperation_reference"`
	Qualification         Qualification     `json:"qualification"`
}

type Gate

type Gate struct {
	ReforgeEnforced      bool           `json:"reforge_enforced,omitempty"`
	Phase                string         `json:"phase"`
	Companions           []Companion    `json:"companions"`
	Paths                []string       `json:"paths"`
	ChangedLines         int64          `json:"changed_lines"`
	ConfigurationVersion int64          `json:"configuration_version"`
	ID                   string         `json:"id"`
	RepositoryID         string         `json:"repository_id"`
	ConnectionID         string         `json:"connection_id"`
	ConnectionVersion    int64          `json:"connection_version"`
	Method               string         `json:"method"`
	Snapshot             Snapshot       `json:"snapshot"`
	Decision             policy.Result  `json:"decision"`
	Binding              policy.Binding `json:"binding"`
	ExpiresAt            time.Time      `json:"expires_at"`
}

func Evaluate

func Evaluate(snapshot Snapshot, resolved policy.Resolved, method string, authority Authority, now time.Time) Gate

type Operation

type Operation struct {
	ID              string             `json:"id"`
	RepositoryID    string             `json:"repository_id"`
	GateID          string             `json:"gate_id"`
	RequestedGateID string             `json:"requested_gate_id"`
	NativeQueueID   string             `json:"native_queue_id,omitempty"`
	ChangeID        string             `json:"change_id"`
	State           string             `json:"state"`
	Reason          string             `json:"reason"`
	CancelRequested bool               `json:"cancel_requested"`
	NativeResult    *forge.MergeResult `json:"native_result,omitempty"`
	Version         int64              `json:"version"`
	CreatedAt       time.Time          `json:"created_at"`
	UpdatedAt       time.Time          `json:"updated_at"`
}

type Qualification

type Qualification struct {
	CIConfigSHA256     string    `json:"ci_config_sha256,omitempty"`
	Provider           string    `json:"provider"`
	ServerVersion      string    `json:"server_version"`
	ConnectionVersion  int64     `json:"connection_version"`
	InspectorVersion   int64     `json:"inspector_version"`
	EvidenceReference  string    `json:"evidence_reference"`
	EvidenceSHA256     string    `json:"evidence_sha256"`
	VerifiedAt         time.Time `json:"verified_at"`
	ExpiresAt          time.Time `json:"expires_at"`
	ExactHead          bool      `json:"exact_head"`
	StrictTarget       bool      `json:"strict_target"`
	QueueExecutionGate bool      `json:"queue_execution_gate"`
}

type ReplacementProof

type ReplacementProof struct {
	TaskID          string `json:"task_id"`
	FindingID       string `json:"finding_id"`
	ChangeID        string `json:"change_id"`
	CandidateSHA    string `json:"candidate_sha"`
	Branch          string `json:"branch"`
	TargetBranch    string `json:"target_branch"`
	SourceChangeID  string `json:"source_change_id"`
	SourceHeadSHA   string `json:"source_head_sha"`
	SourceBranch    string `json:"source_branch"`
	ObservedHeadSHA string `json:"observed_head_sha"`
	MergeSHA        string `json:"merge_sha"`
}

type Revalidation

type Revalidation struct {
	TaskID      string     `json:"task_id"`
	ChangeID    string     `json:"change_id"`
	CompanionID string     `json:"companion_id"`
	State       string     `json:"state"`
	Reason      string     `json:"reason"`
	ObservedAt  *time.Time `json:"observed_at"`
	Gate        *Gate      `json:"gate,omitempty"`
}

type Service

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

func New

func New(db *store.Store, identity *auth.Service, connections *connections.Service, policies *policy.Service, providers providers.Client) *Service

func (*Service) Cancel

func (s *Service) Cancel(ctx context.Context, session auth.Session, org, id string, expected int64, request string) (Operation, error)

func (*Service) Config

func (s *Service) Config(ctx context.Context, session auth.Session, org, repo string) (Configuration, error)

func (*Service) Get

func (s *Service) Get(ctx context.Context, session auth.Session, org, id string) (Operation, error)

func (*Service) Inspect

func (s *Service) Inspect(ctx context.Context, session auth.Session, org, repo, change, method, request string) (Gate, error)

func (*Service) List

func (s *Service) List(ctx context.Context, session auth.Session, org, repo, change, cursor string, limit int) (domain.Page[Operation], error)

func (*Service) Observe

func (s *Service) Observe(ctx context.Context, org, id string) (Operation, error)

func (*Service) ObserveBotRepair

func (s *Service) ObserveBotRepair(ctx context.Context, org, task string) error

func (*Service) PutConfig

func (s *Service) PutConfig(ctx context.Context, session auth.Session, org, repo string, in Configuration, expected int64, request string) (Configuration, error)

func (*Service) Reconcile

func (s *Service) Reconcile(ctx context.Context, session auth.Session, org, id string, expected int64, request string) (Operation, error)

func (*Service) RegisterChangeAuthority

func (s *Service) RegisterChangeAuthority(check func(context.Context, pgx.Tx, string, string, forge.MergeEvidence, domain.Actor) (string, error))

func (*Service) Request

func (s *Service) Request(ctx context.Context, session auth.Session, org, gateID, key, request string) (Operation, error)

func (*Service) Revalidations

func (s *Service) Revalidations(ctx context.Context, session auth.Session, org, repo, change string) ([]Revalidation, error)

func (*Service) Run

func (s *Service) Run(ctx context.Context) error

type Snapshot

type Snapshot = forge.MergeEvidence

Jump to

Keyboard shortcuts

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