resolver

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package resolver finds dangling cross-repo edges and retargets them to the correct node by matching across repos using hash recomputation.

When repo A calls repo B's function, the extractor may compute the target hash using repo A's URL instead of repo B's URL. The resolver detects these mismatches and corrects them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResolveResult

type ResolveResult struct {
	OriginalEdge types.Edge
	ResolvedNode *types.Node
	Action       string // "retargeted" or "skipped"
	Reason       string
}

ResolveResult captures the outcome of resolving a single dangling edge.

type ResolveStats

type ResolveStats struct {
	TotalDangling int
	Retargeted    int
	Skipped       int
	Errors        int
}

ResolveStats contains aggregate statistics from a resolution pass.

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

Resolver resolves cross-repo dangling edges by recomputing hashes with the correct repo URL.

func NewResolver

func NewResolver(store Store) *Resolver

NewResolver creates a Resolver backed by the given store.

func (*Resolver) Resolve

func (r *Resolver) Resolve(ctx context.Context) (*ResolveStats, error)

Resolve finds all dangling edges and attempts to retarget them. It returns aggregate statistics.

func (*Resolver) ResolveWithDetails

func (r *Resolver) ResolveWithDetails(ctx context.Context) ([]ResolveResult, *ResolveStats, error)

ResolveWithDetails finds all dangling edges and attempts to retarget them, returning per-edge results along with aggregate statistics.

type Store

type Store interface {
	DanglingEdges(ctx context.Context) ([]types.Edge, error)
	AllRepos(ctx context.Context) ([]types.Repo, error)
	GetNode(ctx context.Context, hash types.Hash) (*types.Node, error)
	NodesByName(ctx context.Context, qualifiedPrefix string) ([]types.Node, error)
	DeleteEdge(ctx context.Context, hash types.Hash) error
	PutEdge(ctx context.Context, e types.Edge) error
}

Store defines the subset of store operations needed by the resolver. This allows the resolver to compile independently and be tested with either a real SQLiteStore or a mock.

Jump to

Keyboard shortcuts

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