Skip to main content

Module plan

Module plan 

Source
Expand description

Plan lifecycle management for PostgresPolicyPlan resources.

Handles creating, deduplicating, approving, executing, and cleaning up reconciliation plans. Plans represent computed SQL change sets that may require explicit approval before execution against a database.

Enums§

PlanApprovalState
Result of checking a plan’s approval annotations.
PlanCreationResult
Result of plan creation — distinguishes genuinely new plans from deduplication hits so callers can decide whether to emit events.

Functions§

check_plan_approval
Check the approval state of a plan by inspecting its annotations.
cleanup_old_plans
Clean up old plans for a policy, retaining at most max_plans terminal plans.
cleanup_old_plans_best_effort
Best-effort cleanup wrapper used on hot reconciliation paths. Cleanup should reduce leaked resources, never block otherwise valid reconciliation.
create_or_update_plan
Create or deduplicate a PostgresPolicyPlan for the given policy and changes.
execute_plan
Execute an approved plan against the database.
get_current_actionable_plan
Look up the current actionable plan for a policy, if any.
get_plan_by_phase
Look up the most recent plan for a policy in a given phase.
mark_plan_approved
Mark a plan as Approved.
mark_plan_failed
Mark a plan as Failed with a given error message.
mark_plan_rejected
Mark a plan as Rejected.
mark_plan_superseded
Mark a plan as Superseded (database state changed since approval).
update_policy_plan_ref
Update the parent policy’s current_plan_ref in status.