resolve

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

@index Language-specific dispatch hooks used by call edge resolution.

@index Immutable exact and longest-suffix file-node index shared by build and update resolution.

@index Edge resolution helpers that attach parsed relationships to stored graph node IDs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildUnresolvedCandidates

func BuildUnresolvedCandidates(edges []graph.Edge) []graph.UnresolvedEdgeCandidate

BuildUnresolvedCandidates expands unresolved fingerprints into conservative reverse lookup keys. @intent prefer extra candidate replay over missing a caller that a newly added symbol can resolve.

func FilterResolved

func FilterResolved(edges []graph.Edge) []graph.Edge

FilterResolved returns only edges that have both persisted endpoints. @intent prevent unresolved syntax candidates from occupying fingerprints before they become traversable

func ImportsFromTarget

func ImportsFromTarget(edge graph.Edge) (string, bool)

ImportsFromTarget extracts the import path from an imports_from fingerprint. @intent provide a stable parser for import-edge-specific diagnostics and filtering.

func IsLikelyExternalImportEdge

func IsLikelyExternalImportEdge(edge graph.Edge) bool

IsLikelyExternalImportEdge reports whether an imports_from edge likely points to an external module that is intentionally expected to remain unresolved. @intent classify import edges that are not expected to have local resolution targets.

func IsLikelyExternalImportPath

func IsLikelyExternalImportPath(path string) bool

IsLikelyExternalImportPath returns true when an import path is most likely an external dependency (stdlib, third-party package, or alias-style module import) rather than a local repository path that should usually resolve during normal builds. @intent keep unresolved-edge noise focused on internal graph-coverage gaps.

func LookupKeysForNodes

func LookupKeysForNodes(nodes []graph.Node) []string

LookupKeysForNodes creates the key set used to probe unresolved candidates after node additions. @intent match qualified names, simple names, and package/file path suffixes conservatively.

func Resolve

func Resolve(ctx context.Context, lookup NodeLookup, edges []graph.Edge) ([]graph.Edge, error)

Resolve fills FromNodeID and ToNodeID for parsed edges when a unique local endpoint can be inferred from stored node positions and names. @intent convert syntax-level edge fingerprints into traversable graph edges.

func ResolveWithOptions

func ResolveWithOptions(ctx context.Context, lookup NodeLookup, edges []graph.Edge, options ResolveOptions) ([]graph.Edge, error)

ResolveWithOptions resolves edges with optional lossy call-resolution strategies. @intent preserve current strict resolution by default while supporting fallback mode for CI noise reduction.

Types

type FilterResolvedDiagnostics

type FilterResolvedDiagnostics struct {
	DroppedCount int
	ByKind       map[graph.EdgeKind]int
	ByFile       map[string]int
	ByReason     map[string]int
	Samples      []FilterResolvedSample
}

FilterResolvedDiagnostics summarizes edges dropped because one or both endpoints remain unresolved. @intent surface enough aggregate context to debug why parsed edges did not become traversable graph edges.

func FilterResolvedWithDiagnostics

func FilterResolvedWithDiagnostics(edges []graph.Edge) ([]graph.Edge, FilterResolvedDiagnostics)

FilterResolvedWithDiagnostics returns resolved edges plus a summary of dropped unresolved edges. @intent preserve current filtering semantics while exposing actionable diagnostics for build/update debugging.

func FilterResolvedWithDiagnosticsFiltered

func FilterResolvedWithDiagnosticsFiltered(edges []graph.Edge, filterUnresolved UnresolvedEdgeFilter) ([]graph.Edge, FilterResolvedDiagnostics)

FilterResolvedWithDiagnosticsFiltered returns resolved edges plus diagnostics while letting callers suppress selected unresolved edges from the reported summary. @intent keep edge filtering behavior stable while controlling noise from known-unresolvable patterns.

func PartitionResolvedWithDiagnosticsFiltered

func PartitionResolvedWithDiagnosticsFiltered(edges []graph.Edge, filterUnresolved UnresolvedEdgeFilter) ([]graph.Edge, []graph.Edge, FilterResolvedDiagnostics)

PartitionResolvedWithDiagnosticsFiltered separates traversable edges from durable unresolved candidates. @intent let build and update persist unresolved syntax edges without changing query-visible graph semantics.

type FilterResolvedSample

type FilterResolvedSample struct {
	Kind        graph.EdgeKind
	FilePath    string
	Fingerprint string
	Reason      string
}

FilterResolvedSample captures one dropped edge example for debugging unresolved persistence candidates. @intent retain a bounded set of representative dropped edges so operators can inspect fingerprints without flooding logs.

type ImportFileIndex

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

ImportFileIndex maps exact directories and their suffixes to persisted file nodes. @intent resolve many import paths from one immutable file-node snapshot without repeated store scans.

func NewImportFileIndex

func NewImportFileIndex(nodes []graph.Node) *ImportFileIndex

NewImportFileIndex precomputes directory suffixes for the supplied file nodes. @intent share the exact-directory and longest-suffix import policy across build and staged update resolution.

func (*ImportFileIndex) Find

func (i *ImportFileIndex) Find(importPath string) []graph.Node

Find returns exact directory matches first, then all matches with the longest suffix. @intent preserve GraphStore import lookup precedence using bounded map reads.

type NodeLookup

type NodeLookup interface {
	GetNodesByIDs(ctx context.Context, ids []uint) ([]graph.Node, error)
	GetNodesByFiles(ctx context.Context, filePaths []string) (map[string][]graph.Node, error)
	GetNodesByQualifiedNames(ctx context.Context, names []string) (map[string][]graph.Node, error)
}

NodeLookup provides the node reads needed to resolve parsed edge endpoints. @intent keep edge endpoint resolution independent of the concrete graph store.

type ResolveOptions

type ResolveOptions struct {
	FallbackCalls bool
}

ResolveOptions controls additional, lossy call-resolution behavior. @intent allow callers to trade strictness for coverage in low-confidence call cases.

type UnresolvedEdgeFilter

type UnresolvedEdgeFilter func(edge graph.Edge, reason string) bool

UnresolvedEdgeFilter returns true when a dropped unresolved edge should be omitted from diagnostics aggregation while still being dropped from the returned edge list. @intent allow callers to suppress noisy unresolved-edge classes (e.g., expected external imports).

Jump to

Keyboard shortcuts

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