Documentation
¶
Overview ¶
Package verify is orch's local gate between an agent's clean exit and the push (verify.enabled): the repository's own checks, then a read-only review by another provider. What fails goes back to the agent; only work that passes is published.
It lives outside internal/engine, which sees it only as its Verifier interface; the types they trade are internal/contract's, so it does not import the engine (#550).
Index ¶
Constants ¶
const ReportFile = "report.json"
ReportFile is the name of the report verify writes into a task attempt's artifacts directory: Playwright's results, in orch's own shape, with every attachment path relative to that directory. The dashboard reads it.
Variables ¶
This section is empty.
Functions ¶
func IsTestFile ¶
IsTestFile reports whether a path, as git prints it, is a test by the naming conventions of the ecosystems orch detects: Go's _test.go, the .test./.spec. of JavaScript and TypeScript, pytest's test_*.py and *_test.py, the *Test/*Tests classes of the JVM and .NET, and any file under a tests/, test/, __tests__/ or spec/ directory.
Types ¶
type E2EAttachment ¶
type E2EAttachment struct {
Name string `json:"name"`
ContentType string `json:"content_type"`
// Path is relative to the artifacts directory, "" when the file was not
// copied (missing, or over maxAttachmentBytes).
Path string `json:"path,omitempty"`
// Source is where the test left it, relative to the worktree.
Source string `json:"source"`
}
E2EAttachment is a file the test left: screenshot, video, trace, …
type E2EReport ¶
type E2EReport struct {
TaskID string `json:"task_id"`
StartedAt time.Time `json:"started_at"`
DurationMS int64 `json:"duration_ms"`
// AppURL is where the app answered, when verify.app ran it.
AppURL string `json:"app_url,omitempty"`
Stats E2EStats `json:"stats"`
Tests []E2ETest `json:"tests"`
// Errors are the run's own errors, outside any test: a config that did
// not load, a webServer that never came up.
Errors []string `json:"errors,omitempty"`
}
E2EReport is one E2E run of one task attempt.
type E2EStats ¶
type E2EStats struct {
Passed int `json:"passed"`
Failed int `json:"failed"`
Flaky int `json:"flaky"`
Skipped int `json:"skipped"`
}
E2EStats counts the tests by outcome.
type E2ETest ¶
type E2ETest struct {
// Title is the describe blocks and the test, joined with " › " as
// Playwright prints them.
Title string `json:"title"`
File string `json:"file"`
Line int `json:"line"`
Project string `json:"project,omitempty"`
// Status is passed, failed, flaky or skipped.
Status string `json:"status"`
DurationMS int64 `json:"duration_ms"`
Retries int `json:"retries"`
// Tags are the test's, as Playwright's report lists them (without the
// @): the evidence bundle shows the ones tagged evidence (#520).
Tags []string `json:"tags,omitempty"`
// Error is the failure's message without terminal colours; Location is
// where it was raised, file:line.
Error string `json:"error,omitempty"`
Location string `json:"location,omitempty"`
// Steps are the test.step titles the last result ran, in order: the
// last one is where a failure happened, or after it.
Steps []string `json:"steps,omitempty"`
Attachments []E2EAttachment `json:"attachments,omitempty"`
}
E2ETest is one test, as its last result left it.
type Verifier ¶
type Verifier struct {
Cfg config.Verify
// Base is the branch tasks start from; the review reads the diff against
// it (origin/<Base> when there is one, as the worktree started there).
Base string
// RequireTests sends back a change that touches no test file
// (dispatch.tdd).
RequireTests bool
// Rules has the review check the operator's rules (knowledge files of
// kind: rule) whose area covers a changed file (#505); knowledge.enabled.
Rules bool
// SpecRoot is spec_root, where the task's specRef is looked for; the
// reviewer is shown the task's section of the spec (#539).
SpecRoot string
// Once runs the review, normally an engine.OneShot: with its State set
// the review's spend is
// recorded under state.ReviewSpendID, with its Gate a reviewer over its budget
// window is refused before it spawns, and the review is skipped (#470).
Once contract.Runner
// E2EVideo is evidence.video, exported to the E2E commands as
// ORCH_E2E_VIDEO for the project's Playwright config to read (#520):
// on, retain-on-failure (the default), off.
E2EVideo string
}
Verifier is the gate. The zero Cfg verifies nothing: callers build one only when verify.enabled is on.
func (Verifier) Verify ¶
func (v Verifier) Verify(ctx context.Context, req contract.VerifyRequest) contract.VerifyResult
Verify checks the work in dir, a task's worktree with the agent's work committed. It returns what failed, written for the agent's next attempt, or "" when the work passes.
A check that cannot run is not the agent's fault and does not fail it: a detected command whose tool is not installed is skipped, so is a configured one sh cannot find (a warning names its config key). A review that cannot complete (no other provider, a provider that is down or over its budget window, an answer that does not parse) is asked once more, then marked ReviewUnavailable: the work is not failed, and not counted as reviewed either (#539). A gate that blocks on its own breakage teaches people to turn it off.