changeinputs

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package changeinputs builds the bounded, source-derived ownership inputs attached to one exact pull-request base/head observation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hydrate

func Hydrate(
	ctx context.Context,
	rest *gh.RESTClient,
	writer *store.EntityWriter,
	class budget.Class,
	repositoryID int64,
	repositoryOwner string,
	repositoryName string,
	number int,
	node *gh.PullRequestNode,
) (*store.PullRequestChangeSnapshotRecord, error)

Hydrate preserves the direct authoritative path used by drift inspection. PR refreshes use HydrateFromMirrorConditional so ordinary sweeps reuse matching mirrored CODEOWNERS provenance.

func HydrateFromMirror added in v0.4.0

func HydrateFromMirror(
	ctx context.Context,
	rest *gh.RESTClient,
	sources *SourceResolver,
	writer *store.EntityWriter,
	class budget.Class,
	repositoryID int64,
	repositoryOwner string,
	repositoryName string,
	number int,
	node *gh.PullRequestNode,
	mirrored *store.CodeownersSourceRecord,
	forceCodeowners bool,
) (*store.PullRequestChangeSnapshotRecord, error)

HydrateFromMirror resolves the effective CODEOWNERS source from matching mirror provenance before GitHub and performs an unconditional final PR base/head fence check.

func Semantic

func Semantic(snapshot *store.PullRequestChangeSnapshotRecord) map[string]any

Semantic returns the null-safe, source-derived value embedded in drift snapshots. Source content itself is deliberately represented by its hash; consumers read the mirrored source from the public snapshot table.

Types

type PullRequestFence added in v0.4.0

type PullRequestFence struct {
	ETag string
	Pull *gh.PullRequest
}

PullRequestFence pairs the validator accepted by the final PR fence with the authoritative REST representation that produced it. Pull is nil only when the fence returned 304 and the caller's stored representation remains the validator-associated source of truth.

func HydrateFromMirrorConditional added in v0.4.0

func HydrateFromMirrorConditional(
	ctx context.Context,
	rest *gh.RESTClient,
	sources *SourceResolver,
	writer *store.EntityWriter,
	class budget.Class,
	repositoryID int64,
	repositoryOwner string,
	repositoryName string,
	number int,
	node *gh.PullRequestNode,
	mirrored *store.CodeownersSourceRecord,
	forceCodeowners bool,
	pullETag string,
) (*store.PullRequestChangeSnapshotRecord, PullRequestFence, error)

HydrateFromMirrorConditional combines mirror-first CODEOWNERS resolution with conditional changed-files and final PR-fence requests. The PR validator is reused only when the caller proved that it belongs to node's base/head representation.

type SourceResolver added in v0.4.0

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

SourceResolver reuses durable mirrored CODEOWNERS sources and collapses an invalidated repository/ref to one GitHub probe. Its bounded process-local map accelerates concurrent workers; durable snapshot provenance remains the source of reuse after eviction or restart. The mutex protects only in-memory state and is always released before external I/O (C-C6).

func NewSourceResolver added in v0.4.0

func NewSourceResolver(rest *gh.RESTClient) *SourceResolver

NewSourceResolver constructs a CODEOWNERS source resolver.

func (*SourceResolver) Resolve added in v0.4.0

func (r *SourceResolver) Resolve(
	ctx context.Context,
	class budget.Class,
	repositoryID int64,
	owner string,
	repo string,
	ref string,
	sha string,
	mirrored *store.CodeownersSourceRecord,
) (gh.CodeownersSource, error)

Resolve returns exact mirrored truth when its ref/SHA provenance matches. On invalidation, one caller refreshes the ref while peers wait without retaining a database transaction, advisory lock, or shared mutex.

Jump to

Keyboard shortcuts

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