httplink

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractURLPaths

func ExtractURLPaths(text string) []string

ExtractURLPaths finds URL path segments from text (exported for use by pipeline).

Types

type HTTPCallSite

type HTTPCallSite struct {
	Path                string
	Method              string // best-effort: "GET", "POST", etc. or "" if unknown
	SourceName          string
	SourceQualifiedName string
	SourceLabel         string // "Function", "Method", or "Module"
	IsAsync             bool   // true when source uses async dispatch keywords
}

HTTPCallSite represents a discovered HTTP call site.

type HTTPLink struct {
	CallerQN    string
	CallerLabel string
	HandlerQN   string
	URLPath     string
	EdgeType    string // "HTTP_CALLS" or "ASYNC_CALLS"
}

HTTPLink represents a matched HTTP call from caller to handler.

type HTTPLinkerConfig

type HTTPLinkerConfig struct {
	// ExcludePaths are route paths to exclude from HTTP_CALLS matching.
	// These are added to (not replacing) the built-in defaultExcludePaths.
	ExcludePaths []string `yaml:"exclude_paths"`

	// MinConfidence is the minimum confidence score for creating HTTP_CALLS edges.
	// Default: 0.25 (includes speculative matches).
	MinConfidence *float64 `yaml:"min_confidence"`

	// FuzzyMatching enables/disables fuzzy URL matching.
	// Default: true.
	FuzzyMatching *bool `yaml:"fuzzy_matching"`
}

HTTPLinkerConfig holds HTTP linker-specific settings.

type Linker

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

Linker discovers cross-service HTTP calls and creates HTTP_CALLS edges.

func New

func New(s *store.Store, project string) *Linker

New creates a new HTTP Linker.

func (*Linker) AddCallSites

func (l *Linker) AddCallSites(sites []HTTPCallSite)

AddCallSites allows the pipeline to inject additional call sites from infra files.

func (*Linker) Run

func (l *Linker) Run() ([]HTTPLink, error)

Run executes the HTTP linking pass.

func (*Linker) SetConfig

func (l *Linker) SetConfig(cfg *LinkerConfig)

SetConfig sets the linker configuration. If cfg is nil, defaults are used.

type LinkerConfig

type LinkerConfig struct {
	HTTPLinker HTTPLinkerConfig `yaml:"http_linker"`
}

LinkerConfig holds user-overridable HTTP linker settings. Loaded from .cgrconfig in the project root.

func DefaultConfig

func DefaultConfig() *LinkerConfig

DefaultConfig returns the default linker configuration.

func LoadConfig

func LoadConfig(dir string) *LinkerConfig

LoadConfig reads .cgrconfig from the given directory. Returns default config if the file doesn't exist.

func (*LinkerConfig) AllExcludePaths

func (c *LinkerConfig) AllExcludePaths() []string

AllExcludePaths returns the combined list of default + user-configured exclude paths.

func (*LinkerConfig) EffectiveFuzzyMatching

func (c *LinkerConfig) EffectiveFuzzyMatching() bool

EffectiveFuzzyMatching returns the configured fuzzy matching setting, or the default (true) if not set.

func (*LinkerConfig) EffectiveMinConfidence

func (c *LinkerConfig) EffectiveMinConfidence() float64

EffectiveMinConfidence returns the configured minimum confidence, or the default if not set.

Phase E (2026-05-08): default raised from 0.25 to 0.36. PSM hand-labeling of all 98 HTTP_CALLS edges (Phase C state) revealed that conf < 0.36 is dominated by partial-match FPs targeting catch-all functions (`get_payload`, `userCertHandler`) — 14 FPs dropped vs 2 TP losses among the 16 below-threshold edges (7:1 FP-drop / TP-loss ratio). The prior 0.25 default was set when the resolver couldn't reach most real handlers (PSM HTTP_CALLS = 17 pre-Phase-C); now that the actix-builder extractor (PR #261) and HandlerRef resolution (PR #257) reach 98 real edges, the speculative band is no longer needed to surface load-bearing matches.

type RouteHandler

type RouteHandler struct {
	Path              string
	Method            string
	FunctionName      string
	QualifiedName     string
	HandlerRef        string // resolved handler function reference (e.g. "h.CreateOrder")
	ResolvedHandlerQN string // set by createRegistrationCallEdges — actual handler QN
	Protocol          string // "ws", "sse", or "" (standard HTTP)
	SourceExtractor   string // Phase B1 (2026-05-08): tags which extractor produced this entry — surfaced on Route node properties + routes.extractor.summary slog
}

RouteHandler represents a discovered HTTP route handler.

Jump to

Keyboard shortcuts

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