score

package
v0.26.12 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CategoryIdentity       = "identity"
	CategoryEngagement     = "engagement"
	CategoryCommunity      = "community"
	CategoryBehavioral     = "behavioral"
	CategoryCodeProvenance = "code_provenance"
)

Category name constants used as keys in the per-category map.

Variables

View Source
var (
	CategoryProvenanceWeight = provenanceWeight
	CategoryIdentityWeight   = ageWeight + associationWeight + profileWeight
	CategoryEngagementWeight = proportionWeight + recencyWeight + prAcceptWeight
	CategoryCommunityWeight  = followerWeight + repoCountWeight
	CategoryBehavioralWeight = consistencyWeight + reviewParticipWeight + repoDiversityWeight + burstWeight + forkOnlyWeight
)

Exported category weights derived from signal constants.

Functions

func Categories

func Categories(s InputSignals, hasRepo bool, beh *model.Behavior) map[string]float64

Categories returns per-category scores for the given signals. When hasRepo is false, repo-dependent categories are omitted (not zero).

func Compute

func Compute(s InputSignals, hasRepo bool, beh *model.Behavior) float64

Compute returns a reputation score in [0.0, 1.0] using the v3 weighted model. When hasRepo is false, repo-dependent signal weights are redistributed across available signals so the score reflects what can actually be evaluated.

func ComputeTier2Heuristics

func ComputeTier2Heuristics(beh *model.Behavior, s *InputSignals) *model.BehavioralHeuristics

ComputeTier2Heuristics computes AI sensing behavioral heuristics from the Behavior struct and InputSignals. Safe to call with nil arguments.

func Grade

func Grade(score float64) string

Grade returns a letter grade for the given score value.

Types

type InputSignals

type InputSignals struct {
	// Identity
	AgeDays           int64
	AuthorAssociation string
	HasBio            bool
	HasCompany        bool
	HasLocation       bool
	HasWebsite        bool
	HasPublicEmail    bool

	// Engagement
	Commits           int64
	TotalCommits      int64
	TotalContributors int
	LastCommitDays    int64
	PRsMerged         int64
	PRsClosed         int64

	// Community
	Followers   int64
	Following   int64
	PublicRepos int64

	// Behavioral
	RecentPRRepoCount int64
	ForkedRepos       int64

	// Provenance
	UnverifiedCommits int64

	// Flags
	Suspended        bool
	OrgMember        bool
	TrustedOrgMember bool

	// Partial is true when one or more sub-fetches failed during signal
	// collection (e.g., a Search-API rate-limit hit). It is transient
	// (not persisted via JSON) so the scorer can decide whether to mark
	// the score as non-deep / shorten its cache lifetime without
	// polluting the historical signals record.
	Partial bool `json:"-"`
}

InputSignals holds the raw inputs to the reputation model.

Jump to

Keyboard shortcuts

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