code

package
v0.19.4 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package code provides the domain service for code entity risk analysis and test correlation. The repository interfaces define what the service needs from the data layer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CodeEntityRepository

type CodeEntityRepository interface {
	TopByRisk(ctx context.Context, service string, limit int) ([]store.CodeEntity, error)
	GetByName(ctx context.Context, entityType store.CodeEntityType, entityName, service string) (*store.CodeEntity, error)
	BatchGetRisk(ctx context.Context, entityType store.CodeEntityType, names []string, service string) ([]store.CodeEntity, error)
}

CodeEntityRepository defines read access for code entity risk data. Implemented by internal/db.CodeEntityStore (SQLite adapter).

type FragileResult

type FragileResult struct {
	Paths []store.UncoveredErrorPath `json:"paths"`
	Total int                        `json:"total"`
}

FragileResult holds uncovered error paths that need test coverage.

type NoteRepository

type NoteRepository interface {
	Upsert(ctx context.Context, entityType, entityID, note string) (*store.AgentNote, error)
	Get(ctx context.Context, entityType, entityID string) (*store.AgentNote, error)
	List(ctx context.Context, entityType string) ([]store.AgentNote, error)
}

NoteRepository provides access to agent annotations on code entities. Implemented by internal/db.AgentNoteStore (SQLite adapter).

type RiskResult

type RiskResult struct {
	Entities []store.CodeEntity `json:"entities"`
	Total    int                `json:"total"`
}

RiskResult holds the top risky code entities.

type Service

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

Service provides code entity risk analysis and test correlation.

func NewService

func NewService(entities CodeEntityRepository, tests TestCorrelationRepository, notes NoteRepository) *Service

NewService creates a code intelligence service.

func (*Service) Annotate

func (s *Service) Annotate(ctx context.Context, entityType, entityID, note string) (*store.AgentNote, error)

Annotate adds or updates an agent note on a code entity.

func (*Service) Annotations

func (s *Service) Annotations(ctx context.Context, entityType string) ([]store.AgentNote, error)

Annotations lists all agent notes for a given entity type.

func (*Service) Fragile

func (s *Service) Fragile(ctx context.Context, service string, limit int) (*FragileResult, error)

Fragile returns error paths that lack test coverage.

func (*Service) Risk

func (s *Service) Risk(ctx context.Context, service string, limit int) (*RiskResult, error)

Risk returns the top code entities ranked by risk score.

type TestCorrelationRepository

type TestCorrelationRepository interface {
	TopByPriority(ctx context.Context, service string, limit int) ([]store.UncoveredErrorPath, error)
	GetByFingerprint(ctx context.Context, fingerprint string) (*store.UncoveredErrorPath, error)
}

TestCorrelationRepository defines access to uncovered error path analysis. Implemented by internal/db.TestCorrelationStore (SQLite adapter).

Jump to

Keyboard shortcuts

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