enforcement

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Timestamp time.Time `json:"timestamp"`
	Code      string    `json:"code"`
	Boundary  string    `json:"boundary"`
	Mode      string    `json:"mode"`
	Outcome   Outcome   `json:"outcome"`
	Details   string    `json:"details,omitempty"`
}

Event captures a structured enforcement signal.

type Outcome

type Outcome string

Outcome describes the enforcement disposition for an action.

const (
	OutcomeAllow     Outcome = "ALLOW"
	OutcomeBlock     Outcome = "BLOCK"
	OutcomeViolation Outcome = "VIOLATION"
)

type Recorder

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

Recorder builds the enforcement metadata stream.

func NewRecorder

func NewRecorder(mode string) *Recorder

NewRecorder creates a recorder initialized with the given mode.

func (*Recorder) Metadata

func (r *Recorder) Metadata() RunMetadata

Metadata returns a snapshot of the enforcement metadata.

func (*Recorder) RecordClaimedSuccess

func (r *Recorder) RecordClaimedSuccess()

RecordClaimedSuccess increments the claimed success counter.

func (*Recorder) RecordEnforcedSuccess

func (r *Recorder) RecordEnforcedSuccess()

RecordEnforcedSuccess increments the enforced success counter independently.

func (*Recorder) RecordEvent

func (r *Recorder) RecordEvent(evt Event)

RecordEvent appends a structured enforcement signal and updates counters.

func (*Recorder) SetMode

func (r *Recorder) SetMode(mode string)

SetMode updates the recorded execution mode.

type RunMetadata

type RunMetadata struct {
	ExecutionMode        string  `json:"execution_mode"`
	EnforcementEvents    []Event `json:"enforcement_events"`
	AllowedActionsCount  int     `json:"allowed_actions_count"`
	BlockedActionsCount  int     `json:"blocked_actions_count"`
	ViolationsCount      int     `json:"violations_count"`
	ClaimedSuccessCount  int     `json:"claimed_success_count"`
	EnforcedSuccessCount int     `json:"enforced_success_count"`
}

RunMetadata exposes the enforcement contract for an execution run.

Jump to

Keyboard shortcuts

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