Documentation
¶
Overview ¶
@index Automatic postprocess policy state, decision logic, and persistence.
Index ¶
- Constants
- func ValidTool(tool string) bool
- type DecisionInput
- type Engine
- type RunRecord
- type RunSnapshot
- type StateSnapshot
- type StatusOptions
- type StatusSummary
- type Store
- func (s *Store) ConsecutiveFailures(ctx context.Context, tool string, limit int) (int, error)
- func (s *Store) GetState(ctx context.Context, tool string) (*model.PostprocessPolicyState, error)
- func (s *Store) RecordRun(ctx context.Context, record RunRecord) error
- func (s *Store) Reset(ctx context.Context, tool string) error
- func (s *Store) Status(ctx context.Context, opts StatusOptions) (*StatusSummary, error)
Constants ¶
const ( PolicyDegraded = "degraded" PolicyFailClosed = "fail_closed" SourceAuto = "auto" SourceExplicit = "explicit" SourceReset = "reset" StatusOK = "ok" StatusDegraded = "degraded" ToolBuildOrUpdateGraph = "build_or_update_graph" ToolRunPostprocess = "run_postprocess" DefaultRunLogRetention = 200 DefaultStatusLimit = 5 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DecisionInput ¶
@intent carry the inputs that influence automatic postprocess policy resolution.
type Engine ¶
type Engine struct{}
@intent resolve effective postprocess policy from explicit input plus stored failure history.
func (*Engine) Resolve ¶
func (e *Engine) Resolve(ctx context.Context, store *Store, input DecisionInput) (string, string, error)
Resolve selects the effective postprocess policy for the current namespace and tool. @intent default to degraded execution while escalating to fail_closed after repeated recent failures.
type RunRecord ¶
type RunRecord struct {
Tool string
Policy string
Source string
Status string
FailedSteps []string
SkippedSteps []string
CreatedAt time.Time
}
@intent capture the outcome and policy metadata of one postprocess execution.
type RunSnapshot ¶
type RunSnapshot struct {
Namespace string `json:"namespace"`
Tool string `json:"tool"`
Policy string `json:"policy"`
Source string `json:"source"`
Status string `json:"status"`
FailedSteps []string `json:"failed_steps"`
SkippedSteps []string `json:"skipped_steps"`
CreatedAt time.Time `json:"created_at"`
}
@intent describe one recorded postprocess run for status and failure inspection.
type StateSnapshot ¶
type StateSnapshot struct {
Namespace string `json:"namespace"`
Tool string `json:"tool"`
Policy string `json:"policy"`
UpdatedAt time.Time `json:"updated_at"`
ConsecutiveFailures int `json:"consecutive_failures"`
}
@intent expose the latest persisted automatic policy state for one namespace and tool.
type StatusOptions ¶
@intent scope policy status queries by namespace, tool, and recent-run history length.
type StatusSummary ¶
type StatusSummary struct {
Status string `json:"status"`
FailClosed []StateSnapshot `json:"fail_closed,omitempty"`
RecentFailures []RunSnapshot `json:"recent_failures,omitempty"`
}
@intent bundle fail-closed state and recent failures into one operator-facing policy summary.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
@intent persist and query namespace-scoped postprocess policy state and run history.
func NewStore ¶
NewStore creates a persistence helper for postprocess policy state and run logs. @intent keep policy decisions and failure streaks queryable across build and postprocess executions.
func (*Store) ConsecutiveFailures ¶
ConsecutiveFailures counts recent non-success runs for the active namespace and tool. @intent power escalation decisions without leaking cross-namespace failure history.
func (*Store) GetState ¶
GetState returns the latest stored postprocess policy for the active namespace and tool. @intent expose the current automatic policy decision without scanning historical runs.
func (*Store) RecordRun ¶
RecordRun appends one postprocess execution result and updates the latest policy snapshot. @intent preserve the audit trail needed for failure escalation while keeping a cheap current-state lookup. @sideEffect writes a run log row and upserts namespace-scoped policy state.
func (*Store) Reset ¶
Reset records a successful reset marker for the named postprocess tool. @intent clear automatic fail_closed escalation after an operator has remediated the underlying issue.
func (*Store) Status ¶
func (s *Store) Status(ctx context.Context, opts StatusOptions) (*StatusSummary, error)
Status summarizes fail-closed state and recent failures for the requested scope. @intent give operators one status view that explains why automatic postprocess execution is degraded.