trace

package
v0.12.0 Latest Latest
Warning

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

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

Documentation

Overview

Package trace builds and queries the CodeGrapher projection of SpecScore trace records. The projection is deliberately separate from language scope stores because a source link commonly crosses from Go to a SpecScore node.

Index

Constants

View Source
const ContractVersion = contractVersion

ContractVersion is the provider contract consumed by this package.

Variables

This section is empty.

Functions

func Build

func Build(root string, sourceStores []*store.Store) ([]store.TraceNode, []store.TraceEdge, error)

Build scans normalized SpecScore records and source symbols into a complete deterministic projection. It does not mutate any store.

func Index

func Index(root string, sourceStores []*store.Store, projection *store.Store) error

Index builds and persists the complete projection.

Types

type Coverage

type Coverage struct {
	Available      bool    `json:"available"`
	ContentHash    string  `json:"content_hash,omitempty"`
	LinesCovered   int     `json:"lines_covered,omitempty"`
	LinesUncovered int     `json:"lines_uncovered,omitempty"`
	PctCovered     float64 `json:"pct_covered,omitempty"`
	RunAt          int64   `json:"run_at,omitempty"`
}

type LinkedSymbol

type LinkedSymbol struct {
	Symbol    store.TraceNode `json:"symbol"`
	Location  SourceLocation  `json:"location"`
	Directive SourceLocation  `json:"directive"`
	Coverage  *Coverage       `json:"coverage,omitempty"`
}

type QueryResult

type QueryResult struct {
	Version           string          `json:"version"`
	Reference         string          `json:"reference"`
	IndexedRevision   string          `json:"indexed_revision"`
	Target            store.TraceNode `json:"target"`
	Implements        []LinkedSymbol  `json:"implements"`
	Verifies          []LinkedSymbol  `json:"verifies"`
	References        []LinkedSymbol  `json:"references"`
	AvailableCoverage bool            `json:"available_coverage"`
}

QueryResult is the stable JSON response for `codegrapher trace`.

func Query

func Query(reference string, projection *store.Store, sourceStores []*store.Store, root string) (*QueryResult, error)

Query returns accepted links for a feature, REQ, AC, or scenario reference.

type SourceLocation

type SourceLocation struct {
	Path        string `json:"path"`
	StartLine   int    `json:"start_line"`
	StartColumn int    `json:"start_column"`
	EndLine     int    `json:"end_line"`
	EndColumn   int    `json:"end_column"`
}

SourceLocation is the user-facing location of an attached source symbol or directive.

Jump to

Keyboard shortcuts

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