Documentation
¶
Overview ¶
Package epic holds the deterministic core of an Epic Run: the plan schema, requirement coverage checks, DAG validation, readiness computation and priority ordering. Nothing here talks to GitHub, runs a model, or knows how a plan was produced — a plan is data, and every rule this package enforces must hold no matter who wrote it.
Index ¶
- Constants
- func ApplyBranchTarget(p *Plan, target string) []error
- func CanonicalPlan(data []byte, target string) (string, []error)
- func Hash(p Plan) (string, error)
- func Ready(p Plan, integrated map[string]bool) map[string]bool
- func Validate(p Plan) []error
- type Edge
- type Node
- type Plan
- type Requirement
Constants ¶
const MaxNodes = 200
MaxNodes bounds a single plan revision. A larger spec is planned in rolling waves, not as one unreviewable graph.
Variables ¶
This section is empty.
Functions ¶
func ApplyBranchTarget ¶
ApplyBranchTarget fills each node's empty BranchTarget with target and reports every node naming any other ref. It is the shared rule for every path a plan enters the system by — pasted JSON, a generated draft, the validate command — so a plan means the same thing no matter who wrote it. Call it before Validate: a node with no branch target is otherwise rejected there.
func CanonicalPlan ¶
CanonicalPlan parses raw plan JSON, fills empty branch targets with target (rejecting any node naming another ref), runs the full structural validation, and returns the canonical re-marshalled JSON. It is the one gate every plan passes through no matter how it enters the system — the epic-plan validate command, a shem checking its generated draft, or the orchestrator storing it.
func Hash ¶
Hash is the plan's content identity: a SHA-256 over the canonical JSON. Approvals bind to this, so any edit — however small — produces a different hash and therefore requires a new approval.
func Ready ¶
Ready returns the nodes that are not integrated and whose hard predecessors all are. "Integrated" means merged into the branch target; a closed or ready-for-review ticket does not count.
func Validate ¶
Validate checks a plan structurally: well-formed IDs, unique keys, no self-edges or unknown endpoints, an acyclic graph, complete requirement coverage in both directions, non-empty acceptance criteria and branch targets, and bounded size. It returns every problem found, not the first — a human reviewing a rejected plan should fix one pass, not five.
Types ¶
type Node ¶
type Node struct {
Key string `json:"key"` // stable logical key, unique within the plan
Title string `json:"title"`
Scope string `json:"scope"`
NonGoals string `json:"non_goals,omitempty"`
AcceptanceCommands []string `json:"acceptance_commands"`
RequirementIDs []string `json:"requirement_ids"`
ExpectedModules []string `json:"expected_modules,omitempty"`
Risk string `json:"risk,omitempty"`
BranchTarget string `json:"branch_target"` // the run's target ref; filled in when empty
}
type Plan ¶
type Plan struct {
// Requirements are the numbered outcomes the spec demands, extracted
// before any decomposition. Every requirement must be covered by at
// least one node, and every node must exist for at least one
// requirement — no uncovered outcome, no orphan work.
Requirements []Requirement `json:"requirements"`
// Nodes are the proposed tickets, in plan order. Plan order is the
// stable tie-break for scheduling priority.
Nodes []Node `json:"nodes"`
// Edges are hard dependencies: the predecessor must be integrated
// before the successor may start. Soft file-overlap hints are resource
// constraints, never edges.
Edges []Edge `json:"edges"`
}
Plan is one immutable plan revision. Once approved it never changes; an edit is a new Plan with a new hash.