planner

package
v0.20.2 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package planner is L3 of the SigComply CLI: reads the project config plus the selected framework plus the registries and produces a fully resolved RunPlan — slot bindings, effective parameters, resolved exceptions, derived period. The planner does no external I/O; planning errors exit with code 3.

See docs/architecture/02-layers.md for the full layer contract.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SplitCommaList

func SplitCommaList(s string) []string

SplitCommaList is a small helper for the orchestrator: turn a comma-separated CLI flag value into a trimmed list.

Types

type Binding

type Binding struct {
	SourceID   string
	CatalogID  string // non-empty only for manual sources (e.g. manual.pdf:access_review_quarterly)
	SlotParams map[string]any
}

Binding is one resolved (source instance, optional slot params) pair. Multiple bindings on one slot mean "union the records from all of them" — the evaluator merges them per slot.

type Exception

type Exception struct {
	State           core.PolicyStatus // StatusWaived or StatusNA
	Reason          string
	ResourceID      string
	ResourcePattern string
	ApprovedBy      string
	ApprovedAt      string
	ExpiresAt       string
}

Exception is the resolved waiver / N/A declaration applied to a policy. The evaluator uses State to short-circuit (na) or re-classify failures (waived).

type Filter

type Filter struct {
	Policies []string
	Controls []string
	Cadence  string
	OnPush   bool
}

Filter narrows the set of policies the plan covers. The four fields are mutually exclusive — passing more than one yields an error. Filter{} means "every policy in the framework."

type Input

type Input struct {
	Config     *spec.ProjectConfig
	Registries *registry.Set
	CommitTime time.Time
	Now        time.Time
	Filter     Filter
}

Input collects everything the planner needs to compute a Plan. CommitTime is the basis for period derivation; pass commit time when time_basis == "commit" (the default) and wall-clock when the project opts into wall_clock.

type Period

type Period struct {
	ID        string
	Start     time.Time
	End       time.Time
	TimeBasis string // "commit" or "wall_clock"
}

Period is the audit window this run belongs to. Computed from (commit_time, fiscal_calendar) — see docs/architecture/01- conceptual-model.md §Period.

func DerivePeriod

func DerivePeriod(cfg *spec.PeriodConfig, commit time.Time) (Period, error)

DerivePeriod computes the audit period for a commit timestamp under the project's fiscal_calendar configuration. The function is pure: the only inputs are the configured calendar and the commit time; the only output is a stamped Period. See docs/architecture/01- conceptual-model.md §Period for the model.

type PlannedPolicy

type PlannedPolicy struct {
	Spec       core.Policy
	Cadence    string
	Parameters map[string]any
	Bindings   map[string][]Binding
	Exception  *Exception // nil unless one applies
}

PlannedPolicy is one policy with everything needed to execute it already resolved. Parameters and exceptions are flattened to their effective values so the evaluator never goes back to the config.

type RunPlan

type RunPlan struct {
	Framework string
	Period    Period
	Policies  []PlannedPolicy
}

RunPlan is the fully-resolved output of L3. The collector and evaluator iterate it; no further config lookups are needed at run time.

func Plan

func Plan(in *Input) (*RunPlan, error)

Plan computes the run plan. Errors surface back to the orchestrator as exit-code-3 conditions. No I/O happens here.

Jump to

Keyboard shortcuts

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