gate

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package gate implements the entry gate of §6.3: the four checks a task must pass before devclean spends a single token on it.

  1. el contrato es válido (version, id, límites)
  2. listo_cuando existe y se ejecuta
  3. el comando falla hoy (si ya pasa, la tarea no tiene sentido)
  4. tocar_solo se declara si hace falta y no se cruza con el de otra
  5. tocar_solo no incluye zonas prohibidas globales ni rutas de prueba

All checks are pure code: no model is involved in verification.

Index

Constants

View Source
const DefaultTimeout = 5 * time.Minute

DefaultTimeout is the maximum time check 2 gives listo_cuando to run.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	Nombre string `json:"nombre"`
	OK     bool   `json:"ok"`
	Motivo string `json:"motivo,omitempty"`
}

Check is the result of one gate check.

func Cruce

func Cruce(t task.Task, otras []task.Task) Check

Cruce runs only the scope check between tasks (§6.3.3 y A.4): rejects when tocar_solo overlaps another's, or is empty while another task runs. cmd/run uses it at assignment time, where the tasks already passed the full gate, so no test command runs again.

type Result

type Result struct {
	ID       string  `json:"id"`
	Aprobada bool    `json:"aprobada"`
	Chequeos []Check `json:"chequeos"`
	Aviso    string  `json:"aviso,omitempty"`
}

Result is the outcome of running the gate on one task.

func Run

func Run(ctx context.Context, root string, cfg config.Config, t task.Task, otras []task.Task, timeout time.Duration) Result

Run executes the five checks in order. Check 2 runs listo_cuando for real, with timeout, in the repository root. otras carries only the tasks already en_curso, which is what decides whether tocar_solo may stay empty (adenda A.4).

func (Result) PrimerMotivo

func (r Result) PrimerMotivo() string

PrimerMotivo returns the reason of the first failed check.

Jump to

Keyboard shortcuts

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