activity

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: MIT

SPDX-License-Identifier: MIT Package activity holds the provider-agnostic logic of the repository activity digest: the disclosure builders that state what a result does not cover, and the deterministic rules that correlate changed paths with commits.

It deliberately depends on nothing but model, so the honesty rules can be unit-tested without a provider in the picture.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AncestryDiverged

func AncestryDiverged() model.Disclosure

AncestryDiverged reports boundaries that do not share ancestry, which happens after a force-push or a rebase inside the window.

func AuthorFilterNotApplied

func AuthorFilterNotApplied(author string) model.Disclosure

AuthorFilterNotApplied states the asymmetry between an author-filtered commit list and a change set that cannot be author-filtered: a boundary comparison has no notion of authorship.

func BudgetBounded

func BudgetBounded(consumed, ceiling int) model.Disclosure

BudgetBounded reports that the request ceiling stopped evidence gathering. The result it accompanies is still a result: what was gathered is returned.

func Build

func Build(in DisclosureInput) []model.Disclosure

Build returns the disclosures for a collected result, in a fixed order so identical upstream state yields byte-identical output.

Two of them — reference-scoped and net-comparison-blindspot — are unconditional whenever a change set is produced, including on a completely clean result. A boundary comparison always carries those blind spots, so stating them only when something went wrong would let a reader treat the ordinary case as more complete than it is.

func Correlate

func Correlate(paths []model.ChangedPath, commits []model.ActivityCommit) []model.Correlation

Correlate links each changed path to the commits that plausibly produced it, applying three declared rules in a fixed order with first match winning.

The ordering is deliberate and the labels are load-bearing:

  1. observed — per-commit file data was actually fetched and lists the path. Certain.
  2. inferred:path-mention — the commit message body contains the path verbatim. Strong.
  3. inferred:scope-match — a Conventional Commit scope matches a leading path segment. Weak: a scope names a component, not a path, and the two only usually coincide.

A path that matches no rule is left out entirely rather than guessed at. An honest gap is worth more than a fabricated link, and presenting inference as observation is precisely what the basis label exists to prevent.

Nothing here depends on map iteration order, so repeated runs over identical input produce byte-identical output.

func EnrichmentPartial

func EnrichmentPartial(delivered, requested int) model.Disclosure

EnrichmentPartial reports that fewer commits were enriched than requested, so a reader knows the observed attributions cover only part of the window.

func NetComparisonBlindspot

func NetComparisonBlindspot() model.Disclosure

NetComparisonBlindspot states what a boundary comparison structurally cannot see. Unconditional whenever a change set is produced.

func PatchTruncated

func PatchTruncated() model.Disclosure

PatchTruncated reports that patch text was clipped by the byte budget.

func ProviderCapped

func ProviderCapped() model.Disclosure

ProviderCapped reports that the provider clipped the comparison's file list.

func QuotaExhausted

func QuotaExhausted(resetsAt string) model.Disclosure

QuotaExhausted reports that the provider's rate limit stopped gathering.

func ReferenceScoped

func ReferenceScoped(ref string) model.Disclosure

ReferenceScoped names the single reference the result covers. Unconditional.

func RepositoryRootBase

func RepositoryRootBase() model.Disclosure

RepositoryRootBase is the net-comparison blind spot as it applies to a window reaching back to the repository's first commit: there is no parent to compare against, so the comparison starts at the root commit itself and the files that commit introduced fall outside it.

Types

type DisclosureInput

type DisclosureInput struct {
	// Ref is the reference the change set was scoped to. Never empty by the
	// time disclosures are built — the resolved default branch is filled in.
	Ref string
	// ChangeSetProduced is true when a boundary comparison was presented.
	// The two unconditional disclosures hang off this.
	ChangeSetProduced bool
	// Diverged is true when the boundaries do not share ancestry.
	Diverged bool
	// ProviderCapped is true when the comparison hit the provider's file cap.
	ProviderCapped bool
	// PatchTruncated is true when any patch text exceeded the byte budget.
	PatchTruncated bool
	// AuthorFilter is the author the commit listing was narrowed to, if any.
	AuthorFilter string
	// RootCommitBase is true when the window reaches the repository's root
	// commit, so there is no parent to compare against.
	RootCommitBase bool
}

DisclosureInput describes what a collected result did and did not cover, so the corresponding disclosures can be built in one place.

Jump to

Keyboard shortcuts

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