jev

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package jev is Jev's mechanical passes over one pull request (nova-tools #3631): lint (every typed body line present, once, in its one form), scope (every changed file inside PATHS) and base (the PR targets a trunk, the one its body names). No model and no judgement: a friend's attention goes to what a regular expression cannot decide, and these passes run first, on every PR, before any friend read.

The passes make ONE typed line, recorded on the PR record's reads (pr:<name>:<n>, internal/nsprint/land/stream) by `nova-sprint jev mech`:

JEV who=jev pass=mech head=<sha> gate=ok|fail lint=<w> scope=<w> base=<w> why=<one line>

where <w> is ok, fail or missing. missing is not fail: a pass with no evidence to decide on (the mirror has no head yet, the record names no base) says so and does not hold the PR.

A JEV line is never a read. It carries no SCORE, DISPOSITION or HOLD word, its who is jev and stream.ReadAt skips every who=jev* line, so only a friend's line at 8+ lands a PR. The stream lander reads the JEV line as a gate instead (Skip): a gate=fail line at head keeps the PR out of a batch, and cfg:land jev turns the gate off, on (the default) or to require.

Index

Constants

View Source
const Kind = "mech"

Kind is the pass field of the mechanical line. Other Jev lines (the nova-decide review JEV line) carry no pass=mech and are not this line.

View Source
const Who = "jev"

Who is the name on every JEV line. It is not a friend's name.

Variables

View Source
var Passes = []string{"lint", "scope", "base"}

Passes are the passes in the order the line prints them.

View Source
var Trunks = map[string]bool{"dev": true, "main": true}

Trunks are the bases a PR may target; any other base is a stacked PR.

Functions

func CanonPaths

func CanonPaths(line string) ([]string, error)

CanonPaths reads a PATHS line: parenthesised notes such as (new) go, and what is left is the one path list internal/nsprint/pr canonicalises.

func ParseGating

func ParseGating(s string) map[string]bool

ParseGating reads cfg:land jev_passes, a comma list of passes that gate; empty is every pass (nil). A pass whose measured precision falls is turned off here, by config, not by hand.

func Skip

func Skip(lines []string, head string, mode Mode, gating map[string]bool) string

Skip is the lander's why for a record's lines at head: "" when the JEV gate lets the PR through, jev:<passes> when a gating pass failed at head, no-jev-at-head under ModeRequire when Jev has not run at head.

Types

type Body

type Body struct {
	Keys   map[string][]string
	Closes []string
}

Body is a PR body's key lines: each `KEY: value` line at the start of a line (markdown bullets and bold allowed), the key upper-cased, every value in order; and the issue references its Closes lines name.

func ParseBody

func ParseBody(body string) Body

ParseBody reads the key lines out of a PR body.

func (Body) Value

func (b Body) Value(key string) string

Value is the key's one value: "" when the body has no such line.

type Check

type Check struct {
	Word Word
	Why  string
}

Check is one pass's answer and the reason it rests on.

func Base

func Base(b Body, recBase, recBaseSHA string) Check

Base is the PR targeting a trunk, the base its body names, cut from the base-sha its record holds. recBase and recBaseSHA are the record's base and base_sha ("" unknown).

func Lint

func Lint(b Body) Check

Lint is every typed body line present, once (a second line with another value is two forms), and in its one form; and a Closes #<n> line or an ORIGIN: line naming where the work came from.

func Scope

func Scope(paths string, files []string, known bool, why string) Check

Scope is every changed file inside PATHS: an entry covers the file it names, every file under it when it is a directory, and what it matches when it is a glob. known is false when the diff could not be read, and then the pass is missing with why.

type Input

type Input struct {
	Head, Base, BaseSHA, Paths string
	Body                       string
	Files                      []string
	FilesKnown                 bool
	FilesWhy                   string
}

Input is what the passes read: the record's head, base, base_sha and PATHS, the body, and the changed files at head (FilesKnown false when the mirror could not say, FilesWhy the reason).

type Line

type Line struct {
	Head              string
	Lint, Scope, Base Check
	// Why is the why= text as parsed; Mech and String build it from the
	// checks.
	Why string
}

Line is one JEV mech line.

func At

func At(lines []string, head string) (Line, bool)

At is the last JEV mech line at head (its head a prefix of at least 7 hex digits of head, as stream.ReadAt counts a read).

func Mech

func Mech(in Input) Line

Mech runs the three passes. Scope reads the body's PATHS, else the record's.

func Parse

func Parse(s string) (Line, bool)

Parse reads one JEV mech line. Any other line, a JEV line of another pass included, is not one.

func (Line) Failed

func (l Line) Failed(gating map[string]bool) []string

Failed names the passes that failed, among those gating (nil: every pass).

func (Line) Gate

func (l Line) Gate() Word

Gate is fail when any pass failed, else ok.

func (Line) String

func (l Line) String() string

String is the typed line. why is prose, escaped to one line, with no "=" (so no key=value a line reader could take for a field) and no upper-case verdict word.

type Mode

type Mode string

Mode is how the lander reads the JEV line: cfg:land jev.

const (
	ModeOff     Mode = "off"
	ModeGate    Mode = "gate"
	ModeRequire Mode = "require"
)

The modes. Gate is the default: a failing JEV line at head keeps the PR out; a PR with no JEV line yet is not held. Require holds that PR too.

func ParseMode

func ParseMode(s string) Mode

ParseMode reads cfg:land jev; empty or unknown is ModeGate.

type Word

type Word string

Word is one pass's answer.

const (
	OK      Word = "ok"
	Fail    Word = "fail"
	Missing Word = "missing"
)

The three answers.

Jump to

Keyboard shortcuts

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