integrator

package
v0.3.10 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupClosed added in v0.2.6

func CleanupClosed(ctx context.Context, p platform.Platform, params CleanupParams) error

CleanupClosed handles cleanup for a batch PR that was closed (merged or not). For merged PRs: closes all open milestone issues, closes the milestone, and deletes the batch branch (same as before). For closed-without-merge PRs: labels non-done open issues as cancelled, closes all open milestone issues, closes the milestone, and deletes the branch.

func DispatchRebaseConflictWorker added in v0.2.18

func DispatchRebaseConflictWorker(ctx context.Context, p platform.Platform, cfg *config.Config, ms *platform.Milestone, batchBranch, defaultBranch string) (int, error)

DispatchRebaseConflictWorker creates a conflict-resolution issue and dispatches a worker to rebase the batch branch onto the default branch. It respects the max conflict resolution attempts cap. Returns the created issue number, or 0 if the cap was reached.

func ParseBatchBranchMilestone

func ParseBatchBranchMilestone(branch string) (int, error)

ParseBatchBranchMilestone extracts the milestone number from a batch branch name. Expected format: "herd/batch/{number}-{slug}"

Types

type AdvanceParams

type AdvanceParams struct {
	RunID    int64
	RepoRoot string
}

AdvanceParams holds the parameters for advancing tiers.

type AdvanceResult

type AdvanceResult struct {
	TierComplete    bool
	AllComplete     bool
	DispatchedCount int
	BatchPRNumber   int
}

AdvanceResult holds the result of a tier advancement.

func Advance

func Advance(ctx context.Context, p platform.Platform, g *git.Git, cfg *config.Config, params AdvanceParams) (*AdvanceResult, error)

Advance checks if the current tier is complete and dispatches the next tier. If all tiers are complete, it opens the batch PR.

func AdvanceByBatch

func AdvanceByBatch(ctx context.Context, p platform.Platform, g *git.Git, cfg *config.Config, batchNumber int) (*AdvanceResult, error)

AdvanceByBatch triggers tier advancement for a batch by milestone number. Used when an issue is closed (e.g., manual tasks) rather than via workflow run.

type CheckCIParams

type CheckCIParams struct {
	RunID          int64
	BatchNumber    int // Alternative to RunID — used by check_suite trigger
	RepoRoot       string
	UserContext    string // Optional hint from the user, prepended to fix issue body
	BeforeDispatch func() // optional; called once, right before worker dispatch
}

CheckCIParams holds parameters for CI failure handling.

type CheckCIResult

type CheckCIResult struct {
	Status       string // "success", "failure", "pending"
	FixIssues    []int
	FixCycle     int
	MaxCyclesHit bool
	Skipped      bool // true if require_ci is false or no batch branch found
}

CheckCIResult holds the result of CI checking.

func CheckCI

func CheckCI(ctx context.Context, p platform.Platform, cfg *config.Config, params CheckCIParams) (*CheckCIResult, error)

CheckCI checks CI status on the batch branch after consolidation. If CI fails, it dispatches fix workers up to ci_max_fix_cycles. If ci_max_fix_cycles is 0, it only notifies.

type CleanupParams

type CleanupParams struct {
	PRNumber int
	Merged   bool
}

CleanupParams holds parameters for post-close cleanup of batch PRs.

type ConsolidateParams

type ConsolidateParams struct {
	RunID    int64
	RepoRoot string
}

ConsolidateParams holds the parameters for consolidating a worker branch.

type ConsolidateResult

type ConsolidateResult struct {
	IssueNumber      int
	WorkerBranch     string
	Merged           bool
	NoOp             bool
	ConflictDetected bool
	ConflictIssue    int
}

ConsolidateResult holds the result of a consolidation.

func Consolidate

func Consolidate(ctx context.Context, p platform.Platform, g *git.Git, cfg *config.Config, params ConsolidateParams) (*ConsolidateResult, error)

Consolidate merges a completed worker branch into the batch branch. It resolves the worker branch from the workflow run, merges it, and cleans up.

type MergeApprovedParams

type MergeApprovedParams struct {
	PRNumber int
}

MergeApprovedParams holds parameters for merging an approved batch PR.

type MergeApprovedResult

type MergeApprovedResult struct {
	Merged  bool
	Skipped bool
	Reason  string
}

MergeApprovedResult holds the result of a merge attempt.

func MergeApproved

MergeApproved merges a batch PR that has been approved by a human reviewer. It verifies the PR is a herd batch PR (title starts with "[herd]"), then merges using the configured strategy and runs post-merge cleanup. Non-herd PRs and already-closed PRs are silently skipped.

type ReviewParams

type ReviewParams struct {
	RunID             int64
	PRNumber          int // Alternative to RunID — used by pull_request_review trigger
	BatchNumber       int // Alternative to RunID — used by advance-on-close
	RepoRoot          string
	ExtraInstructions string // Optional extra instructions appended to the review system prompt
}

ReviewParams holds the parameters for reviewing a batch PR.

type ReviewResult

type ReviewResult struct {
	Approved         bool
	FixIssues        []int
	FixCycle         int
	MaxCyclesHit     bool
	BatchPRNumber    int
	AllCreatesFailed bool // true when issues were found but every fix-issue Create call failed
	FindingsCount    int  // number of review findings (agent comments); set when AllCreatesFailed is true
}

ReviewResult holds the result of a batch PR review.

func Review

func Review(ctx context.Context, p platform.Platform, ag agent.Agent, g *git.Git, cfg *config.Config, params ReviewParams) (*ReviewResult, error)

Review runs an agent review on the batch PR. If approved, it optionally auto-merges. If changes are requested, it creates fix issues and dispatches fix workers.

Jump to

Keyboard shortcuts

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