worktreebranches

package
v0.205.12 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation ¶

Overview ¶

Package worktreebranches owns branch selection, cleanup policy, and reviewed supersession receipt proof.

Index ¶

Constants ¶

View Source
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
)
View Source
const (
	BranchScopeLocal  = "local"
	BranchScopeRemote = "remote"
	BranchScopeAll    = "all"
)
View Source
const ExactHeadReceiptNote = "exact-head"

ExactHeadReceiptNote is the note ClassifyLandingReceipt returns beside a receipt that holds only because the merged pull request's head is the branch's exact tip.

Variables ¶

This section is empty.

Functions ¶

func AccumulateRetiredCounts ¶

func AccumulateRetiredCounts(sweep PolicyOptions, repositorySlug string, refs []BranchRef, scope string, counts map[string]int, names map[string]bool)

func BranchInUseKey ¶

func BranchInUseKey(repository, branch string) string

func BranchNameSelected ¶

func BranchNameSelected(sweep PolicyOptions, name string) bool

func DependencyManifestValue ¶

func DependencyManifestValue(delta SupersessionDependencyDelta, contents []byte) (string, bool, error)

func DependencyVersionSatisfies ¶

func DependencyVersionSatisfies(ecosystem, candidate, requested string) bool

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 GitHubRevertMarker ¶

func GitHubRevertMarker(repository string, number int) string

GitHubRevertMarker is the line GitHub's "Revert" button writes into the body of the pull request that reverts pull request number of repository, and so into its squash commit. A prefix match on a longer number fails closed.

func IsDependencyManifestOrImporter ¶

func IsDependencyManifestOrImporter(file string) bool

func IsProtectedBranch ¶

func IsProtectedBranch(branch, base, canonicalHEAD string) bool

func IsRetiredBranch ¶

func IsRetiredBranch(branch string) bool

func LockfileEntryContainsVersion ¶

func LockfileEntryContainsVersion(ecosystem, lockfilePath, contents, selector, version string) bool

func MustAtoi ¶

func MustAtoi(value string) int

func NormalizeDependencyVersion ¶

func NormalizeDependencyVersion(value string) string

func NpmComparatorSatisfies ¶

func NpmComparatorSatisfies(candidate, constraint string) bool

func NpmRangeAlternativeSatisfies ¶

func NpmRangeAlternativeSatisfies(candidate, requested string) bool

func ParseLockfileSelector ¶

func ParseLockfileSelector(ecosystem, lockfilePath, selector, packageName string) ([]string, bool)

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 PeerEvidenceSafeDisposition ¶

func PeerEvidenceSafeDisposition(disposition string) bool

func ProtectedEvidence ¶

func ProtectedEvidence(branch, base, canonicalHEAD string) string

func RemotePullRequestEvidenceUnavailable ¶

func RemotePullRequestEvidenceUnavailable(entries []BranchEntry, sweep PolicyOptions) bool

func ReportBranchProgress ¶

func ReportBranchProgress(out io.Writer, index, total int, repository string)

func ReportBranchSummary ¶

func ReportBranchSummary(out io.Writer, totals map[string]int, elapsed time.Duration)

func RetiredBranchDestination ¶

func RetiredBranchDestination(now time.Time, source, sha string) string

func RetiredNamespaceSelected ¶

func RetiredNamespaceSelected(sweep PolicyOptions) bool

func RetiredRefSelected ¶

func RetiredRefSelected(sweep PolicyOptions, ref BranchRef) bool

func ScopeIncludesRemote ¶

func ScopeIncludesRemote(scope string) bool

func SelectorNamesExactPackage ¶

func SelectorNamesExactPackage(selector, packageName string) bool

func SelectorPackageFromLockfileSelector ¶

func SelectorPackageFromLockfileSelector(selector string) string

func ShortSHA ¶

func ShortSHA(sha string) string

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"`
	// ExactHeadReceipt marks a receipt whose merged pull request's head is
	// this branch's exact tip: the branch is precisely what was reviewed and
	// squash-merged, nothing was committed after, and the landing commit that
	// carries it in full is in the target's history. Later edits to the target
	// cannot make deleting such a branch lose anything, so it does not need the
	// target-still-carries-the-content proof that a bare receipt does.
	ExactHeadReceipt bool `json:"exact_head_receipt,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 retire
	// --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"`
	Description string   `json:"description,omitempty"`
	Replacement []string `json:"replacement,omitempty"`
	Retention   string   `json:"retention,omitempty"`
}

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"`
	OriginalSHA string    `json:"original_sha,omitempty"`
	RetiredSHA  string    `json:"retired_sha,omitempty"`
	ReceiptID   string    `json:"receipt_id,omitempty"`
	ReviewedAt  time.Time `json:"reviewed_at,omitempty"`
}

type BranchRef ¶

type BranchRef struct {
	Name          string
	SHA           string
	CommitterDate time.Time
	UnknownDate   bool
	Author        string
	Title         string
}

type BranchUse ¶

type BranchUse struct {
	Repository string
	Branch     string
	Task       string
}

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)
	// LandingReverted reports whether the target reverted a landing commit:
	// a commit after it carries Git's revert message or one of markers
	// (GitHub's "Reverts owner/repo#N"), or every path it changed is back to
	// its pre-landing content.
	LandingReverted     func(ctx context.Context, repositoryPath, landing, target string, markers ...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 (service InventoryService) BranchInUseIndex(ctx context.Context, projectsRoot, filter string) (map[string]string, string)

func (InventoryService) BranchPullRequestsForHeadState ¶

func (service InventoryService) BranchPullRequestsForHeadState(ctx context.Context, repository Repository, branch, headState string) PullRequestEvidence

func (InventoryService) CheckedOutLocalBranches ¶

func (service InventoryService) CheckedOutLocalBranches(ctx context.Context, repositoryPath string) (map[string]bool, string)

func (InventoryService) ClassifyAbsorbedOrUnique ¶

func (service InventoryService) ClassifyAbsorbedOrUnique(ctx context.Context, repositoryPath, targetSHA, branchSHA string) (absorbed bool, evidence string, uniqueCount int, err error)

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 (service InventoryService) CountRetiredBranches(ctx context.Context, sweep InventorySweep) (map[string]int, int, map[string]int, int, bool, []string)

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 (service InventoryService) FetchRemoteRefs(ctx context.Context, repositoryPath, refspec, refPrefix, failureLabel string) ([]BranchRef, string)

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 (service InventoryService) ListLocalRefs(ctx context.Context, repositoryPath string) ([]BranchRef, string)

func (InventoryService) ListRefs ¶

func (service InventoryService) ListRefs(ctx context.Context, repositoryPath, refPrefix, namePrefix string) ([]BranchRef, string)

func (InventoryService) ListRemoteRefs ¶

func (service InventoryService) ListRemoteRefs(ctx context.Context, repositoryPath string) ([]BranchRef, string)

func (InventoryService) ListRetiredRemoteRefs ¶

func (service InventoryService) ListRetiredRemoteRefs(ctx context.Context, repositoryPath string) ([]BranchRef, string)

func (InventoryService) ListRetiredTags ¶

func (service InventoryService) ListRetiredTags(ctx context.Context, repositoryPath string, remote, metadata bool) ([]BranchRef, string)

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 ¶

type Repository struct {
	Slug string
	Path string
}

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 RetiredInventory ¶

type RetiredInventory struct {
	Host                                 string
	GeneratedAt                          time.Time
	Repository, Org, Branch, Base, Scope string
	Entries                              []BranchEntry
	Diagnostics                          []string
	Totals                               map[string]int
	RetiredRefs                          map[string]int
	RetiredBranches                      int
	RetiredTags                          map[string]int
	RetiredTagNames                      int
	RetiredRemoteUnavailable             bool
	ElapsedMS                            int64
}

type SupersessionApproval ¶

type SupersessionApproval = worktreeproof.SupersessionApproval

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 SupersessionEvidence struct {
	Reviewer  string
	ReceiptID string
}

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 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

Jump to

Keyboard shortcuts

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