steps

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package steps holds one file per match step, each a pure linkage.Step. Ordering and selection are the pipeline's job, not this package's.

Index

Constants

View Source
const BranchStepID = "branch"
View Source
const CoauthorAgentStepID = "coauthor_agent"
View Source
const CommitRefStepID = "commit_ref"
View Source
const (
	FilesOverlapStepID = "files_overlap"
)
View Source
const StartCommitStepID = "start_commit"
View Source
const TimeframeStepID = "timeframe"
View Source
const UserEmailStepID = "user_email"

Variables

This section is empty.

Functions

func Default

func Default() []linkage.Step

Default returns the built-in steps in linkage.DefaultMatchSteps order, one per id. The pipeline (the linkage package) can't import this package back (it would cycle, since these steps import linkage), so callers assemble the registry here and pass it into linkage.MatchCommit / linkage.MatchCommits as availableSteps.

func ExplainedFiles

func ExplainedFiles(commit linkage.EnrichedCommit, candidate linkage.RunCandidate) []string

ExplainedFiles returns the commit paths a run's edits account for, paired the same way the score pairs them. Reads are excluded: a file somebody read is not a file they changed, so it leaves the commit no better explained.

Types

type BranchStep

type BranchStep struct{}

BranchStep excludes candidates whose Branches disagree with the commit's BranchNames. If either side has no branch info, it does not exclude. RunCandidate.Branches is a set: the branch history sessioncorrelate derived: a session's branch can change mid-session, so this step keeps a candidate when any of its branches is compatible with any of the commit's.

func (BranchStep) Apply

func (BranchStep) ID

func (BranchStep) ID() string

type CoauthorAgentStep

type CoauthorAgentStep struct{}

CoauthorAgentStep keeps candidates whose agent normalizes (via cfg.AgentAliases) to one of the commit's Co-Authored-By agents. An empty CoauthoredAgents list is a no-op.

func (CoauthorAgentStep) Apply

func (CoauthorAgentStep) ID

type CommitRefStep

type CommitRefStep struct{}

CommitRefStep hard-links a commit to the run that recorded it with role "created" (full SHA or an unambiguous >=7-hex-char prefix), ignoring every other role. Ties break on the lowest RunID.

func (CommitRefStep) Apply

func (CommitRefStep) ID

func (CommitRefStep) ID() string

type FilesOverlapStep

type FilesOverlapStep struct{}

FilesOverlapStep is the soft finalizer: it ranks remaining candidates by how much of the commit a run accounts for and links every exactly tied top candidate that clears every gate on Config for itself. Hard-link steps (commit_ref, start_commit) finalize earlier and never reach here.

The score is containment, not Jaccard overlap. Jaccard divides by the union of the two file sets, which penalises the many-commits-to-one-session cardinality the matcher supports: a forty-file session and the four-file commit it produced cannot score above ~0.1 however certain the match.

func (FilesOverlapStep) Apply

func (FilesOverlapStep) ID

func (FilesOverlapStep) ID() string

type StartCommitStep

type StartCommitStep struct{}

StartCommitStep hard-links a commit to the run whose StartingCommitSHA (role=starting) equals the commit's AncestorOID — Codex-oriented, but a harmless no-op for runs that never set it. A commit with no AncestorOID (root commit, or enrichment gap) leaves candidates untouched. Ties break on the lowest RunID.

func (StartCommitStep) Apply

func (StartCommitStep) ID

func (StartCommitStep) ID() string

type TimeframeStep

type TimeframeStep struct{}

TimeframeStep keeps candidates whose run window overlaps the commit's CommittedAt. Policy:

  • Both StartedAt and EndedAt missing: drop.
  • StartedAt present: commit cannot precede it.
  • Commit must be at or before the candidate's effective end plus the tolerance — its EndedAt, or the upload that carried it when it recorded none, so an unfinished session stops being a candidate for every later commit.
  • Neither an end nor an upload time: open-ended, keep. The candidate query always supplies the upload time, so only package fixtures reach it.

A CommittedAt that will not parse drops every candidate — fail closed rather than match on a timestamp nobody can read — but under a reason code of its own, since that is a bad commit record and not a run-timing verdict. This step is a soft filter and runs after commit_ref, so a run that verifiably created the commit is already linked before any of it applies.

func (TimeframeStep) Apply

func (TimeframeStep) ID

func (TimeframeStep) ID() string

type UserEmailStep

type UserEmailStep struct{}

UserEmailStep excludes candidates with a present UserEmail that disagrees with the commit author's email, after trimming and case-folding. A missing candidate email never excludes. Entire ground-truth attribution emails are out of scope here — never used for matching.

func (UserEmailStep) Apply

func (UserEmailStep) ID

func (UserEmailStep) ID() string

Jump to

Keyboard shortcuts

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