Help us shape the future of Go! Take the 2026 Go Developer Survey

radar

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package radar ranks locally stored contribution candidates with transparent, deterministic signals. It performs no I/O and owns no GitHub capability.

Index

Constants

View Source
const (
	// ScoreVersion changes whenever ranking semantics change.
	ScoreVersion = "radar.v1"
	// DefaultLimit is the default number of returned candidates.
	DefaultLimit = 20
	// MaxLimit bounds one radar response.
	MaxLimit = 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Candidate

type Candidate struct {
	Rank               int                 `json:"rank"`
	Ref                string              `json:"ref"`
	Repo               string              `json:"repo"`
	Number             int                 `json:"number"`
	Title              string              `json:"title"`
	URL                string              `json:"url"`
	Labels             []string            `json:"labels"`
	Eligibility        Eligibility         `json:"eligibility"`
	BaseScore          int                 `json:"base_score"`
	Score              int                 `json:"score"`
	ScoreVersion       string              `json:"score_version"`
	Confidence         string              `json:"confidence"`
	PositiveSignals    []Signal            `json:"positive_signals"`
	Risks              []Signal            `json:"risks"`
	Blockers           []Signal            `json:"blockers"`
	Unknowns           []Unknown           `json:"unknowns"`
	Coverage           []Coverage          `json:"coverage"`
	LinkedPullRequests []LinkedPullRequest `json:"linked_pull_requests"`
	DuplicateCluster   *DuplicateCluster   `json:"duplicate_cluster,omitempty"`
	SourceUpdatedAt    time.Time           `json:"source_updated_at,omitempty"`
	SourceAsOf         time.Time           `json:"source_as_of,omitempty"`
}

Candidate is one ranked, fully explained issue.

type Coverage

type Coverage struct {
	Facet    string    `json:"facet"`
	Scope    string    `json:"scope"`
	Present  bool      `json:"present"`
	Complete bool      `json:"complete"`
	AsOf     time.Time `json:"as_of,omitempty"`
}

Coverage is the bounded facet coverage relevant to a recommendation.

type DuplicateCluster

type DuplicateCluster struct {
	StableID       string    `json:"stable_id"`
	CanonicalRef   string    `json:"canonical_ref"`
	CandidateCount int       `json:"candidate_count"`
	SourceAsOf     time.Time `json:"source_as_of,omitempty"`
}

DuplicateCluster is a stored, explainable duplicate-candidate fact.

type Eligibility

type Eligibility string

Eligibility separates objective state from a candidate's numeric score.

const (
	// EligibilityEligible means no stored objective blocker or material
	// eligibility unknown was found.
	EligibilityEligible Eligibility = "eligible"
	// EligibilityUnknown means stored evidence cannot establish eligibility.
	EligibilityUnknown Eligibility = "unknown"
	// EligibilityBlocked means stored evidence contains an objective blocker.
	EligibilityBlocked Eligibility = "blocked"
)

type IssueSnapshot

type IssueSnapshot struct {
	Number             int
	State              string
	Title              string
	Body               string
	Labels             []string
	Assignees          []string
	Locked             bool
	SourceUpdated      time.Time
	URL                string
	Coverage           []Coverage
	MaintainerResponse bool
	MaintainerReplyURL string
	LinkedPullRequests []LinkedPullRequest
	DuplicateCluster   *DuplicateCluster
}

IssueSnapshot contains one locally stored issue and its derived local facts.

type LinkedPullRequest

type LinkedPullRequest struct {
	Number          int       `json:"number"`
	Title           string    `json:"title"`
	URL             string    `json:"url"`
	Closing         bool      `json:"closing"`
	SourceUpdatedAt time.Time `json:"source_updated_at,omitempty"`
}

LinkedPullRequest is an open PR that explicitly references an issue.

type Options

type Options struct {
	Limit                       int
	Now                         time.Time
	TotalOpenIssues             int
	PopulationCapped            bool
	LinkedPullRequestScanCapped bool
	DuplicateClusterScanCapped  bool
}

Options bounds a deterministic ranking operation.

type Report

type Report struct {
	Repo                string      `json:"repo"`
	ScoreVersion        string      `json:"score_version"`
	GeneratedAt         time.Time   `json:"generated_at"`
	SourceAsOf          time.Time   `json:"source_as_of,omitempty"`
	Limit               int         `json:"limit"`
	TotalOpenIssues     int         `json:"total_open_issues"`
	CandidatePopulation int         `json:"candidate_population"`
	PopulationCapped    bool        `json:"population_capped"`
	Unknowns            []Unknown   `json:"unknowns"`
	Candidates          []Candidate `json:"candidates"`
}

Report is the offline contribution radar result for one repository.

func Rank

func Rank(repo RepositorySnapshot, issues []IssueSnapshot, opts Options) (*Report, error)

Rank scores a bounded set of local issue snapshots. Missing coverage is represented as unknown and never silently converted into a penalty.

type RepositorySnapshot

type RepositorySnapshot struct {
	Repo           domain.RepoRef
	Archived       bool
	SourceUpdated  time.Time
	Coverage       []Coverage
	GuidanceStatus string
}

RepositorySnapshot contains only product-owned facts required by Rank.

type Signal

type Signal struct {
	Code      string `json:"code"`
	Summary   string `json:"summary"`
	Weight    int    `json:"weight"`
	SourceURL string `json:"source_url,omitempty"`
}

Signal is one explainable contribution to a candidate assessment.

type Unknown

type Unknown struct {
	Code        string `json:"code"`
	Summary     string `json:"summary"`
	Remediation string `json:"remediation,omitempty"`
}

Unknown records missing or incomplete evidence without treating it as a negative ranking signal.

Jump to

Keyboard shortcuts

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