Help us shape the future of Go! Take the 2026 Go Developer Survey

worker

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package worker models the adoption epoch and requalification gate (SPEC §14 / fixed-worker): a model or agent change opens a new epoch that must be requalified before normal runs resume. The comparison is pure.

Index

Constants

View Source
const DefaultStateFile = ".adh/worker.json"

DefaultStateFile is the conventional path the recorded epoch lives under; it is the single owner of that location across the CLI.

Variables

This section is empty.

Functions

func RequalifyNeeded

func RequalifyNeeded(stateFile string, current Epoch) (bool, error)

RequalifyNeeded reports whether a run must refuse pending requalification (§14): a baseline epoch is recorded at stateFile and the current worker differs from it. A never-requalified workspace (no recorded epoch) is not gated — like the §19.1 routing gap, the refusal presupposes a recorded baseline to have departed from, so a fresh workspace runs ungated until its first `worker requalify`.

func Save

func Save(path string, epoch Epoch) error

Save writes an epoch to a JSON file.

Types

type Epoch

type Epoch struct {
	ID     string            `json:"id"`
	Models map[string]string `json:"models"` // role -> model identifier
}

Epoch records the per-role model binding for one adoption epoch.

func EpochFor

func EpochFor(models map[string]string) Epoch

EpochFor builds the epoch for a per-role model binding: its ID is the content hash of the canonical binding, so an identical binding hashes to the same epoch and any model change yields a new one (§14).

func Load

func Load(path string) (Epoch, error)

Load reads the recorded epoch from a JSON file. An absent file yields the zero Epoch and no error (a fresh, never-requalified workspace).

func (Epoch) RequalRequired

func (e Epoch) RequalRequired(current Epoch) bool

RequalRequired reports whether current opens a new epoch relative to e — that is, whether any per-role model binding changed. A changed worker invalidates the held-out baseline, so requalification must precede the next run (§14).

Jump to

Keyboard shortcuts

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