coupling

package
v1.39.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package coupling provides stage-2 semantic verification for federated cross-repo co-change candidates: it proves (or fails to prove) that two files in different repos share a real dependency — starting with an offline HTTP route provider↔consumer match. Verified pairs are explainable and float above unverified temporal-only candidates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCompositeVerifier

func NewCompositeVerifier(vs ...Verifier) *compositeVerifier

NewCompositeVerifier returns a Verifier that fans out to vs in order. Evidence ordering follows verifier order, so list route before symbol to keep the human-facing LinkedBy (ev[0]) preferring the more specific route proof.

func NewRouteVerifier

func NewRouteVerifier() *routeVerifier

NewRouteVerifier returns a fresh T0 route verifier. Construct one per tool call (the cache is per-call, not shared across calls).

func NewSymbolVerifier

func NewSymbolVerifier() *symbolVerifier

NewSymbolVerifier returns a fresh T1 symbol verifier. Construct one per tool call (the cache is per-call, not shared across calls).

Types

type Evidence

type Evidence struct {
	Kind   string `json:"kind"`   // "route" (later: "symbol" | "graph_route" | "embedding")
	Detail string `json:"detail"` // e.g. "POST /api/partner/register"
	Tier   string `json:"tier"`   // "offline" | "age" | "embeddings"
}

Evidence is one proof that a cross-repo pair shares a real dependency.

type FilePair

type FilePair struct {
	Repo string // slug, for labels
	Root string // absolute repo root
	Rel  string // repo-relative path
}

FilePair is a candidate file the verifier inspects. Root+Rel locate the bytes.

type VerifiedPair

type VerifiedPair struct {
	federate.CrossPair            // embedded — temporal signal preserved
	Verified           bool       `json:"verified"`
	LinkedBy           string     `json:"linkedBy,omitempty"`
	Evidence           []Evidence `json:"evidence,omitempty"`
}

VerifiedPair augments a temporal CrossPair with semantic evidence.

func VerifyPairs

func VerifyPairs(ctx context.Context, cands []federate.CrossPair, roots map[string]string, v Verifier) []VerifiedPair

VerifyPairs runs the verifier over each candidate and returns them sorted verified-first, then by descending temporal Score within each tier. roots maps a repo slug → absolute root for file reads; a pair whose slug is absent is returned unverified (cannot read its files).

type Verifier

type Verifier interface {
	Verify(ctx context.Context, a, b FilePair) ([]Evidence, error)
}

Verifier proves a dependency between two files in different repos. Returns ALL evidence found (a pair may be linked by more than one signal).

Jump to

Keyboard shortcuts

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