signal

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package signal defines the carrier types that flow between signal producers and the metrics layer: the per-family metric input (CommonInput), the CollectedSignals bag the engine assembles and projects per family, and the RunSignals bundle the cmd layer produces.

Keeping these types here — rather than in internal/metrics — means adding a new signal only churns the new producer package and this package. The package joins the model ring: stdlib + internal/model/* imports only.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CollectedSignals

type CollectedSignals struct {
	Common      CommonInput
	Symbol      SymbolSignals
	Size        SizeSignals
	Duplication DuplicationSignals
}

CollectedSignals is the engine's producer-side bag of everything gathered for a run. It never reaches metric logic directly — the engine projects it to the common input each metric declares via AsCommon below.

func (CollectedSignals) AsCommon

func (s CollectedSignals) AsCommon() CommonInput

AsCommon projects to the common input.

type CommonInput

type CommonInput struct {
	Graph           *graph.Graph
	Classifications coupling.Index
	Findings        []finding.Finding
	Baseline        diagnostic.MetricSnapshot
	ToolCoverage    []diagnostic.Coverage
	ChangedFiles    []string
	// SyntaxFacts carries the ast-grep syntax facts produced by the syntax provider.
	// Empty when syntax is disabled or sg is absent. The syntax surface renderer
	// and coverage metrics consume this to produce informational counts.
	SyntaxFacts []diagnostic.SyntaxFact
	// DeprecatedDeps carries the locally-declared deprecation/retraction markers
	// detected by the manifest adapter. Empty when none were found. The deprecated-
	// deps renderer consumes this to produce informational counts.
	DeprecatedDeps []diagnostic.DeprecatedDep
}

CommonInput is the core set every metric can rely on (always populated by the pipeline). ChangedFiles is delta-scope, not git history, so it lives here.

type DuplicationSignals

type DuplicationSignals struct {
	Clusters []clone.Cluster
}

DuplicationSignals carries duplicated-code clusters from the external clone detector. Empty when the tool is off/absent.

type DynamicImportSignals added in v0.4.0

type DynamicImportSignals struct {
	Sites []diagnostic.DynamicImportSite
}

DynamicImportSignals carries the dynamic/lazy-import sites detected by the dynimports adapter. Empty when none were found. Report-only — never reaches a metric or the dependency graph.

type RunSignals

type RunSignals struct {
	Size        SizeSignals
	Duplication DuplicationSignals
	// ExtraCoverage carries tool-coverage records for opt-in tools that run in cmd
	// (loc, clones) rather than through the engine extractor loop.
	// The engine appends these to the diagnostic ToolCoverage slice.
	ExtraCoverage []diagnostic.Coverage
	// DynamicImports carries the report-only dynamic/lazy-import sites detected by
	// the dynimports adapter. Like ExtraCoverage, the engine reads it straight into
	// the diagnostic (rolled up per module) — no metric ever sees it, and it never
	// touches the dependency graph or the verdict.
	DynamicImports DynamicImportSignals
	// RuntimeAsync carries the async-bridge signals detected by the runtime adapter.
	// The engine rolls the sites up per module and writes them into the diagnostic.
	// Evidence-only — never annotates graph edges, never consumed by classify or
	// score, never changes the gate verdict.
	RuntimeAsync RuntimeAsyncSignals
	// DeprecatedDeps carries the locally-declared deprecation/retraction markers
	// detected by the manifest adapter. Report-only — never reaches a metric or
	// the dependency graph.
	DeprecatedDeps []diagnostic.DeprecatedDep
}

RunSignals is the producer-side bundle the cmd layer gathers and hands to the engine. The engine folds it (plus its own extract outputs) into a CollectedSignals for the metrics — no metric ever sees this type. Each group is empty when its source is unavailable.

type RuntimeAsyncSignals added in v0.7.0

type RuntimeAsyncSignals struct {
	Sites      []diagnostic.RuntimeAsyncSite
	Confidence string // "low" | "medium"
}

RuntimeAsyncSignals carries the async-bridge sites detected by the runtime adapter. Empty when none were found. Evidence-only — never annotates graph edges, never consumed by classify or score, never alters the verdict.

type SizeSignals

type SizeSignals struct {
	FileLOC        map[string]int
	FileClassIndex map[string]fileclass.FileClass // repo-relative slash path → FileClass; nil when loc walk did not run
}

SizeSignals carries per-file line counts (tests excluded) and the full file-class index covering ALL visited source files (including test and generated). Empty when absent.

type SymbolSignals

type SymbolSignals struct {
	Graph symbol.Graph
}

SymbolSignals carries the SCIP symbol graph. Empty when SCIP is off.

Jump to

Keyboard shortcuts

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