incidents

package
v0.83.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 15 Imported by: 5

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

View Source
const (
	ActorViaWeb   = "web"
	ActorViaCLI   = "cli"
	ActorViaAPI   = "api"
	ActorViaSlack = "slack"
)
View Source
const (
	ConfidenceSpeculative = "speculative"
	ConfidenceLikely      = "likely"
	ConfidenceConfirmed   = "confirmed"
)

Variables

View Source
var (
	ErrMutationConflict = errors.New("incident mutation id was reused with different content")
	ErrSequenceConflict = errors.New("incident event sequence changed")
)

Functions

func CanTransitionIncidentStatus added in v0.79.1

func CanTransitionIncidentStatus(from, to Status) bool

CanTransitionIncidentStatus is the version-one Work lifecycle for ordinary status events. Terminal reopening is deliberately absent: it needs an explicit incident.reopened event to fence prior evidence. Legacy version-zero status events retain their historic forward-only folding rules.

func MatchesListQuery added in v0.31.0

func MatchesListQuery(incident IncidentView, query ListQuery) bool

func ValidateIncidentResolutionProof added in v0.79.1

func ValidateIncidentResolutionProof(i Incident, p ResolutionProof, at time.Time) error

ValidateIncidentResolutionProof adds the incident's current lifecycle epoch to the existing immutable criterion/scope/definition/freshness validation. Hosts must derive ResolutionEpoch and EvaluatedAt from current server-owned state; changing only the epoch on a previously produced run cannot make it current.

func ValidateMutationID

func ValidateMutationID(value string) error

ValidateMutationID applies the store-wide receipt key rules to every transport and storage mutation before the identifier is used as a path.

func ValidateResolutionProof added in v0.61.0

func ValidateResolutionProof(c ResolutionCriterion, p ResolutionProof, at time.Time) error

ValidateResolutionProof checks an already resolved, trusted proof against its fixed criterion. Synthetic business clocks must never be supplied as at.

Types

type APIStore added in v0.31.0

type APIStore interface {
	Store
	Create(ctx context.Context, mutation CreateMutation) (CreateResult, error)
	List(ctx context.Context, query CandidateListQuery) ([]Incident, error)
	Watch(ctx context.Context, query WatchQuery) (EventStream, error)
}

APIStore is the Task 3 server contract. Store remains source-compatible for append/replay adapters while providers implement atomic creation, querying, and a server-driven stream before exposing Incidentius endpoints.

type Actor

type Actor struct {
	Kind ActorKind `json:"kind"`
	ID   string    `json:"id"`
	Via  string    `json:"via,omitempty"`
}

func (Actor) Validate added in v0.31.0

func (a Actor) Validate() error

type ActorKind

type ActorKind string
const (
	ActorHuman  ActorKind = "human"
	ActorAgent  ActorKind = "agent"
	ActorSystem ActorKind = "system"
)

type AppendResult

type AppendResult struct {
	Event      Event    `json:"event"`
	Projection Incident `json:"projection"`
	Replayed   bool     `json:"replayed"`
}

type ArtifactRef

type ArtifactRef struct {
	SourceOperation *SourceOperationRef `json:"sourceOperation,omitempty"`
	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"`
	CheckRun        *CheckRunRef        `json:"checkRun,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 AssetRefEntry added in v0.31.0

type AssetRefEntry struct {
	EventID string      `json:"eventId"`
	Ref     ArtifactRef `json:"ref"`
}

AssetRefEntry retains the stable source event for each derived backlink. AssetRefs remains the source-compatible unique projection for older readers.

type CandidateListQuery added in v0.31.0

type CandidateListQuery struct {
	Statuses       []Status `json:"statuses,omitempty"`
	ProjectStoreID string   `json:"projectStoreId,omitempty"`
	ProjectID      string   `json:"project,omitempty"`
	Environment    string   `json:"environment,omitempty"`
}

CandidateListQuery is the provider-facing safe subset. Protected backlink filters are applied only after current-policy IncidentViews are constructed.

func (CandidateListQuery) Validate added in v0.31.0

func (q CandidateListQuery) Validate() error

type CanonicalContext added in v0.31.0

type CanonicalContext = investigation.Context

CanonicalContext is an alias, not an incident-specific model. Incidents and the transport appendix consume the same Investigation Context type.

type CheckRunRef added in v0.61.0

type CheckRunRef struct {
	StoreID      string `json:"storeId"`
	ProjectID    string `json:"projectId"`
	Environment  string `json:"environment"`
	CheckID      string `json:"checkId"`
	CheckVersion uint64 `json:"checkVersion"`
	RunID        string `json:"runId"`
}

CheckRunRef identifies a saved Check run, never a query execution or definition.

func (CheckRunRef) Validate added in v0.61.0

func (r CheckRunRef) Validate() error

type CompareRunPayload added in v0.34.0

type CompareRunPayload struct {
	Key []string `json:"key"`
}

CompareRunPayload persists only the deterministic key contract. The row diff remains an endpoint result and must never enter the incident event log.

type ComparisonRef

type ComparisonRef struct {
	Left  ExecutionRef `json:"left"`
	Right ExecutionRef `json:"right"`
}

func (ComparisonRef) Validate

func (r ComparisonRef) Validate() error

type ContextFactAddedPayload added in v0.33.0

type ContextFactAddedPayload struct {
	Fact investigation.Fact `json:"fact"`
}

type ContextFactAddedViewPayload added in v0.33.0

type ContextFactAddedViewPayload struct {
	Fact investigation.FactView `json:"fact"`
}

type ContextFactPromotedPayload added in v0.33.0

type ContextFactPromotedPayload struct {
	Fact ContextFactRef `json:"fact"`
	Role string         `json:"role"`
}

func (ContextFactPromotedPayload) Validate added in v0.33.0

func (p ContextFactPromotedPayload) Validate() error

type ContextFactRef added in v0.33.0

type ContextFactRef struct {
	Scope investigation.ProjectScope `json:"scope"`
	ID    string                     `json:"id"`
	Layer string                     `json:"layer"`
}

ContextFactRef identifies one fact within one named context layer. Fact IDs remain project-scoped; layer disambiguates the retained overlay original from a canonical promotion copy.

func (ContextFactRef) Key added in v0.33.0

func (ContextFactRef) Validate added in v0.33.0

func (r ContextFactRef) Validate() error

type ContextFactRejectedPayload added in v0.33.0

type ContextFactRejectedPayload struct {
	Layer string `json:"layer"`
}

func (ContextFactRejectedPayload) Validate added in v0.33.0

func (p ContextFactRejectedPayload) Validate() error

type ContextPromotion added in v0.33.0

type ContextPromotion struct {
	EventID string         `json:"eventId"`
	Fact    ContextFactRef `json:"fact"`
	Role    string         `json:"role"`
}

ContextPromotion is durable projection history for a promotion event. The source fact remains in CanonicalContext under its overlay layer.

func (ContextPromotion) Validate added in v0.33.0

func (p ContextPromotion) Validate() error

type ContextRejection added in v0.33.0

type ContextRejection struct {
	EventID string `json:"eventId"`
	Layer   string `json:"layer"`
}

func (ContextRejection) Validate added in v0.33.0

func (r ContextRejection) Validate() error

type CreateMutation added in v0.31.0

type CreateMutation struct {
	MutationID       string           `json:"mutationId"`
	StoreID          string           `json:"storeId"`
	UID              string           `json:"uid"`
	Title            string           `json:"title"`
	Description      string           `json:"description,omitempty"`
	At               time.Time        `json:"at"`
	Reporter         Actor            `json:"reporter"`
	PrimaryProject   ProjectRef       `json:"primaryProject"`
	Projects         []ProjectRef     `json:"projects,omitempty"`
	CanonicalContext CanonicalContext `json:"canonicalContext"`
}

CreateMutation is allocated atomically by a store. IncidentID is absent on purpose: the implementation assigns the next store-scoped INC-n while it holds the same exclusion boundary used to commit the first event.

func (CreateMutation) Validate added in v0.31.0

func (m CreateMutation) Validate() error

type CreateResult added in v0.31.0

type CreateResult struct {
	Event      Event    `json:"event"`
	Projection Incident `json:"projection"`
	Replayed   bool     `json:"replayed"`
}

type CreatedPayload

type CreatedPayload struct {
	UID              string           `json:"uid"`
	Title            string           `json:"title"`
	Description      string           `json:"description"`
	Projects         []ProjectRef     `json:"projects,omitempty"`
	Reporter         Actor            `json:"reporter"`
	CanonicalContext CanonicalContext `json:"canonicalContext"`
}

type CreatedViewPayload added in v0.31.0

type CreatedViewPayload struct {
	UID              string                    `json:"uid"`
	Title            string                    `json:"title"`
	Description      string                    `json:"description"`
	Projects         []ProjectRef              `json:"projects,omitempty"`
	Reporter         Actor                     `json:"reporter"`
	CanonicalContext investigation.ContextView `json:"canonicalContext"`
}

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"`
}

func ApplyEventView added in v0.31.0

func ApplyEventView(stored Event, policy ViewPolicy) (Event, bool, error)

func (Event) Validate

func (e Event) Validate() error

func (Event) ValidateView added in v0.31.0

func (e Event) ValidateView() error

ValidateView validates a detached, policy-filtered event. Unlike persisted events, a view may contain explicit fact-value redaction markers.

type EventCursor added in v0.31.0

type EventCursor string

func (EventCursor) Validate added in v0.31.0

func (c EventCursor) Validate() error

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 EventStream added in v0.31.0

type EventStream interface {
	Next(ctx context.Context) (StreamItem, error)
	Close() error
}

type EventType

type EventType string
const (
	EventIncidentCriterionSet EventType = "incident.criterion-set"
	EventIncidentResolved     EventType = "incident.resolved"
	EventIncidentReopened     EventType = "incident.reopened"
	EventIncidentCreated      EventType = "incident.created"
	EventIncidentStatus       EventType = "incident.status"
	EventIncidentOutcome      EventType = "incident.outcome"
	EventIncidentMerged       EventType = "incident.merged"
	EventNoteAdded            EventType = "note.added"
	EventContextFactAdded     EventType = "context.fact.added"
	EventContextFactPromoted  EventType = "context.fact.promoted"
	EventContextFactRejected  EventType = "context.fact.rejected"
	EventCompareRun           EventType = "compare.run"
)

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 FactSignal added in v0.31.0

type FactSignal struct {
	Entity    string                   `json:"entity"`
	Field     string                   `json:"field"`
	Value     investigation.TypedValue `json:"value"`
	Condition string                   `json:"condition,omitempty"`
}

func (FactSignal) Validate added in v0.31.0

func (s FactSignal) Validate() error

type FactVisibility added in v0.31.0

type FactVisibility string
const (
	FactVisible       FactVisibility = "visible"
	FactValueRedacted FactVisibility = "value-redacted"
	FactHidden        FactVisibility = "hidden"
)

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 {
	// WorkItemID is supplied only by the trusted canonical metadata projection.
	WorkItemID          string               `json:"workItemId,omitempty"`
	ResolutionEpoch     uint64               `json:"resolutionEpoch,omitempty"`
	ReopenedAt          *time.Time           `json:"reopenedAt,omitempty"`
	ReopenEventID       string               `json:"reopenEventId,omitempty"`
	ResolutionCriterion *ResolutionCriterion `json:"resolutionCriterion,omitempty"`
	Resolution          *ResolvedPayload     `json:"resolution,omitempty"`
	CriterionEventID    string               `json:"criterionEventId,omitempty"`
	ResolutionEventID   string               `json:"resolutionEventId,omitempty"`
	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"`
	Participants        []Participant        `json:"participants,omitempty"`
	CanonicalContext    CanonicalContext     `json:"canonicalContext"`
	ContextPromotions   []ContextPromotion   `json:"contextPromotions,omitempty"`
	ContextRejections   []ContextRejection   `json:"contextRejections,omitempty"`
	AssetRefs           []ArtifactRef        `json:"assetRefs,omitempty"`
	AssetRefEntries     []AssetRefEntry      `json:"assetRefEntries,omitempty"`
	NoteEntries         []Note               `json:"noteEntries,omitempty"`
	Notes               []string             `json:"notes,omitempty"`
	LastSeq             uint64               `json:"lastSeq"`
}

Incident is the deterministic current or historical projection.

func Fold

func Fold(events []Event, at *time.Time) (Incident, error)

func (Incident) Validate added in v0.31.0

func (i Incident) Validate() error

type IncidentRef

type IncidentRef struct {
	StoreID    string `json:"storeId"`
	IncidentID string `json:"incidentId"`
}

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 IncidentView added in v0.31.0

type IncidentView struct {
	WorkItemID          string                    `json:"workItemId,omitempty"`
	ResolutionEpoch     uint64                    `json:"resolutionEpoch,omitempty"`
	ReopenedAt          *time.Time                `json:"reopenedAt,omitempty"`
	ResolutionCriterion *ResolutionCriterion      `json:"resolutionCriterion,omitempty"`
	Resolution          *ResolvedPayload          `json:"resolution,omitempty"`
	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"`
	Participants        []Participant             `json:"participants,omitempty"`
	CanonicalContext    investigation.ContextView `json:"canonicalContext"`
	ContextPromotions   []ContextPromotion        `json:"contextPromotions,omitempty"`
	ContextRejections   []ContextRejection        `json:"contextRejections,omitempty"`
	AssetRefs           []ArtifactRef             `json:"assetRefs,omitempty"`
	Notes               []string                  `json:"notes,omitempty"`
	LastSeq             uint64                    `json:"lastSeq"`
}

IncidentView is a detached current-policy projection. The stored Incident always contains canonical facts; only this read model may contain redaction markers.

func ApplyIncidentView added in v0.31.0

func ApplyIncidentView(stored Incident, policy ViewPolicy) IncidentView

func (IncidentView) Validate added in v0.31.0

func (i IncidentView) Validate() error

type ListQuery added in v0.31.0

type ListQuery struct {
	Statuses       []Status `json:"statuses,omitempty"`
	ProjectStoreID string   `json:"projectStoreId,omitempty"`
	ProjectID      string   `json:"project,omitempty"`
	Environment    string   `json:"environment,omitempty"`
	QueryID        string   `json:"query,omitempty"`
	CheckID        string   `json:"check,omitempty"`
	BoardID        string   `json:"board,omitempty"`
}

func (ListQuery) Candidates added in v0.31.0

func (q ListQuery) Candidates() CandidateListQuery

func (ListQuery) Validate added in v0.31.0

func (q ListQuery) Validate() error

func (ListQuery) ValidateArtifactFilters added in v0.31.0

func (q ListQuery) ValidateArtifactFilters() error

ValidateArtifactFilters validates the public filter values before a serving adapter resolves their project store and constructs the scoped ListQuery.

type MatchedSignal added in v0.31.0

type MatchedSignal struct {
	Kind  SignalKind `json:"kind"`
	Value string     `json:"value"`
}

func (MatchedSignal) Validate added in v0.31.0

func (s MatchedSignal) 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 MergeResult struct {
	Source   Incident `json:"source"`
	Into     Incident `json:"into"`
	Replayed bool     `json:"replayed"`
}

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"`
}

func (Mutation) Validate

func (m Mutation) Validate() error

type Note added in v0.31.0

type Note struct {
	EventID string `json:"eventId"`
	Body    string `json:"body"`
}

Note retains the stable source event identity required to re-check human text visibility without keying a policy decision by its sensitive body.

type NoteAddedPayload

type NoteAddedPayload struct {
	Body string `json:"body"`
	// Omitted and null presentation both mean ordinary actual-actor attribution.
	Presentation *NotePresentation `json:"presentation,omitempty"`
}

type NotePresentation added in v0.69.0

type NotePresentation struct {
	Kind        string `json:"kind"`
	CharacterID string `json:"characterId"`
}

NotePresentation is fictional display metadata, never an actor or authority. Event.Actor and Event.At retain the authenticated author and server time.

type Outcome

type Outcome string
const (
	OutcomeResolved   Outcome = "resolved"
	OutcomeFalseAlarm Outcome = "false-alarm"
	OutcomeAccepted   Outcome = "accepted"
	OutcomeHandedOff  Outcome = "handed-off"
	OutcomeUnresolved Outcome = "unresolved"
)

type OutcomePayload

type OutcomePayload struct {
	Outcome Outcome `json:"outcome"`
}

type Participant added in v0.31.0

type Participant struct {
	Actor Actor           `json:"actor"`
	Role  ParticipantRole `json:"role"`
}

type ParticipantRole added in v0.31.0

type ParticipantRole string
const ParticipantReporter ParticipantRole = "reporter"

type ProjectArtifactRef

type ProjectArtifactRef struct {
	Folder      string `json:"folder,omitempty"`
	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 = investigation.ProjectScope

ProjectRef remains a source- and wire-compatible alias of the one canonical persisted project scope used by Investigation Context facts.

type RefKind

type RefKind string
const (
	RefSourceOperation RefKind = "source-operation"
	RefCheckRun        RefKind = "check-run"
	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 ReopenedPayload added in v0.79.1

type ReopenedPayload struct {
	Reason                  string `json:"reason"`
	ExpectedResolutionEpoch uint64 `json:"expectedResolutionEpoch"`
}

ReopenedPayload is an explicit lifecycle operation, never a backwards generic status update. Stores must additionally require Mutation.ExpectedSeq and use the authenticated actor and server wall time. The expected epoch rejects a stale reopen even if a caller accidentally reuses a previous payload.

func (ReopenedPayload) Validate added in v0.79.1

func (p ReopenedPayload) Validate() error

type ResolutionCriterion added in v0.61.0

type ResolutionCriterion struct {
	FinalizedAt  *time.Time      `json:"finalizedAt,omitempty"`
	Version      uint64          `json:"version"`
	Finalized    bool            `json:"finalized"`
	Enforcement  string          `json:"enforcement"`
	Scope        ResolutionScope `json:"scope"`
	CheckID      string          `json:"checkID,omitempty"`
	CheckVersion uint64          `json:"checkVersion,omitempty"`
	// DefinitionDigest pins CanonicalDetectiveDefinition, derived by the host from
	// the complete admitted executable snapshot, never from client assertions.
	DefinitionDigest string `json:"definitionDigest,omitempty"`
	MaxAgeSeconds    int64  `json:"maxAgeSeconds"`
}

ResolutionCriterion is opt-in. Required criteria cannot be bypassed with a generic status mutation. Draft revisions may be completed, then are immutable.

func (ResolutionCriterion) Validate added in v0.61.0

func (c ResolutionCriterion) Validate() error

type ResolutionProof added in v0.61.0

type ResolutionProof struct {
	// ResolutionEpoch binds proof to the current reopening epoch (zero for legacy streams).
	ResolutionEpoch uint64 `json:"resolutionEpoch,omitempty"`
	// DefinitionDigest must come from the actual retained run definition, using
	// sessioncontext.CanonicalDetectiveDefinition, under current host admission.
	DefinitionDigest string          `json:"definitionDigest,omitempty"`
	CriterionVersion uint64          `json:"criterionVersion"`
	Scope            ResolutionScope `json:"scope"`
	Run              CheckRunRef     `json:"run"`
	EvaluatedAt      time.Time       `json:"evaluatedAt"`
	Outcome          string          `json:"outcome"`
	ObservationRefs  []ArtifactRef   `json:"observationRefs"`
	RecoveryRefs     []ArtifactRef   `json:"recoveryRefs"`
}

ResolutionProof is a server-admitted receipt, not a client assertion of pass. Before emitting it the backend must resolve the saved run under current ACL, compare its real scope/revision/result and verify ObservationRefs identify the latest attempts/configuration for every affected input. Core validates the immutable contract and wall-clock freshness; it does not fetch source records.

func (ResolutionProof) Validate added in v0.61.0

func (p ResolutionProof) Validate(at time.Time) error

type ResolutionScope added in v0.61.0

type ResolutionScope struct {
	Project            ProjectRef                          `json:"project"`
	SourceID           string                              `json:"sourceID"`
	Generation         string                              `json:"generation"`
	AffectedInputs     map[string]investigation.TypedValue `json:"affectedInputs"`
	SessionRef         string                              `json:"sessionRef"`
	BagID              string                              `json:"bagID"`
	AppliedManifestRef string                              `json:"appliedManifestRef"`
}

ResolutionScope pins logical authority and applied input identity. Attempt and configuration revisions deliberately belong to observations in the proof: recovery changes them without changing the criterion.

func (ResolutionScope) Validate added in v0.61.0

func (s ResolutionScope) Validate() error

type ResolvedPayload added in v0.61.0

type ResolvedPayload struct {
	// LifecycleVersion 1 records the resolved outcome with verified evidence.
	// Version 0 retains historical streams with a separate outcome event.
	LifecycleVersion int             `json:"lifecycleVersion,omitempty"`
	HumanNote        string          `json:"humanNote"`
	Proof            ResolutionProof `json:"proof"`
}

ResolvedPayload commits the human note and proof in the same event.

func (ResolvedPayload) Validate added in v0.61.0

func (p ResolvedPayload) Validate(at time.Time) error

type SearchMatch added in v0.31.0

type SearchMatch struct {
	Incident       IncidentView    `json:"incident"`
	MatchedSignals []MatchedSignal `json:"matchedSignals"`
}
func Search(candidates []IncidentView, query SearchQuery) []SearchMatch

Search operates only on current-policy views. Hidden and redacted fact values therefore cannot influence a match or leak through matched signals.

func (SearchMatch) Validate added in v0.31.0

func (m SearchMatch) Validate() error

type SearchQuery added in v0.31.0

type SearchQuery struct {
	Text  string       `json:"text"`
	Facts []FactSignal `json:"facts,omitempty"`
}

func (SearchQuery) Validate added in v0.31.0

func (q SearchQuery) Validate() error

type SharedLayout

type SharedLayout struct {
	IncidentDir         string
	Events              string
	Projection          string
	MutationReceiptsDir string
	StoreLock           string
	MergeIntentsDir     string
}

func LayoutFor

func LayoutFor(ref IncidentRef) (SharedLayout, error)

type SignalKind added in v0.31.0

type SignalKind string
const (
	SignalText    SignalKind = "text"
	SignalFact    SignalKind = "fact"
	SignalQuery   SignalKind = "query"
	SignalCheck   SignalKind = "check"
	SignalBoard   SignalKind = "board"
	SignalProject SignalKind = "project"
)

type SimilarMatch added in v0.31.0

type SimilarMatch struct {
	Incident       IncidentView    `json:"incident"`
	Score          int             `json:"score"`
	MatchedSignals []MatchedSignal `json:"matchedSignals"`
}

func Similar added in v0.31.0

func Similar(subject IncidentView, candidates []IncidentView) []SimilarMatch

Similar operates only on current-policy views for the same reason as Search.

func (SimilarMatch) Validate added in v0.31.0

func (m SimilarMatch) Validate() error

type SourceOperationRef added in v0.70.0

type SourceOperationRef struct {
	StoreID        string                `json:"storeId"`
	SpaceID        string                `json:"spaceID"`
	ProjectID      string                `json:"projectId"`
	SourceID       string                `json:"sourceId"`
	ReceiptActorID string                `json:"receiptActorId"`
	OperationID    string                `json:"operationId"`
	RequestSHA256  string                `json:"requestSHA256"`
	Result         SourceOperationResult `json:"result"`
}

SourceOperationRef identifies an immutable native receipt, not permission to read it or a claim of recovery. The owning host verifies both independently.

func (SourceOperationRef) Validate added in v0.70.0

func (r SourceOperationRef) Validate() error

type SourceOperationResult added in v0.70.0

type SourceOperationResult struct {
	Generation string `json:"generation"`
	Revision   int    `json:"revision"`
	SHA256     string `json:"sha256"`
}

SourceOperationResult is the receipt's immutable resulting pointer, not the current source pointer. No environment authority is implied by this value.

type Status

type Status string
const (
	StatusOpen          Status = "open"
	StatusInvestigating Status = "investigating"
	StatusMitigating    Status = "mitigating"
	StatusRecovering    Status = "recovering"
	StatusResolved      Status = "resolved"
	StatusWatching      Status = "watching"
	StatusClosed        Status = "closed"
)

type StatusPayload

type StatusPayload struct {
	// Zero preserves historical monotonic events; one uses the Work lifecycle.
	LifecycleVersion int    `json:"lifecycleVersion,omitempty"`
	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"
)

type StreamItem added in v0.31.0

type StreamItem struct {
	Cursor EventCursor `json:"cursor"`
	Event  Event       `json:"event"`
}

func ApplyStreamItemView added in v0.31.0

func ApplyStreamItemView(stored StreamItem, policy ViewPolicy) (StreamItem, bool, error)

ApplyStreamItemView applies the same current-policy event decision to watch items while preserving the provider's opaque resumable cursor.

func (StreamItem) Validate added in v0.31.0

func (i StreamItem) Validate() error

type ViewPolicy added in v0.31.0

type ViewPolicy struct {
	// Facts is a complete, scope-qualified decision set. Missing decisions are
	// hidden fail-closed; adapters must emit FactVisible for authorized facts.
	Facts          map[investigation.FactKey]FactVisibility
	WithheldEvents map[string]bool
}

ViewPolicy is a set of decisions produced by the serving adapter's current policy evaluator. It is deliberately not persisted and performs no policy evaluation itself.

type WatchQuery added in v0.31.0

type WatchQuery struct {
	Incident *IncidentRef `json:"incident,omitempty"`
	Since    EventCursor  `json:"since,omitempty"`
}

func (WatchQuery) Validate added in v0.31.0

func (q WatchQuery) Validate() error

Jump to

Keyboard shortcuts

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