Documentation
¶
Overview ¶
Package reconcile is the pure functional core for the server's gate/grant and execution-lifecycle state. It performs no I/O: Step takes an observed World plus a Signal and returns the new ChangeSet plus the minimal set of Actions the imperative shell must execute. See docs/superpowers/specs/2026-06-15-reconciler-core-design.md.
Index ¶
- func ApplyAllowed(g GateState) bool
- func DisplayStatus(s Stack, g GateState) events.Status
- func Requester(g GateState) string
- func Step(w World, s Signal) (ChangeSet, []Action)
- func YieldsResult(a Action) bool
- type Action
- type ApplySucceeded
- type BlockReason
- type Blocked
- type Blocker
- type ChangeSet
- type Clean
- type Collision
- type Execution
- type GateState
- type GateTick
- type GrantsObserved
- type Lease
- type NotClassified
- type ObservedGrant
- type PRClosed
- type Pending
- type PostCommitStatus
- type PublishSSE
- type RenderCheckRun
- type RequestGrant
- type RevokeGrant
- type RunnerFinalize
- type RunnerInit
- type RunnerPhase
- type RunnerUpdate
- type Satisfied
- type Signal
- type Stack
- type Target
- type World
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyAllowed ¶
ApplyAllowed is the fail-closed apply-gate verdict: only Clean or Satisfied permit apply; NotClassified, Pending, and Blocked deny it.
func DisplayStatus ¶
DisplayStatus is the derived per-stack status shown in the UI/check run. The runner-told status wins when terminal (failed/moving); otherwise the gating overlay (gated/safe) is derived from the ChangeSet's GateState. This is the single source of the gated/safe distinction — it is never stored separately.
func Step ¶
Step is the one pure front door. Given the observed World and an incoming Signal it returns the new ChangeSet and the minimal Actions the shell must execute. Deterministic; no I/O; safe to call repeatedly.
func YieldsResult ¶
YieldsResult reports whether an action produces a GrantsObserved on the fixpoint loop (only RequestGrant does). The shell uses this to decide when the fixpoint has converged.
Types ¶
type Action ¶
type Action interface {
// contains filtered or unexported methods
}
Action is an effect the pure core wants performed but cannot do itself.
type ApplySucceeded ¶
type ApplySucceeded struct{}
type BlockReason ¶
type BlockReason string
const ( ReasonDenied BlockReason = "denied" ReasonExpired BlockReason = "expired" ReasonRevoked BlockReason = "revoked" ReasonSlotForeign BlockReason = "slot_foreign_open" // another open PR holds the slot (⑥) ReasonSlotSelf BlockReason = "slot_self" // same PR, another env, holds the slot (⑥) ReasonBackendError BlockReason = "backend_error" )
type Blocker ¶
type Blocker struct {
Reason BlockReason
ByPR int // slot blocker's PR (0 if N/A)
ByEnv string // slot blocker's environment
}
Blocker explains why a gate is Blocked.
type Collision ¶
type Collision struct {
ByPR int
ByEnv string
BySelf bool // ByPR == this changeset's PR (different env)
ByPRClosed bool // shell looked up the blocker PR's GitHub state
}
Collision describes a slot blocker the shell already resolved against GitHub.
type Execution ¶
type Execution struct {
ID string
Repo string
SHA string
LogURL string
Phase events.Phase
Stacks []Stack
}
Execution is the plan/apply run for the ChangeSet (edge-triggered facts).
type GateState ¶
type GateState interface {
// contains filtered or unexported methods
}
GateState is a sum type: a gate is EXACTLY one of these.
type GateTick ¶
type GateTick struct{ Grants []ObservedGrant }
GateTick is the periodic backstop re-observation; Grants is a full re-list of the changeset's targets. Processed identically to GrantsObserved.
type GrantsObserved ¶
type GrantsObserved struct{ Grants []ObservedGrant }
GrantsObserved carries grant observations for THIS changeset: either the results of RequestGrant actions (fixpoint feedback) or a re-list. Grants not mentioned are left unchanged.
type Lease ¶
type Lease struct{ Requester string }
Lease is the pooled requester identity leased once per ChangeSet. Empty Requester means undecided.
type NotClassified ¶
type NotClassified struct{} // never planned → apply fails closed
type ObservedGrant ¶
type ObservedGrant struct {
Class string
Target string
Name string // backend-assigned id ("" if none)
State approval.GrantState // "" == no grant present for this changeset
Requester string // leased identity ("" if N/A)
Collision *Collision // set when a RequestGrant hit a SlotCollisionError
}
ObservedGrant is one grant fact the shell gathered for a (class,target).
type PostCommitStatus ¶
type PostCommitStatus struct {
State string // "success" | "failure" | "pending"
Description string
}
PostCommitStatus posts the commit status. Pure output; no result.
type PublishSSE ¶
type PublishSSE struct{}
PublishSSE notifies the live-page hub that state changed. Pure output.
type RenderCheckRun ¶
type RenderCheckRun struct {
Terminal bool
Conclusion string // "success" | "action_required" | "failure" | "" (in-progress)
}
RenderCheckRun re-renders the GitHub check run from current state. Pure output; no result.
type RequestGrant ¶
RequestGrant asks the backend to ensure an open grant. It YIELDS a result (grant name + leased requester, or a Collision) the shell feeds back as a GrantsObserved signal. Requester pins the lease; "" lets the backend lease.
type RevokeGrant ¶
RevokeGrant revokes the open grant for (class,target,PR,environment). Idempotent; produces no result. PR/Environment default to the changeset's when zero/empty but are set explicitly when revoking a foreign slot blocker.
type RunnerFinalize ¶
type RunnerFinalize struct {
Failed bool
ReportMarkdown string
Projects map[string]string // stack path → grouping/target key
Categories map[string][]events.Category // stack path → matched categories
Moving []string // stack paths adopting via cross-state move
Gates []events.GateTarget // (class,target) pairs needing approval
}
type RunnerInit ¶
type RunnerInit struct{ Exec Execution }
type RunnerPhase ¶
type Signal ¶
type Signal interface {
// contains filtered or unexported methods
}
Signal is the union of everything that can drive a ChangeSet.
type Stack ¶
type Stack struct {
Path string
Project string
RunStatus events.Status // pending|running|planned|failed|moving (never gated/safe)
Detail string
Categories []events.Category
}
Stack is one node. RunStatus holds ONLY the runner-told statuses; the gated/safe overlay is derived from the ChangeSet's GateState (see project.go).