upstream

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 6 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 upstream watches upstream dependency releases and records them in the event journal for downstream cross-reference work.

Index

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 Embedder

type Embedder interface {
	Embed(ctx context.Context, text string) ([]float32, error)
}

Embedder embeds text to a 768-d vector.

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

type Indexer interface {
	UpsertEmbedded(ctx context.Context, doc store.Document) error
}

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

type IngestAdapter struct {
	EmbedFunc func(ctx context.Context, doc store.Document) error
}

IngestAdapter bridges the existing ingest.EmbedAndUpsert into the Indexer interface without the upstream package depending on ingest directly.

func (IngestAdapter) UpsertEmbedded

func (a IngestAdapter) UpsertEmbedded(ctx context.Context, doc store.Document) error

type Match

type Match struct {
	Release    gh.Release
	Event      store.RepoEvent
	Candidates []store.SimilarIssue
}

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

func (w *Watcher) WithIndexer(i Indexer) *Watcher

WithIndexer sets an optional indexer. When set, Sync also embeds and upserts the release notes as a Document with doc_type "upstream_release".

Jump to

Keyboard shortcuts

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