corpus

package
v0.40.1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package corpus turns captured records into the browsable golden tree: one directory per scenario, one file per emitted moment, named so an ordered fan-out is self-describing (watch.deleted.cm-a.yaml, ...). A single recorded observation drives both lab layers; this package owns the corpus (golden YAML) layer. The corpus changes only when behavior changes, because the normalizer has already rewritten every volatile field.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(dir string, moments []Moment) error

Compare verifies the built moments match the committed files under dir. It returns a non-nil error describing the first divergence — a missing file, a content drift (with a unified diff), or a stray file — and writes nothing. A corpus diff in a PR is a signal, not noise: Kubernetes behavior changed, the capture changed, or the cluster version moved.

func Write

func Write(dir string, moments []Moment) error

Write rewrites dir to exactly the built moments (creating dir and removing stale .yaml files), the update path behind MUTATIONLAB_UPDATE=1.

Types

type Moment

type Moment struct {
	Name    string
	Content []byte
}

Moment is one normalized record rendered to a single corpus file.

func Build

func Build(records []mutationlab.Record) ([]Moment, error)

Build normalizes a scenario's records into one shared placeholder space and renders each to a deterministically named YAML moment. Records are expected in observation order; that order — and the per-base discriminator — make the fan-out and event sequencing self-describing on disk.

Jump to

Keyboard shortcuts

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