Documentation
¶
Overview ¶
Package incidents defines Incidentius's store-independent incident model and deterministic event projection. Persistence and transport adapters live in their owning repositories and depend on these validated types.
Index ¶
- Constants
- Variables
- func ValidateMutationID(value string) error
- type Actor
- type ActorKind
- type AppendResult
- type ArtifactRef
- type Assertion
- type AssertionKind
- type ComparisonRef
- type CreatedPayload
- type Event
- type EventDraft
- type EventType
- type ExecutionRef
- type ImportedEventRef
- type Incident
- type IncidentRef
- type MergeMutation
- type MergeResult
- type MergedPayload
- type Mutation
- type NoteAddedPayload
- type Outcome
- type OutcomePayload
- type ProjectArtifactRef
- type ProjectRef
- type RefKind
- type SharedLayout
- type Status
- type StatusPayload
- type Store
- type StoreLocation
- type StoreLocationKind
Constants ¶
const ( ActorViaWeb = "web" ActorViaCLI = "cli" ActorViaAPI = "api" ActorViaSlack = "slack" )
const ( ConfidenceSpeculative = "speculative" ConfidenceLikely = "likely" ConfidenceConfirmed = "confirmed" )
Variables ¶
var ( ErrMutationConflict = errors.New("incident mutation id was reused with different content") ErrSequenceConflict = errors.New("incident event sequence changed") )
Functions ¶
func ValidateMutationID ¶
ValidateMutationID applies the store-wide receipt key rules to every transport and storage mutation before the identifier is used as a path.
Types ¶
type AppendResult ¶
type ArtifactRef ¶
type ArtifactRef struct {
Kind RefKind `json:"kind"`
ID string `json:"id,omitempty"`
Incident *IncidentRef `json:"incident,omitempty"`
Project *ProjectRef `json:"project,omitempty"`
Execution *ExecutionRef `json:"execution,omitempty"`
Artifact *ProjectArtifactRef `json:"artifact,omitempty"`
Comparison *ComparisonRef `json:"comparison,omitempty"`
}
ArtifactRef uses structured identities for cross-store artifacts. ID is reserved for incident-local hypotheses and events.
func (ArtifactRef) Validate ¶
func (r ArtifactRef) Validate() error
type Assertion ¶
type Assertion struct {
Kind AssertionKind `json:"kind"`
Confidence string `json:"confidence,omitempty"`
}
type AssertionKind ¶
type AssertionKind string
const ( AssertionObservation AssertionKind = "observation" AssertionClaim AssertionKind = "claim" AssertionQuestion AssertionKind = "question" AssertionHypothesis AssertionKind = "hypothesis" AssertionInference AssertionKind = "inference" AssertionDeterministicResult AssertionKind = "deterministic-result" )
type ComparisonRef ¶
type ComparisonRef struct {
Left ExecutionRef `json:"left"`
Right ExecutionRef `json:"right"`
}
func (ComparisonRef) Validate ¶
func (r ComparisonRef) Validate() error
type CreatedPayload ¶
type CreatedPayload struct {
UID string `json:"uid"`
Title string `json:"title"`
Description string `json:"description"`
Projects []ProjectRef `json:"projects,omitempty"`
}
type Event ¶
type Event struct {
ID string `json:"id"`
Seq uint64 `json:"seq"`
At time.Time `json:"at"`
VisibleAt time.Time `json:"visibleAt"`
Incident IncidentRef `json:"incident"`
// ImportedFrom preserves the original identity of an event copied by a
// merge. Imported events remain timeline evidence but do not mutate the
// survivor's active projection.
ImportedFrom *ImportedEventRef `json:"importedFrom,omitempty"`
Actor Actor `json:"actor"`
Type EventType `json:"type"`
Assertion Assertion `json:"assertion"`
Refs []ArtifactRef `json:"refs,omitempty"`
Payload json.RawMessage `json:"payload"`
}
type EventDraft ¶
type EventDraft struct {
At time.Time `json:"at"`
Actor Actor `json:"actor"`
Type EventType `json:"type"`
Assertion Assertion `json:"assertion"`
Refs []ArtifactRef `json:"refs,omitempty"`
Payload json.RawMessage `json:"payload"`
}
func (EventDraft) Validate ¶
func (d EventDraft) Validate(incident IncidentRef) error
type ExecutionRef ¶
type ExecutionRef struct {
StoreID string `json:"storeId"`
ProjectID string `json:"projectId"`
ExecutionID string `json:"executionId"`
}
func (ExecutionRef) Validate ¶
func (r ExecutionRef) Validate() error
type ImportedEventRef ¶
type ImportedEventRef struct {
Incident IncidentRef `json:"incident"`
EventID string `json:"eventId"`
Seq uint64 `json:"seq"`
MergeID string `json:"mergeId"`
}
func (ImportedEventRef) Validate ¶
func (r ImportedEventRef) Validate(destination IncidentRef) error
type Incident ¶
type Incident struct {
Ref IncidentRef `json:"ref"`
UID string `json:"uid"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
Status Status `json:"status"`
Outcome Outcome `json:"outcome,omitempty"`
MergedInto *IncidentRef `json:"mergedInto,omitempty"`
Projects []ProjectRef `json:"projects,omitempty"`
Notes []string `json:"notes,omitempty"`
LastSeq uint64 `json:"lastSeq"`
}
Incident is the deterministic current or historical projection.
type IncidentRef ¶
IncidentRef is the globally unambiguous identity of an incident.
func ParseIncidentRef ¶
func ParseIncidentRef(value string) (IncidentRef, error)
func (IncidentRef) String ¶
func (r IncidentRef) String() string
func (IncidentRef) Validate ¶
func (r IncidentRef) Validate() error
type MergeMutation ¶
type MergeMutation struct {
MutationID string `json:"mutationId"`
Source IncidentRef `json:"source"`
Into IncidentRef `json:"into"`
}
func (MergeMutation) Validate ¶
func (m MergeMutation) Validate() error
type MergeResult ¶
type MergedPayload ¶
type MergedPayload struct {
Into IncidentRef `json:"into"`
MergeID string `json:"mergeId"`
}
type Mutation ¶
type Mutation struct {
MutationID string `json:"mutationId"`
Incident IncidentRef `json:"incident"`
ExpectedSeq *uint64 `json:"expectedSeq,omitempty"`
Event EventDraft `json:"event"`
}
type NoteAddedPayload ¶
type NoteAddedPayload struct {
Body string `json:"body"`
}
type OutcomePayload ¶
type OutcomePayload struct {
Outcome Outcome `json:"outcome"`
}
type ProjectArtifactRef ¶
type ProjectArtifactRef struct {
StoreID string `json:"storeId"`
ProjectID string `json:"projectId"`
Environment string `json:"environment,omitempty"`
ID string `json:"id"`
}
func (ProjectArtifactRef) Validate ¶
func (r ProjectArtifactRef) Validate() error
type ProjectRef ¶
type ProjectRef struct {
StoreID string `json:"storeId"`
ProjectID string `json:"projectId"`
Environment string `json:"environment,omitempty"`
}
func (ProjectRef) Validate ¶
func (r ProjectRef) Validate() error
type RefKind ¶
type RefKind string
const ( RefExecution RefKind = "execution" RefSnapshot RefKind = "snapshot" RefAnnotation RefKind = "annotation" RefCheck RefKind = "check" RefCompare RefKind = "compare" RefQuery RefKind = "query" RefBoard RefKind = "board" RefFact RefKind = "fact" RefHypothesis RefKind = "hypothesis" RefEvent RefKind = "event" RefIncident RefKind = "incident" RefProject RefKind = "project" )
type SharedLayout ¶
type SharedLayout struct {
}
func LayoutFor ¶
func LayoutFor(ref IncidentRef) (SharedLayout, error)
type StatusPayload ¶
type StatusPayload struct {
Status Status `json:"status"`
}
type Store ¶
type Store interface {
Append(ctx context.Context, mutation Mutation) (AppendResult, error)
Events(ctx context.Context, ref IncidentRef, afterSeq uint64) ([]Event, error)
Projection(ctx context.Context, ref IncidentRef, at *time.Time) (Incident, error)
Merge(ctx context.Context, mutation MergeMutation) (MergeResult, error)
}
Store is implemented once per configured StoreLocation. Append and Merge own cross-process exclusion, durable mutation receipts, and crash recovery.
type StoreLocation ¶
type StoreLocation struct {
StoreID string `json:"storeId"`
Kind StoreLocationKind `json:"kind"`
Project *ProjectRef `json:"project,omitempty"`
}
StoreLocation selects where one incident store is hosted. All kinds use SharedLayout; adapters differ only in how their DALgo database is opened.
func (StoreLocation) Validate ¶
func (l StoreLocation) Validate() error
type StoreLocationKind ¶
type StoreLocationKind string
const ( StoreLocationProjectRepository StoreLocationKind = "project-repository" StoreLocationDedicatedRepository StoreLocationKind = "dedicated-repository" StoreLocationApplicationRepository StoreLocationKind = "application-repository" )