fixes

package
v0.6.0 Latest Latest
Warning

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

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

Documentation

Overview

Package fixes mines fix commits into findings — the lesson source that exists in every repository, review culture or none. A fix commit is a correction the author themselves labeled: the patch shows the mistake being undone, which makes it distillation material even when the commit message says nothing useful (validated empirically: two anonymous "fix: PR review" commits grouped correctly on patch content alone).

Classification is tiered and precise over complete — a miss degrades, a false positive corrupts — and every finding declares its derivation in Source, like every call edge declares its resolution. Duplicates are removed by patch identity (cherry-picks and backports are one event), and fixes that were later reverted are excluded: a fix bad enough to undo teaches the wrong lesson.

Index

Constants

View Source
const DefaultWindow = 365 * 24 * time.Hour

DefaultWindow is the mining recency window — measured on the test repos as the span that keeps a meaningful corpus (~50-70 findings) without resurrecting ancient history.

Variables

This section is empty.

Functions

func Classify

func Classify(subject, body string) string

Classify returns the finding source for a commit subject+body, or "" when it is not a fix worth mining. Exported for the fix-density report line, which classifies decision titles the same way.

Types

type Options

type Options struct {
	// Window is how far back to mine. Staleness defense: a years-old fix
	// pattern on since-rewritten code must not enter the corpus. Zero
	// means DefaultWindow.
	Window time.Duration
	// Logf receives progress; nil discards it.
	Logf func(format string, args ...any)
}

Options bounds a fix-mining pass.

type Result

type Result struct {
	Findings []model.Finding
	Mined    bool
}

Result carries one mining pass. Mined distinguishes "git answered, zero fixes" — swapping the stored set to empty is then correct, stale findings age out — from "no git here", where stored findings must be preserved. The same contract as reviews.Result.Fetched.

func Mine

func Mine(root string, opts Options) (Result, error)

Mine returns the fix findings for the repository at root. A workspace without git yields an unmined result, never an error — the same degrade-not-fail contract as review mining.

Jump to

Keyboard shortcuts

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