Help us shape the future of Go! Take the 2026 Go Developer Survey

concern

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package concern models low-confidence local findings before they become contribution hypotheses or public issues.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound indicates that a concern ID is absent.
	ErrNotFound = errors.New("concern not found")
	// ErrInvalidStatus indicates an unsupported lifecycle status.
	ErrInvalidStatus = errors.New("invalid concern status")
	// ErrInvalidTransition indicates a forbidden lifecycle transition.
	ErrInvalidTransition = errors.New("invalid concern status transition")
	// ErrInvalidLink indicates a malformed or unsupported relationship.
	ErrInvalidLink = errors.New("invalid concern link")
	// ErrConflict indicates that a caller tried to replace a revision it no
	// longer owns.
	ErrConflict = errors.New("concern changed concurrently")
)

Functions

This section is empty.

Types

type Concern

type Concern struct {
	ID               string
	Repo             domain.RepoRef
	CommitSHA        string
	WorkspaceID      string
	Title            string
	ProblemStatement string
	SuspectedOwner   string
	Confidence       float64
	Unknowns         []string
	SuccessCriterion string
	Notes            string
	EvidenceIDs      []string
	SourceRefs       []domain.SourceRef
	SourceProvenance []evidence.SourceRevision
	Links            []Link
	Status           Status
	AuditTrail       []StatusChange
	Promotion        *Promotion
	CreatedAt        time.Time
	UpdatedAt        time.Time
}

Concern is a durable local intake record. WorkspaceID is an opaque corpus identity; absolute host paths are never stored here.

type Filter

type Filter struct {
	Repo   domain.RepoRef
	Status Status
	Query  string
	Limit  int
	Offset int
}

Filter bounds an offline list or search.

type Link struct {
	Kind       LinkKind
	TargetType string
	TargetID   string
	Note       string
	CreatedAt  time.Time
}

Link points to another local record or a credential-free repository ref.

type LinkKind

type LinkKind string

LinkKind describes an explicit, non-inferred relationship.

const (
	// LinkRelated is a non-causal association.
	LinkRelated LinkKind = "related"
	// LinkDuplicateCandidate records possible duplicate work.
	LinkDuplicateCandidate LinkKind = "duplicate_candidate"
	// LinkHotspot points at an affected repository area.
	LinkHotspot LinkKind = "hotspot"
	// LinkInvestigation points at a promoted or related investigation.
	LinkInvestigation LinkKind = "investigation"
	// LinkOpportunity points at a promoted or related opportunity.
	LinkOpportunity LinkKind = "opportunity"
)

type ListResult added in v0.11.0

type ListResult struct {
	Concerns []*Concern
	Total    int
	Limit    int
}

ListResult separates a bounded concern window from its matching population.

type Promotion

type Promotion struct {
	Kind            string
	InvestigationID string
	HypothesisID    string
	OpportunityID   string
	PromotedAt      time.Time
}

Promotion preserves the local concern's downstream workflow identity.

type Repository

type Repository interface {
	SaveConcern(context.Context, *Concern) error
	UpdateConcern(context.Context, *Concern, *Concern) error
	GetConcern(context.Context, string) (*Concern, error)
	ListConcerns(context.Context, Filter) (*ListResult, error)
	AddConcernLink(context.Context, string, Link) error
}

Repository is the narrow persistence boundary for local concerns.

type Service

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

Service validates local concern lifecycle operations.

func NewService

func NewService(repo Repository) *Service

NewService returns a concern service backed by repo.

func (*Service) Create

func (s *Service) Create(ctx context.Context, item *Concern) (*Concern, error)

Create validates and stores one local concern.

func (*Service) Get

func (s *Service) Get(ctx context.Context, id string) (*Concern, error)

Get returns one concern.

func (s *Service) Link(ctx context.Context, id string, link Link) error

Link records an explicit relationship. Duplicate candidates remain links; they do not silently change concern status or assert a root cause.

func (*Service) List

func (s *Service) List(ctx context.Context, filter Filter) (*ListResult, error)

List returns at most 100 concerns with exact population metadata and performs no external reads.

func (*Service) SetStatus

func (s *Service) SetStatus(ctx context.Context, id string, next Status, rationale string) (*Concern, error)

SetStatus applies an explicit lifecycle transition with rationale.

func (*Service) Update

func (s *Service) Update(ctx context.Context, item *Concern) (*Concern, error)

Update replaces editable concern fields while preserving identity and audit.

type Status

type Status string

Status is the lifecycle of a local concern.

const (
	// StatusUntriaged is newly recorded intake.
	StatusUntriaged Status = "untriaged"
	// StatusAccepted marks a concern as worth investigating.
	StatusAccepted Status = "accepted"
	// StatusInvestigating marks active evidence gathering.
	StatusInvestigating Status = "investigating"
	// StatusDeferred preserves a concern without active work.
	StatusDeferred Status = "deferred"
	// StatusPromoted marks an atomically created downstream workflow.
	StatusPromoted Status = "promoted"
	// StatusResolved closes a concern without active promotion.
	StatusResolved Status = "resolved"
)

type StatusChange

type StatusChange struct {
	From      Status
	To        Status
	Rationale string
	At        time.Time
}

StatusChange records a deliberate lifecycle transition.

Jump to

Keyboard shortcuts

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