outbox

package
v0.9.176 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package outbox posts planned review actions through the host-agnostic provider seam.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InlineCommentPayload

type InlineCommentPayload struct {
	Body         string            `json:"body"`
	Path         string            `json:"path"`
	Side         review.DiffSide   `json:"side"`
	Line         int               `json:"line"`
	SubjectType  review.AnchorKind `json:"subject_type"`
	DiffPosition int               `json:"diff_position"`
}

InlineCommentPayload is the JSON payload for inline comment actions.

type Limiter

type Limiter interface {
	Wait(context.Context, string) error
}

Limiter gates provider write calls.

type Options

type Options struct {
	Store    Store
	Provider gitprovider.GitProvider
	Limiter  Limiter
	Now      func() time.Time
}

Options contains post-phase dependencies.

type Request

type Request struct {
	Run             ledger.Run
	PRRef           gitprovider.PRRef
	PostingIdentity gitprovider.Identity
	DesiredOutcome  ledger.Outcome
}

Request identifies the run and PR being posted.

type ResolveThreadPayload

type ResolveThreadPayload struct{}

ResolveThreadPayload is the JSON payload for resolve thread actions.

type Result

type Result struct {
	Outcome        ledger.Outcome
	ExitCode       int
	Posted         int
	Pending        int
	FailedTerminal int
	Aborted        bool
}

Result summarizes post-phase state after Post returns.

func Post

func Post(ctx context.Context, opts Options, req Request) (Result, error)

Post reconciles and posts pending actions for one live run.

type RollupCommentPayload

type RollupCommentPayload struct {
	Body string `json:"body"`
}

RollupCommentPayload is the JSON payload for rollup comment actions.

type Store

type Store interface {
	ListPlannedActions(ctx context.Context, runID string) ([]ledger.PlannedAction, error)
	UpdatePlannedAction(ctx context.Context, action ledger.PlannedAction) error
	CompleteRun(ctx context.Context, runID string, outcome ledger.Outcome, completedAt time.Time) error
}

Store is the durable state required by the post phase.

type SubmitReviewPayload

type SubmitReviewPayload struct {
	Body  string             `json:"body"`
	Event review.ReviewEvent `json:"event"`
}

SubmitReviewPayload is the JSON payload for submit review actions.

type ThreadReplyPayload

type ThreadReplyPayload struct {
	Body    string `json:"body"`
	Summary bool   `json:"summary"`
}

ThreadReplyPayload is the JSON payload for thread reply actions.

type TokenBucket

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

TokenBucket is a goroutine-safe per-host posting limiter.

func NewTokenBucket

func NewTokenBucket(interval time.Duration, burst int) (*TokenBucket, error)

NewTokenBucket creates a per-host token bucket.

func (*TokenBucket) Wait

func (b *TokenBucket) Wait(ctx context.Context, host string) error

Wait blocks until a token is available for host or ctx is canceled.

Jump to

Keyboard shortcuts

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