Documentation
¶
Overview ¶
Package upstream watches upstream dependency releases and records them in the event journal for downstream cross-reference work.
Index ¶
- type BlockedFinder
- type Embedder
- type EventStore
- type Indexer
- type IngestAdapter
- type Match
- type ReleaseLister
- type Watcher
- func (w *Watcher) Sync(ctx context.Context, installationID int64, consumerRepo, upstreamRepo string) ([]store.RepoEvent, error)
- func (w *Watcher) SyncAndCrossReference(ctx context.Context, installationID int64, consumerRepo, upstreamRepo string) ([]Match, error)
- func (w *Watcher) WithBlockedFinder(bf BlockedFinder, e Embedder) *Watcher
- func (w *Watcher) WithIndexer(i Indexer) *Watcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockedFinder ¶
type BlockedFinder interface {
FindSimilarBlockedIssues(ctx context.Context, repo string, embedding []float32, limit int) ([]store.SimilarIssue, error)
}
BlockedFinder finds open issues with the "blocked" label near an embedding.
type EventStore ¶
type EventStore interface {
ListEvents(ctx context.Context, repo string, since time.Time, eventTypes []string, limit int) ([]store.RepoEvent, error)
RecordEvents(ctx context.Context, events []store.RepoEvent) error
}
EventStore is the subset of the store we need.
type Indexer ¶
Indexer handles embedding and upserting a document into the vector store. A small interface so tests can stub it without pulling in LLM or store concrete types.
type IngestAdapter ¶
IngestAdapter bridges the existing ingest.EmbedAndUpsert into the Indexer interface without the upstream package depending on ingest directly.
func (IngestAdapter) UpsertEmbedded ¶
type Match ¶
Match is a single release paired with candidate blocked issues whose embedding is near enough to suggest the release may fix them.
type ReleaseLister ¶
type ReleaseLister interface {
GetLatestReleases(ctx context.Context, installationID int64, repo string, n int) ([]gh.Release, error)
}
ReleaseLister is the subset of the github client we need.
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher pulls new upstream releases and records them against a consumer repo.
func NewWatcher ¶
func NewWatcher(g ReleaseLister, e EventStore) *Watcher
NewWatcher constructs a Watcher with defaults (20 releases fetched per Sync, 180-day lookback for existing-event dedupe).
func (*Watcher) Sync ¶
func (w *Watcher) Sync(ctx context.Context, installationID int64, consumerRepo, upstreamRepo string) ([]store.RepoEvent, error)
Sync fetches recent releases from upstreamRepo and records any that are not already in the consumerRepo's event journal as "upstream_release" events. Returns the slice of newly recorded events.
func (*Watcher) SyncAndCrossReference ¶
func (w *Watcher) SyncAndCrossReference(ctx context.Context, installationID int64, consumerRepo, upstreamRepo string) ([]Match, error)
SyncAndCrossReference runs Sync and, for each new release, finds open issues labelled "blocked" whose embedding is near the release notes. It returns a Match per release that has at least one candidate within the distance threshold. If either the BlockedFinder or the Embedder is unset, it returns (nil, nil) after Sync without attempting cross-reference.
func (*Watcher) WithBlockedFinder ¶
func (w *Watcher) WithBlockedFinder(bf BlockedFinder, e Embedder) *Watcher
WithBlockedFinder installs the cross-reference dependency. When both a BlockedFinder and an Embedder are set, SyncAndCrossReference can run.
func (*Watcher) WithIndexer ¶
WithIndexer sets an optional indexer. When set, Sync also embeds and upserts the release notes as a Document with doc_type "upstream_release".