Documentation
¶
Overview ¶
Package worktreebranches owns branch selection, cleanup policy, and reviewed supersession receipt proof.
Index ¶
- Constants
- func AccumulateRetiredCounts(sweep PolicyOptions, repositorySlug string, refs []BranchRef, scope string, ...)
- func BranchInUseKey(repository, branch string) string
- func BranchNameSelected(sweep PolicyOptions, name string) bool
- func DependencyManifestValue(delta SupersessionDependencyDelta, contents []byte) (string, bool, error)
- func DependencyVersionSatisfies(ecosystem, candidate, requested string) bool
- func EligibleBranchCleanupDisposition(entry BranchEntry) bool
- func IsDependencyManifestOrImporter(file string) bool
- func IsProtectedBranch(branch, base, canonicalHEAD string) bool
- func IsRetiredBranch(branch string) bool
- func LockfileEntryContainsVersion(ecosystem, lockfilePath, contents, selector, version string) bool
- func MustAtoi(value string) int
- func NormalizeDependencyVersion(value string) string
- func NpmComparatorSatisfies(candidate, constraint string) bool
- func NpmRangeAlternativeSatisfies(candidate, requested string) bool
- func ParseLockfileSelector(ecosystem, lockfilePath, selector, packageName string) ([]string, bool)
- func PeerEvidenceSafeDisposition(disposition string) bool
- func ProtectedEvidence(branch, base, canonicalHEAD string) string
- func RemotePullRequestEvidenceUnavailable(entries []BranchEntry, sweep PolicyOptions) bool
- func ReportBranchProgress(out io.Writer, index, total int, repository string)
- func ReportBranchSummary(out io.Writer, totals map[string]int, elapsed time.Duration)
- func RetiredBranchDestination(now time.Time, source, sha string) string
- func RetiredNamespaceSelected(sweep PolicyOptions) bool
- func RetiredRefSelected(sweep PolicyOptions, ref BranchRef) bool
- func ScopeIncludesRemote(scope string) bool
- func SelectorNamesExactPackage(selector, packageName string) bool
- func SelectorPackageFromLockfileSelector(selector string) string
- func ShortSHA(sha string) string
- func SkipReasonForDisposition(entry BranchEntry) string
- func SortBranchEntries(entries []BranchEntry)
- func TallyCleanupOutcomes(results []BranchCleanupResult) map[string]int
- func TallyDispositions(entries []BranchEntry) map[string]int
- func ValidateAuthoritativeSourcePullRequest(receipt SupersessionReceipt, entry SupersessionEntry) string
- func ValidateDependencyManifest(delta SupersessionDependencyDelta, contents []byte, expectedVersion string, ...) string
- func ValidatePeerEvidence(request PeerEvidenceValidation) error
- type BranchCleanupResult
- type BranchEntry
- type BranchPullRequest
- type BranchQuarantineRequest
- type BranchQuarantineResult
- type BranchRef
- type BranchUse
- type GitHubPullRequest
- type GitHubRef
- type GitHubRepository
- type InventoryPorts
- type InventoryService
- func (service InventoryService) AppendRetiredEntries(ctx context.Context, entries *[]BranchEntry, names map[string]bool, ...) int
- func (service InventoryService) AppendRetiredRefEntries(ctx context.Context, entries *[]BranchEntry, names map[string]bool, ...) int
- func (service InventoryService) AppendRetiredTagEntries(ctx context.Context, entries *[]BranchEntry, names map[string]bool, ...) int
- func (service InventoryService) BranchEvidenceHost() string
- func (service InventoryService) BranchInUseIndex(ctx context.Context, projectsRoot, filter string) (map[string]string, string)
- func (service InventoryService) BranchPullRequestsForHeadState(ctx context.Context, repository Repository, branch, headState string) PullRequestEvidence
- func (service InventoryService) CheckedOutLocalBranches(ctx context.Context, repositoryPath string) (map[string]bool, string)
- func (service InventoryService) ClassifyAbsorbedOrUnique(ctx context.Context, repositoryPath, targetSHA, branchSHA string) (absorbed bool, evidence string, uniqueCount int, err error)
- func (service InventoryService) ClassifyAttestedReceipt(ctx context.Context, repository Repository, ref BranchRef, ...) (*worktreelanding.VerifiedCandidate, string, error)
- func (service InventoryService) ClassifyBranch(ctx context.Context, repository Repository, sweep InventorySweep, ...) BranchEntry
- func (service InventoryService) ClassifyFleetBranches(ctx context.Context, sweep InventorySweep) ([]BranchEntry, []string, error)
- func (service InventoryService) ClassifyFleetBranchesWithPaths(ctx context.Context, sweep InventorySweep) ([]BranchEntry, []string, map[string]string, error)
- func (service InventoryService) ClassifyLandingReceipt(ctx context.Context, repository Repository, ref BranchRef, ...) (*PullRequest, string)
- func (service InventoryService) CountRetiredBranches(ctx context.Context, sweep InventorySweep) (map[string]int, int, map[string]int, int, bool, []string)
- func (service InventoryService) DecorateBranchCommit(ctx context.Context, repositoryPath string, entry *BranchEntry)
- func (service InventoryService) DecorateBranchCommits(ctx context.Context, repositoryPath string, entries []BranchEntry)
- func (service InventoryService) DecorateRemoteBranchPullRequests(ctx context.Context, repository Repository, ref BranchRef, entry *BranchEntry, ...)
- func (service InventoryService) DiscoverBranchRepositories(projectsRoot, filter string) ([]Repository, error)
- func (service InventoryService) ExactBranchPullRequests(ctx context.Context, repository Repository, branch string) PullRequestEvidence
- func (service InventoryService) FetchRemoteRefs(ctx context.Context, repositoryPath, refspec, refPrefix, failureLabel string) ([]BranchRef, string)
- func (service InventoryService) InspectBranchQuarantineCandidate(ctx context.Context, projectsRoot, path string, ...) (string, string)
- func (service InventoryService) InspectRepositoryBranches(ctx context.Context, repository Repository, sweep InventorySweep, ...) ([]BranchEntry, string)
- func (service InventoryService) InspectRepositoryBranchesWithHeartbeat(ctx context.Context, repository Repository, sweep InventorySweep, ...) ([]BranchEntry, string)
- func (service InventoryService) InventoryRetiredNamespace(ctx context.Context, sweep InventorySweep, generatedAt time.Time) (RetiredInventory, error)
- func (service InventoryService) ListLocalRefs(ctx context.Context, repositoryPath string) ([]BranchRef, string)
- func (service InventoryService) ListRefs(ctx context.Context, repositoryPath, refPrefix, namePrefix string) ([]BranchRef, string)
- func (service InventoryService) ListRemoteRefs(ctx context.Context, repositoryPath string) ([]BranchRef, string)
- func (service InventoryService) ListRetiredRemoteRefs(ctx context.Context, repositoryPath string) ([]BranchRef, string)
- func (service InventoryService) ListRetiredTags(ctx context.Context, repositoryPath string, remote, metadata bool) ([]BranchRef, string)
- func (service InventoryService) OpenBranchPullRequests(ctx context.Context, repository Repository, branch string) PullRequestEvidence
- func (service InventoryService) PlanBranchQuarantine(ctx context.Context, projectsRoot, path string, ...) BranchQuarantineResult
- func (service InventoryService) QueryBranchPullRequests(ctx context.Context, repository Repository, query url.Values) ([]GitHubPullRequest, error)
- type InventorySweep
- type PeerEvidence
- type PeerEvidenceValidation
- type PolicyOptions
- type PullRequest
- type PullRequestEvidence
- type Repository
- type RepositoryInspection
- type RetiredInventory
- type SupersessionApproval
- type SupersessionDependencyDelta
- type SupersessionEntry
- type SupersessionEvidence
- type SupersessionPorts
- type SupersessionReceipt
- type SupersessionReplacement
- type SupersessionResidual
- type SupersessionService
- func (service SupersessionService) DependencyCampaignWorktree(ctx context.Context, entry SupersessionEntry) bool
- func (service SupersessionService) DependencyLockfile(ctx context.Context, canonical, target string, ...) (string, bool, error)
- func (service SupersessionService) SupersessionReceiptForEntry(ctx context.Context, path string, entry SupersessionEntry) (*SupersessionReceipt, string)
- func (service SupersessionService) ValidateDependencyDeltas(ctx context.Context, receipt SupersessionReceipt, entry SupersessionEntry) error
- func (service SupersessionService) ValidateDependencyDeltasReason(ctx context.Context, receipt SupersessionReceipt, entry SupersessionEntry) string
- func (service SupersessionService) ValidateSupersessionReceipt(ctx context.Context, receipt SupersessionReceipt, entry SupersessionEntry) string
- type SupersessionWorkflowAdoption
Constants ¶
const ( BranchContained = "contained" // ancestor of the fetched exact target; always eligible for deletion BranchAbsorbed = "absorbed" // patch-id/tree equal to the target, but not an ancestor; report-only, forever BranchReceipted = "receipted" // a proved landing receipt shows the work is in the target; eligible only under --receipts BranchSuperseded = "superseded" // a trusted reviewer receipt replaces the exact branch; eligible only under --superseded-by BranchRetired = "retired" // user-selected quarantine; never an active-backlog candidate BranchUnique = "unique" // has content git cherry proves is not upstream BranchProtected = "protected" // base, canonical HEAD, or a protected name BranchInUse = "in-use" // checked out in a linked worktree, or named by a WB Work Log claim BranchUnreadable = "unreadable" // required evidence could not be obtained )
const ( BranchScopeLocal = "local" BranchScopeRemote = "remote" BranchScopeAll = "all" )
Variables ¶
This section is empty.
Functions ¶
func AccumulateRetiredCounts ¶
func BranchInUseKey ¶
func BranchNameSelected ¶
func BranchNameSelected(sweep PolicyOptions, name string) bool
func DependencyManifestValue ¶
func DependencyManifestValue(delta SupersessionDependencyDelta, contents []byte) (string, bool, error)
func DependencyVersionSatisfies ¶
DependencyVersionSatisfies applies the version semantics of the supported ecosystem instead of treating a requested range as a literal string. npm ranges commonly arrive as ^ or ~ constraints; Go module requirements remain exact versions here. Unknown syntax fails closed.
func EligibleBranchCleanupDisposition ¶
func EligibleBranchCleanupDisposition(entry BranchEntry) bool
func IsProtectedBranch ¶
func IsRetiredBranch ¶
func NpmComparatorSatisfies ¶
func ParseLockfileSelector ¶
ParseLockfileSelector accepts only the selectors emitted by the dependency campaign report. Package identity is parsed as a token, never searched as a substring, so nx cannot be proven by nxfoo or @nx/js.
func ProtectedEvidence ¶
func RemotePullRequestEvidenceUnavailable ¶
func RemotePullRequestEvidenceUnavailable(entries []BranchEntry, sweep PolicyOptions) bool
func ReportBranchProgress ¶
func ReportBranchSummary ¶
func RetiredNamespaceSelected ¶
func RetiredNamespaceSelected(sweep PolicyOptions) bool
func RetiredRefSelected ¶
func RetiredRefSelected(sweep PolicyOptions, ref BranchRef) bool
func ScopeIncludesRemote ¶
func SkipReasonForDisposition ¶
func SkipReasonForDisposition(entry BranchEntry) string
func SortBranchEntries ¶
func SortBranchEntries(entries []BranchEntry)
func TallyCleanupOutcomes ¶
func TallyCleanupOutcomes(results []BranchCleanupResult) map[string]int
func TallyDispositions ¶
func TallyDispositions(entries []BranchEntry) map[string]int
func ValidateAuthoritativeSourcePullRequest ¶
func ValidateAuthoritativeSourcePullRequest(receipt SupersessionReceipt, entry SupersessionEntry) string
func ValidateDependencyManifest ¶
func ValidateDependencyManifest(delta SupersessionDependencyDelta, contents []byte, expectedVersion string, exact bool) string
func ValidatePeerEvidence ¶
func ValidatePeerEvidence(request PeerEvidenceValidation) error
Types ¶
type BranchCleanupResult ¶
type BranchCleanupResult struct {
BranchEntry
Eligible bool `json:"eligible"`
SkipReason string `json:"skip_reason,omitempty"`
Applied bool `json:"applied"`
Outcome string `json:"outcome"` // planned, deleted, skipped, or failed
Error string `json:"error,omitempty"`
RecoveryBundle string `json:"recovery_bundle,omitempty"`
}
func PlanBranchCleanup ¶
func PlanBranchCleanup(entries []BranchEntry, sweep PolicyOptions) []BranchCleanupResult
type BranchEntry ¶
type BranchEntry struct {
Repository string `json:"repository"`
Branch string `json:"branch"`
RefKind string `json:"ref_kind,omitempty"` // branch or tag
Scope string `json:"scope"` // local or remote
SHA string `json:"sha"`
ShortSHA string `json:"short_sha"`
CommitterDate time.Time `json:"committer_date,omitempty"`
Author string `json:"author,omitempty"`
Title string `json:"title,omitempty"`
Base string `json:"base"`
TargetSHA string `json:"target_sha,omitempty"`
Disposition string `json:"disposition"`
Evidence string `json:"evidence"`
Reason string `json:"reason,omitempty"`
Task string `json:"task,omitempty"`
OpenPullRequest *PullRequest `json:"open_pull_request,omitempty"`
OpenBasePullRequest *PullRequest `json:"open_base_pull_request,omitempty"`
PullRequests []BranchPullRequest `json:"pull_requests,omitempty"`
PullRequestQueried bool `json:"pull_request_queried,omitempty"`
PullRequestQueryError string `json:"pull_request_query_error,omitempty"`
// LandingSHA and ReceiptPullRequest carry a receipted branch's proved
// landing so apply can re-verify the receipt — not ancestry, which a
// receipted branch fails by construction — against the freshly fetched
// target. See #req:receipted-requires-a-proved-landing.
LandingSHA string `json:"landing_sha,omitempty"`
ReceiptPullRequest *PullRequest `json:"receipt_pull_request,omitempty"`
// PullRequestQueryFailed distinguishes "no matching pull request" from
// "WB could not ask GitHub." Cleanup's remote apply fails the whole scope
// closed on the latter; list surfaces the specific error.
PullRequestQueryFailed bool `json:"pull_request_query_failed,omitempty"`
// AbsorbedByRejection explains why an operator-supplied --absorbed-by
// pointer did not verify for this branch. It is set only when
// --absorbed-by was passed and its attested-absorption proof (see
// attestedAbsorbedReceipt, shared with `wb worktree cleanup
// --absorbed-by`) failed for this candidate specifically; the branch keeps
// whatever disposition its patch evidence (or --receipts) produces. A
// wrong or dishonest pointer can therefore only fail closed, never widen
// eligibility, and the rejection is reported rather than silently
// swallowed.
AbsorbedByRejection string `json:"absorbed_by_rejection,omitempty"`
SupersessionReceipt string `json:"supersession_receipt,omitempty"`
SupersessionReviewer string `json:"supersession_reviewer,omitempty"`
SupersessionReceiptID string `json:"supersession_receipt_id,omitempty"`
SupersessionSHA256 string `json:"supersession_sha256,omitempty"`
SupersessionRejection string `json:"supersession_rejection,omitempty"`
SupersededAtOrigin bool `json:"superseded_at_origin,omitempty"`
}
func ApplyListDisplayFilters ¶
func ApplyListDisplayFilters(entries []BranchEntry, sweep PolicyOptions) []BranchEntry
func ReceiptedBranch ¶
func ReceiptedBranch(entry BranchEntry, landingSHA string, pullRequest *PullRequest, absorbedBy string) BranchEntry
func RetiredBranchEntry ¶
func RetiredBranchEntry(repositorySlug string, sweep PolicyOptions, ref BranchRef, scope, targetSHA string) BranchEntry
type BranchPullRequest ¶
type BranchPullRequest struct {
Number int `json:"number"`
URL string `json:"url"`
Role string `json:"role"` // head or base
State string `json:"state"` // open, merged, or closed
Head string `json:"head"`
Base string `json:"base"`
HeadSHA string `json:"head_sha"`
MergeSHA string `json:"merge_sha,omitempty"`
MergedAt *time.Time `json:"merged_at,omitempty"`
}
type BranchQuarantineRequest ¶
type BranchQuarantineRequest struct {
Repository string `json:"repository"`
Ref string `json:"ref"`
SHA string `json:"sha"`
Reason string `json:"reason"`
}
BranchQuarantineRequest identifies one exact local ref selected for retirement.
type BranchQuarantineResult ¶
type BranchQuarantineResult struct {
BranchQuarantineRequest
Destination string `json:"destination,omitempty"`
Outcome string `json:"outcome"`
Error string `json:"error,omitempty"`
}
type GitHubPullRequest ¶
type GitHubPullRequest = worktreelanding.GitHubPullRequest
GitHubPullRequest is only the GitHub response shape consumed by inventory. It is not trusted as a landing receipt until the exact Git proof succeeds.
type GitHubRef ¶
type GitHubRef = worktreelanding.GitHubRef
type GitHubRepository ¶
type GitHubRepository = worktreelanding.GitHubRepository
type InventoryPorts ¶
type InventoryPorts struct {
Discover func(string) ([]Repository, error)
ListInUse func(context.Context, string, string) ([]BranchUse, error)
Git worktreeproof.GitQuery
CheckedOut func(context.Context, string) (map[string]bool, string)
InUse func(context.Context, string, string) (map[string]string, string)
OpenHeadPull func(context.Context, string, string, string, string) (*PullRequest, error)
OpenBasePull func(context.Context, string, string, string) (*PullRequest, error)
FetchTarget func(context.Context, string, string) (string, error)
IsAncestor func(context.Context, string, string, string) (bool, error)
ContentContained func(context.Context, string, string, string) (bool, error)
CommitTree func(context.Context, string, string) (string, error)
Supersession func(context.Context, string, Repository, BranchRef, string, string) (*SupersessionEvidence, string)
SupersessionDigest func(string) (string, error)
AttestedReceipt func(context.Context, Repository, BranchRef, string, string, string) (*worktreelanding.VerifiedCandidate, string, error)
PullRequestsForHead func(context.Context, Repository, string) ([]GitHubPullRequest, error)
AbsorbingPR func([]GitHubPullRequest, string) *PullRequest
PullRequestAPI func(context.Context, string, string) ([]byte, error)
HostName func() (string, error)
TempDir func() (string, error)
RemoveDir func(string) error
}
InventoryPorts supplies host, repository, Git and hosted-PR observations. An inventory service has no package-global callbacks or hidden Git runner.
type InventoryService ¶
type InventoryService struct{ Ports InventoryPorts }
func (InventoryService) AppendRetiredEntries ¶
func (service InventoryService) AppendRetiredEntries(ctx context.Context, entries *[]BranchEntry, names map[string]bool, repository Repository, sweep InventorySweep, refs []BranchRef, scope string) int
func (InventoryService) AppendRetiredRefEntries ¶
func (service InventoryService) AppendRetiredRefEntries(ctx context.Context, entries *[]BranchEntry, names map[string]bool, repository Repository, sweep InventorySweep, refs []BranchRef, scope, refKind string) int
func (InventoryService) AppendRetiredTagEntries ¶
func (service InventoryService) AppendRetiredTagEntries(ctx context.Context, entries *[]BranchEntry, names map[string]bool, repository Repository, sweep InventorySweep, refs []BranchRef, scope string) int
func (InventoryService) BranchEvidenceHost ¶
func (service InventoryService) BranchEvidenceHost() string
func (InventoryService) BranchInUseIndex ¶
func (InventoryService) BranchPullRequestsForHeadState ¶
func (service InventoryService) BranchPullRequestsForHeadState(ctx context.Context, repository Repository, branch, headState string) PullRequestEvidence
func (InventoryService) CheckedOutLocalBranches ¶
func (InventoryService) ClassifyAbsorbedOrUnique ¶
func (InventoryService) ClassifyAttestedReceipt ¶
func (service InventoryService) ClassifyAttestedReceipt(ctx context.Context, repository Repository, ref BranchRef, base, targetSHA, absorbedBy string) (*worktreelanding.VerifiedCandidate, string, error)
func (InventoryService) ClassifyBranch ¶
func (service InventoryService) ClassifyBranch(ctx context.Context, repository Repository, sweep InventorySweep, ref BranchRef, scope, targetSHA, canonicalHEAD string, inUse map[string]string, checkedOut map[string]bool, pullRequestCache map[string][]GitHubPullRequest) BranchEntry
ClassifyBranch applies the evidence precedence used by both inventory and cleanup. All network, Git, and receipt observations come from this instance.
func (InventoryService) ClassifyFleetBranches ¶
func (service InventoryService) ClassifyFleetBranches(ctx context.Context, sweep InventorySweep) ([]BranchEntry, []string, error)
func (InventoryService) ClassifyFleetBranchesWithPaths ¶
func (service InventoryService) ClassifyFleetBranchesWithPaths(ctx context.Context, sweep InventorySweep) ([]BranchEntry, []string, map[string]string, error)
func (InventoryService) ClassifyLandingReceipt ¶
func (service InventoryService) ClassifyLandingReceipt(ctx context.Context, repository Repository, ref BranchRef, base, targetSHA string, cache map[string][]GitHubPullRequest) (*PullRequest, string)
func (InventoryService) CountRetiredBranches ¶
func (InventoryService) DecorateBranchCommit ¶
func (service InventoryService) DecorateBranchCommit(ctx context.Context, repositoryPath string, entry *BranchEntry)
func (InventoryService) DecorateBranchCommits ¶
func (service InventoryService) DecorateBranchCommits(ctx context.Context, repositoryPath string, entries []BranchEntry)
func (InventoryService) DecorateRemoteBranchPullRequests ¶
func (service InventoryService) DecorateRemoteBranchPullRequests(ctx context.Context, repository Repository, ref BranchRef, entry *BranchEntry, cache map[string]PullRequestEvidence, withHistory bool)
DecorateRemoteBranchPullRequests caches by exact branch name so one sweep never asks GitHub twice for the same head/base evidence.
func (InventoryService) DiscoverBranchRepositories ¶
func (service InventoryService) DiscoverBranchRepositories(projectsRoot, filter string) ([]Repository, error)
func (InventoryService) ExactBranchPullRequests ¶
func (service InventoryService) ExactBranchPullRequests(ctx context.Context, repository Repository, branch string) PullRequestEvidence
func (InventoryService) FetchRemoteRefs ¶
func (InventoryService) InspectBranchQuarantineCandidate ¶
func (service InventoryService) InspectBranchQuarantineCandidate( ctx context.Context, projectsRoot, path string, request BranchQuarantineRequest, destination string, applying bool, ) (string, string)
InspectBranchQuarantineCandidate keeps the plan and apply proofs distinct: both inspect current evidence, while apply also checks the destination and repeats the live claim check immediately before the caller's CAS rename.
func (InventoryService) InspectRepositoryBranches ¶
func (service InventoryService) InspectRepositoryBranches(ctx context.Context, repository Repository, sweep InventorySweep, inUse map[string]string) ([]BranchEntry, string)
func (InventoryService) InspectRepositoryBranchesWithHeartbeat ¶
func (service InventoryService) InspectRepositoryBranchesWithHeartbeat(ctx context.Context, repository Repository, sweep InventorySweep, inUse map[string]string, index, total int, interval time.Duration, inspect RepositoryInspection) ([]BranchEntry, string)
func (InventoryService) InventoryRetiredNamespace ¶
func (service InventoryService) InventoryRetiredNamespace(ctx context.Context, sweep InventorySweep, generatedAt time.Time) (RetiredInventory, error)
func (InventoryService) ListLocalRefs ¶
func (InventoryService) ListRemoteRefs ¶
func (InventoryService) ListRetiredRemoteRefs ¶
func (InventoryService) ListRetiredTags ¶
func (InventoryService) OpenBranchPullRequests ¶
func (service InventoryService) OpenBranchPullRequests(ctx context.Context, repository Repository, branch string) PullRequestEvidence
func (InventoryService) PlanBranchQuarantine ¶
func (service InventoryService) PlanBranchQuarantine(ctx context.Context, projectsRoot, path string, request BranchQuarantineRequest, now time.Time) BranchQuarantineResult
PlanBranchQuarantine proves the source is safe to rename and reserves its deterministic destination in the plan. Apply must repeat the proof.
func (InventoryService) QueryBranchPullRequests ¶
func (service InventoryService) QueryBranchPullRequests(ctx context.Context, repository Repository, query url.Values) ([]GitHubPullRequest, error)
type InventorySweep ¶
type InventorySweep struct {
ProjectsRoot, Base, Scope, Only, Filter, Repository, Org, Branch, Name string
OlderThan time.Duration
Progress io.Writer
Now time.Time
Receipts, WithPRs, Cleanup, IncludeRetired bool
AbsorbedBy, SupersededBy string
}
func (InventorySweep) Policy ¶
func (s InventorySweep) Policy() PolicyOptions
type PeerEvidence ¶
type PeerEvidence struct {
Path string `json:"-"`
Host string `json:"host"`
GeneratedAt time.Time `json:"generated_at"`
Repository string `json:"repository"`
Branch string `json:"branch"`
Base string `json:"base"`
Diagnostics []string `json:"diagnostics,omitempty"`
Entries []BranchEntry `json:"entries"`
}
PeerEvidence is decoded inventory evidence; the facade owns file reads.
type PeerEvidenceValidation ¶
type PeerEvidenceValidation struct {
LocalHost, Repository, Branch, Base string
RequireHosts []string
Evidence []PeerEvidence
Results []BranchCleanupResult
Now time.Time
}
type PolicyOptions ¶
type PolicyOptions struct {
Base, Scope, Only, Branch, Name string
OlderThan time.Duration
Now time.Time
}
PolicyOptions contains only the selection and planning inputs consumed by pure policy.
type PullRequest ¶
type PullRequest = worktreeproof.PullRequest
type PullRequestEvidence ¶
type PullRequestEvidence struct {
Requests []BranchPullRequest
OpenHead *PullRequest
OpenBase *PullRequest
Err error
}
type Repository ¶
Repository is the branch inventory's view of a discovered canonical clone. Discovery and admission remain with the facade.
func SelectBranchRepositories ¶
func SelectBranchRepositories(repositories []Repository, repositorySlug, org string) ([]Repository, error)
type RepositoryInspection ¶
type RepositoryInspection func(context.Context, Repository, InventorySweep, map[string]string) ([]BranchEntry, string)
type RetiredInventory ¶
type SupersessionApproval ¶
type SupersessionApproval = worktreeproof.SupersessionApproval
type SupersessionDependencyDelta ¶
type SupersessionDependencyDelta = worktreeproof.SupersessionDependencyDelta
func DependencyDeltasForValidation ¶
func DependencyDeltasForValidation(receipt SupersessionReceipt, entry SupersessionEntry) ([]SupersessionDependencyDelta, string)
type SupersessionEntry ¶
type SupersessionEntry struct {
Task, Repository, Branch, Base, HeadSHA, RemoteTargetSHA string
CanonicalDir, WorktreeDir string
OpenPullRequest *PullRequest
}
SupersessionEntry captures only the live identities needed to verify a reviewed replacement against an exact source and fetched target.
type SupersessionEvidence ¶
type SupersessionPorts ¶
type SupersessionPorts struct {
Git worktreeproof.GitQuery
ReadGitFileBytes func(context.Context, string, string, string) ([]byte, error)
IsAncestor func(context.Context, string, string, string) (bool, error)
ReadReceipt func(string) ([]byte, error)
ReadCampaignMarker func(string) (bool, error)
}
SupersessionPorts supplies read-only observations. The facade retains the worktree, claim, and deletion transactions that consume a verified receipt.
type SupersessionReceipt ¶
type SupersessionReceipt = worktreeproof.SupersessionReceipt
Shared receipt contracts are neutral proof data; branch policy verifies them.
type SupersessionReplacement ¶
type SupersessionReplacement = worktreeproof.SupersessionReplacement
type SupersessionResidual ¶
type SupersessionResidual = worktreeproof.SupersessionResidual
type SupersessionService ¶
type SupersessionService struct{ Ports SupersessionPorts }
func (SupersessionService) DependencyCampaignWorktree ¶
func (service SupersessionService) DependencyCampaignWorktree(ctx context.Context, entry SupersessionEntry) bool
func (SupersessionService) DependencyLockfile ¶
func (service SupersessionService) DependencyLockfile(ctx context.Context, canonical, target string, delta SupersessionDependencyDelta) (string, bool, error)
func (SupersessionService) SupersessionReceiptForEntry ¶
func (service SupersessionService) SupersessionReceiptForEntry(ctx context.Context, path string, entry SupersessionEntry) (*SupersessionReceipt, string)
SupersessionReceiptForEntry loads and independently verifies one receipt against the current exact source and fetched target identities.
func (SupersessionService) ValidateDependencyDeltas ¶
func (service SupersessionService) ValidateDependencyDeltas(ctx context.Context, receipt SupersessionReceipt, entry SupersessionEntry) error
ValidateDependencyDeltas exposes the same fail-closed dependency proof used by supersession cleanup to campaign/report integrations and their tests. Callers must provide the live SupersessionEntry, including authoritative PR data.
func (SupersessionService) ValidateDependencyDeltasReason ¶
func (service SupersessionService) ValidateDependencyDeltasReason(ctx context.Context, receipt SupersessionReceipt, entry SupersessionEntry) string
ValidateDependencyDeltasReason is called while source and target identities are still the exact ones used for cleanup. Generic worktree receipts retain their existing schema; dependency PR receipts opt into this fail-closed proof boundary.
func (SupersessionService) ValidateSupersessionReceipt ¶
func (service SupersessionService) ValidateSupersessionReceipt(ctx context.Context, receipt SupersessionReceipt, entry SupersessionEntry) string
type SupersessionWorkflowAdoption ¶
type SupersessionWorkflowAdoption = worktreeproof.SupersessionWorkflowAdoption