plan

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package plan builds and persists immutable plan read models. It depends on no HTTP or provider SDK, keeping the compilation/diff boundary reusable.

Index

Constants

View Source
const DefaultTTL = 15 * time.Minute

Variables

View Source
var ErrNotFound = errors.New("plan not found")

Functions

func MergeFirebaseTemplate

func MergeFirebaseTemplate(remoteTemplate, desiredJSON []byte, changes []RemoteParameterChange) ([]byte, error)

MergeFirebaseTemplate changes only managed default values selected by the immutable Plan. It keeps every unselected parameter, condition, and conditional value exactly as Firebase returned it.

Types

type AffectedEntity

type AffectedEntity struct {
	NodeID                    string   `json:"node_id"`
	EntityRef                 string   `json:"entity_ref"`
	EntityType                string   `json:"entity_type"`
	EntityID                  string   `json:"entity_id"`
	ImpactKind                string   `json:"impact_kind"`
	CausedBySemanticChangeIDs []string `json:"caused_by_semantic_change_ids"`
}

type ArtifactMetadata

type ArtifactMetadata struct {
	ArtifactName  string `json:"artifact_name"`
	MediaType     string `json:"media_type"`
	ContentDigest string `json:"content_digest"`
	SizeBytes     int64  `json:"size_bytes"`
	Sensitive     bool   `json:"sensitive"`
	Available     bool   `json:"available"`
}

type BlockingReason

type BlockingReason struct {
	ReasonCode string `json:"reason_code"`
	Summary    string `json:"summary"`
	RiskItemID string `json:"risk_item_id,omitempty"`
	NodeID     string `json:"node_id,omitempty"`
}

type BuildResult

type BuildResult struct {
	Plan      Plan
	Artifacts map[string][]byte
}

func Build

func Build(in Input) (BuildResult, error)

type ConfirmationRequirements

type ConfirmationRequirements struct {
	RequiresAcknowledgement  bool     `json:"requires_acknowledgement"`
	EnvironmentIDRequirement string   `json:"environment_id_requirement"`
	RequiredRiskItemIDs      []string `json:"required_risk_item_ids"`
	PolicySource             string   `json:"policy_source"`
}

type Input

type Input struct {
	EnvironmentID, EnvironmentKind, PackRef, SourceDigest string
	DraftRevision                                         uint64
	Desired, Baseline                                     map[string]any
	// BaseLayer is the resolved baseline before an environment override. It
	// preserves a direct override even when final effective value equals source.
	BaseLayer             map[string]any
	RemoteSnapshot        remote.Snapshot
	ValidationReady       bool
	ProductionLowRiskMode string
	Now                   time.Time
	TTL                   time.Duration
	// contains filtered or unexported fields
}

type Plan

type Plan struct {
	PlanID                   string                   `json:"plan_id"`
	EnvironmentID            string                   `json:"environment_id"`
	Status                   string                   `json:"status"`
	SnapshotToken            string                   `json:"snapshot_token"`
	DraftRevision            uint64                   `json:"draft_revision"`
	SourceDigest             string                   `json:"source_digest"`
	RemoteETag               *string                  `json:"remote_etag"`
	CreatedAt                time.Time                `json:"created_at"`
	ExpiresAt                time.Time                `json:"expires_at"`
	InvalidationReason       string                   `json:"invalidation_reason,omitempty"`
	ContentDigest            string                   `json:"content_digest"`
	RemoteSnapshot           remote.Snapshot          `json:"remote_snapshot"`
	SemanticChanges          []SemanticChange         `json:"semantic_changes"`
	AffectedEntities         []AffectedEntity         `json:"affected_entities"`
	RemoteParameterChanges   []RemoteParameterChange  `json:"remote_parameter_changes"`
	ArtifactMetadata         []ArtifactMetadata       `json:"artifact_metadata"`
	Severity                 string                   `json:"severity"`
	RiskItems                []RiskItem               `json:"risk_items"`
	BlockingReasons          []BlockingReason         `json:"blocking_reasons"`
	ConfirmationRequirements ConfirmationRequirements `json:"confirmation_requirements"`
}

type RemoteParameterChange

type RemoteParameterChange struct {
	NodeID                    string   `json:"node_id"`
	ProjectionID              string   `json:"projection_id,omitempty"`
	ParameterKey              string   `json:"parameter_key"`
	ChangeKind                string   `json:"change_kind"`
	BeforeSummary             string   `json:"before_summary,omitempty"`
	AfterSummary              string   `json:"after_summary,omitempty"`
	Managed                   bool     `json:"managed"`
	CausedBySemanticChangeIDs []string `json:"caused_by_semantic_change_ids"`
	AffectedEntityNodeIDs     []string `json:"affected_entity_node_ids"`
}

type RiskItem

type RiskItem struct {
	RiskItemID              string   `json:"risk_item_id"`
	Severity                string   `json:"severity"`
	ReasonCode              string   `json:"reason_code"`
	Summary                 string   `json:"summary"`
	EntityRef               string   `json:"entity_ref,omitempty"`
	SemanticChangeIDs       []string `json:"semantic_change_ids"`
	RemoteParameterNodeIDs  []string `json:"remote_parameter_node_ids"`
	AcknowledgementRequired bool     `json:"acknowledgement_required"`
}

type SemanticChange

type SemanticChange struct {
	NodeID                 string   `json:"node_id"`
	ChangeKind             string   `json:"change_kind"`
	Summary                string   `json:"summary"`
	DirectEntityRef        string   `json:"direct_entity_ref,omitempty"`
	FieldPath              string   `json:"field_path,omitempty"`
	BeforeSummary          string   `json:"before_summary,omitempty"`
	AfterSummary           string   `json:"after_summary,omitempty"`
	AffectedEntityIDs      []string `json:"affected_entity_ids"`
	AffectedEntityNodeIDs  []string `json:"affected_entity_node_ids"`
	RemoteParameterNodeIDs []string `json:"remote_parameter_node_ids"`
}

type Store

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

func Open

func Open(root string) (*Store, error)

func (*Store) Artifact

func (s *Store) Artifact(id, name string) ([]byte, ArtifactMetadata, error)

func (*Store) Get

func (s *Store) Get(id string) (Plan, error)

func (*Store) Save

func (s *Store) Save(result BuildResult) error

func (*Store) Update

func (s *Store) Update(p Plan) error

Jump to

Keyboard shortcuts

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