Documentation
¶
Overview ¶
Package darkfactory holds the network-backed candidate evaluator that decides whether an open draft PR carries an approved-not-completed dark-factory spec in its diff and therefore warrants a dark-factory-implement task.
Index ¶
Constants ¶
const ( ReasonNotDraft = "not_draft" ReasonNotOpen = "not_open" ReasonNoDarkFactoryYML = "no_dark_factory_yaml" ReasonNoSpecInDiff = "no_spec_in_diff" ReasonPromptsInFlight = "prompts_in_flight" )
Skip reason labels (also the IncFilterSkipped metric labels).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContentReader ¶
type ContentReader interface {
ListPRFiles(ctx context.Context, owner, repo string, number int) ([]string, error)
GetContent(ctx context.Context, owner, repo, filePath, ref string) ([]byte, error)
ListDir(ctx context.Context, owner, repo, dirPath, ref string) ([]string, error)
IsNotFound(err error) bool
}
ContentReader is the narrow GitHub read surface the evaluator needs. It is declared here (with primitive returns only) so this package does not import pkg and the concrete *githubClient satisfies it structurally without an adapter or an import cycle.
type Input ¶
Input is the per-PR data the evaluator decides on. IsDraft and State are the pulls/N-confirmed values (dodging search-index lag), not the search snapshot.
type Result ¶
Result is the keep/skip verdict. Reason is the metric label for a skip and is empty when Keep is true. MatchedSpecs lists the approved-not-completed spec paths that satisfied the diff check (populated only when Keep is true).
func Evaluate ¶
Evaluate returns Keep=true only when ALL hold at in.HeadSHA:
a. the PR is open and a draft; b. .dark-factory.yaml is present; c. at least one approved-not-completed spec under specs/in-progress/ is touched by the PR diff (existence alone is NOT enough — specs persist across their lifecycle); d. no *.md remains under prompts/in-progress/ (self-trigger suppression).
A non-404 GitHub error is returned to the caller (cursor not advanced); a 404 on an expected-optional path is treated as "absent" and drives a skip verdict.