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 ¶
- type CodeEntityRepository
- type FragileResult
- type NoteRepository
- type RiskResult
- type Service
- func (s *Service) Annotate(ctx context.Context, entityType, entityID, note string) (*store.AgentNote, error)
- func (s *Service) Annotations(ctx context.Context, entityType string) ([]store.AgentNote, error)
- func (s *Service) Fragile(ctx context.Context, service string, limit int) (*FragileResult, error)
- func (s *Service) Risk(ctx context.Context, service string, limit int) (*RiskResult, error)
- type TestCorrelationRepository
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 ¶
Annotations lists all agent notes for a given entity type.
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).