diff --git a/CHANGELOG.md b/CHANGELOG.md
index 33f7b413..c4c2a4a0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,13 @@ because it turns other people's test suites red.
### Added
+- **Copy command in the window.** The Single batch, Presets, Several batches
+ and Tools screens put on the clipboard the `tfg` command that does what the
+ screen would do, so a set you found in the window can go into a script or a
+ pipeline. It is written for PowerShell on Windows and for bash or zsh on
+ macOS and Linux, and it starts `tfg` the way your computer finds it. On
+ Several batches it saves the recipe of the screen as a file in the folder
+ the terminal is open in, then runs it.
- **Sample files to download on the website.** One file of every format at
exactly 1 MB, corrupt PDF, Word, Excel, PowerPoint, JPG, PNG, MP4 and ZIP
files, CSV, JSON and Excel tables for an import, and placeholder pictures in
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 4f392a10..99375ebc 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -113,7 +113,9 @@ whose test suites depend on it.
`internal/guard` is also broken on purpose by an entry in
`internal/guard/mutation/entries.py`, and the `mutation` check on a pull
request runs the entries the change reaches. A new test needs an entry there,
- or a line in `internal/guard/mutationcoverage_test.go` saying why it has none.
+ or a line saying why it has none: in `internal/guard/provenbyprobe_test.go`
+ for a test proven by a canary or by a break made by hand, in
+ `internal/guard/mutationcoverage_test.go` for one that is not proven yet.
- **Words a user reads are English, with a flat hyphen and no semicolons.** That
covers the README, the changelog, `--help`, every message, and every comment
in the code. A test enforces the punctuation.
diff --git a/README.md b/README.md
index f3beea68..76975437 100644
--- a/README.md
+++ b/README.md
@@ -895,6 +895,20 @@ beside earlier runs, sits under the output directory and stays on unless you
turn it off. With it off, such a run is refused, the same as on the command line
without `--number-if-taken`.
+Copy command, on the Single batch, Presets, Several batches and Tools screens, puts on the
+clipboard the `tfg` command that does what the screen would do, so a set you
+found in the window can go into a script or a pipeline. On Several batches it
+copies two commands: one saves the recipe of the screen as
+`tfg-recipe-<12 characters>.yaml` in the folder the terminal is open in, and
+the other runs `tfg generate` on that file. The name comes from the recipe
+itself, so pasting the same commands again writes the same file. It is written for
+PowerShell on Windows and for bash or zsh on macOS and Linux. It starts with
+`tfg` when a terminal finds it by that name, with the full path of a `tfg` next
+to the window when that is where it is, and the window says so when it finds
+neither. A value with a double quote in it needs PowerShell 7.3 or later rather
+than Windows PowerShell 5.1, and the window says that too. Settings the window would
+refuse are refused here as well, under their boxes, and nothing is copied.
+
diff --git a/internal/commandline/commandline.go b/internal/commandline/commandline.go
new file mode 100644
index 00000000..dbe32c6c
--- /dev/null
+++ b/internal/commandline/commandline.go
@@ -0,0 +1,148 @@
+// Package commandline writes the command that does what a screen of the window
+// would do, for a person to paste into a terminal.
+//
+// # Why this exists
+//
+// The window and the command line run the same engine, and a person who has
+// found the settings they want on a screen should be able to take them to a
+// script or a pipeline without retyping them, which is the copy button on
+// every screen of the window. The window decides what the command says and this
+// package decides how it is written, because writing is the part that differs
+// between systems and is easy to get wrong in a way that runs something else.
+//
+// # What this package is NOT
+//
+// It runs nothing, and it never finds anything by starting a process. It writes
+// a line for a person to read and to paste. A window that ran the command line
+// would be a second way to do everything, and the two would answer differently
+// the first time one of them changed. Finding where tfg is reads PATH and asks
+// the file system, the way the shell itself will - see program.go.
+//
+// It does not judge the values either. Whether a size is too small for a format
+// is a question for the engine, and the command answers it when it runs, in the
+// same words the window uses.
+package commandline
+
+import "strings"
+
+// Line is a command being written out.
+//
+// The order things are added is the order they appear, because a person reads
+// this to understand what the window would do, and a line whose flags arrive in
+// a different order on every press is one they have to read again each time.
+// Go randomises the order of a map by decision, so nothing here is built from one.
+type Line struct {
+ verb []string
+ words []word
+}
+
+// word is one flag, one flag with its value, or one argument.
+type word struct {
+ flag string
+ value string
+ valued bool
+ setting string
+}
+
+// New starts a line for a verb, such as "generate" or "tool checksum".
+func New(verb ...string) *Line { return &Line{verb: verb} }
+
+// Flag adds a flag with a value, and adds NOTHING when the value is empty.
+//
+// Empty means the person left the setting alone, and a flag carrying an empty
+// value is not the same request: --seed with nothing after it is an error,
+// while no --seed at all is what the window would do. setting is the key of
+// the box the value came from, so that a value the line cannot carry is
+// reported under that box.
+func (l *Line) Flag(name, value, setting string) *Line {
+ if value == "" {
+ return l
+ }
+ l.words = append(l.words, word{flag: name, value: value, valued: true, setting: setting})
+ return l
+}
+
+// Switch adds a flag that carries no value, when it is on.
+func (l *Line) Switch(name string, on bool) *Line {
+ if on {
+ l.words = append(l.words, word{flag: name})
+ }
+ return l
+}
+
+// Argument adds what the verb acts on, such as the file a tool reads. An empty
+// one is left out, for the reason Flag gives.
+func (l *Line) Argument(value, setting string) *Line {
+ if value == "" {
+ return l
+ }
+ l.words = append(l.words, word{value: value, valued: true, setting: setting})
+ return l
+}
+
+// Written is a line as text, and what somebody pasting it should know.
+type Written struct {
+ // Text is the line itself, for the clipboard.
+ Text string
+ // Program is where the line found tfg on this computer.
+ Program Where
+ // OlderPowerShell lists the settings whose values Windows PowerShell 5.1,
+ // and PowerShell 7 before 7.3, hand to a program differently from
+ // PowerShell 7.3 and later, in the order they appear - see
+ // olderPowerShellDiffers. Empty for sh.
+ OlderPowerShell []string
+ // File is the name of the file the text saves before it runs tfg, in the
+ // folder the terminal is in - see Script. Empty for a single line.
+ File string
+}
+
+// Write is the line for one shell, started the way this computer starts tfg.
+//
+// It fails only on a value no line can carry, and the error is an *Unwritable
+// naming the setting, so the window can mark the box it came from.
+func (l *Line) Write(p Program, s Shell) (Written, error) {
+ parts := append([]string{p.word(s)}, l.verb...)
+ out := Written{Program: p.Where}
+ for _, w := range l.words {
+ text, err := w.write(s)
+ if err != nil {
+ return Written{}, err
+ }
+ parts = append(parts, text)
+ if s == PowerShell && w.valued && olderPowerShellDiffers(w.value) {
+ out.OlderPowerShell = append(out.OlderPowerShell, w.setting)
+ }
+ }
+ out.Text = strings.Join(parts, " ")
+ return out, nil
+}
+
+// write is one word as the shell should read it.
+//
+// A value that starts with a dash is joined to its flag as one quoted word,
+// --name=-a.txt, and this is measured rather than tidy (docs, the analysis of
+// 2026-11-25, section 2). Both versions of PowerShell split a bare -a.txt into
+// two arguments, and read --% as the end of everything they parse, quoted or
+// not - after which the rest of the line goes to the program as it stands. The
+// joined form is the one that came through whole in both, and the flag package
+// takes it. The same form in sh keeps the line one shape on every system.
+func (w word) write(s Shell) (string, error) {
+ if !w.valued {
+ return w.flag, nil
+ }
+ if err := writable(w.value, w.setting); err != nil {
+ return "", err
+ }
+ switch {
+ case strings.HasPrefix(w.value, "-") && w.flag == "":
+ // An argument has no flag to be joined to. The window hands over
+ // absolute paths, which never start with a dash, so this is a
+ // refusal rather than a line that would be read as a flag.
+ return "", &Unwritable{Setting: w.setting, Reason: LeadingDash}
+ case strings.HasPrefix(w.value, "-"):
+ return quote(w.flag+"="+w.value, s), nil
+ case w.flag == "":
+ return quote(w.value, s), nil
+ }
+ return w.flag + " " + quote(w.value, s), nil
+}
diff --git a/internal/commandline/names.go b/internal/commandline/names.go
new file mode 100644
index 00000000..fd7a4275
--- /dev/null
+++ b/internal/commandline/names.go
@@ -0,0 +1,63 @@
+package commandline
+
+import (
+ "sort"
+ "strings"
+)
+
+// The verbs and flags a screen of the window has an equivalent for.
+//
+// Here rather than typed in the window, so that the names live in one place,
+// and that they are the names the command line really takes is held by the
+// guard that pastes a copied line into the command line and compares the files
+// it makes with the files the window makes - copycommand_test.go. A name that
+// drifted would be a flag the command line refuses, and that guard goes red.
+const (
+ Generate = "generate"
+ Tool = "tool"
+
+ Clean = "--clean"
+ Count = "--count"
+ Damage = "--damage"
+ Format = "--format"
+ ID = "--id"
+ Memory = "--memory"
+ NameTemplate = "--name"
+ NumberIfTaken = "--number-if-taken"
+ Out = "--out"
+ Preset = "--preset"
+ Seed = "--seed"
+ Set = "--set"
+ Size = "--size"
+)
+
+// Named is the flag for a parameter of a preset or a setting of a tool, which
+// are flags named after themselves.
+func Named(name string) string { return "--" + name }
+
+// DamageValue writes one damage as --damage takes it: the name, then a colon
+// and its settings as name=value separated by commas.
+//
+// The settings go in the order of their names, because the flag reads them into
+// a map and the order means nothing to it, and a line that kept the order of a
+// map would differ on every press. A comma inside a value cannot be written,
+// because the flag splits on every comma and has no way to escape one -
+// internal/cli, damageSettings - so that is refused under the setting it is in.
+func DamageValue(id string, values map[string]string) (string, error) {
+ names := make([]string, 0, len(values))
+ for name, value := range values {
+ if strings.Contains(value, ",") {
+ return "", &Unwritable{Setting: name, Reason: CommaInDamage}
+ }
+ names = append(names, name)
+ }
+ if len(names) == 0 {
+ return id, nil
+ }
+ sort.Strings(names)
+ pairs := make([]string, 0, len(names))
+ for _, name := range names {
+ pairs = append(pairs, name+"="+values[name])
+ }
+ return id + ":" + strings.Join(pairs, ","), nil
+}
diff --git a/internal/commandline/program.go b/internal/commandline/program.go
new file mode 100644
index 00000000..56cc2c64
--- /dev/null
+++ b/internal/commandline/program.go
@@ -0,0 +1,201 @@
+package commandline
+
+import (
+ "io/fs"
+ "strings"
+)
+
+// Name is what the command line is called, and what a line starts with when
+// the shell can find it by that name.
+const Name = "tfg"
+
+// Where is where a line found tfg on this computer.
+type Where int
+
+const (
+ // Missing is no tfg anywhere the window looked. The line still starts
+ // with the name, and the window says the command line is not installed.
+ Missing Where = iota
+ // OnPath is a tfg the shell finds by its name.
+ OnPath
+ // Beside is a tfg next to the window and not on PATH - the two archives
+ // unpacked into one folder - and the line names it by its full path.
+ Beside
+)
+
+// Program is how a line starts tfg.
+type Program struct {
+ Where Where
+ path string
+}
+
+// System is what Locate reads of the computer, handed in so that a guard can
+// ask about a Windows machine from any machine.
+type System struct {
+ // GOOS is the name Go gives the system: windows, darwin, linux.
+ GOOS string
+ // Getenv reads PATH, and PATHEXT on Windows.
+ Getenv func(string) string
+ // Executable is the full path of the running window.
+ Executable string
+ // Stat follows links, the way the shell does when it starts a program.
+ Stat func(string) (fs.FileInfo, error)
+}
+
+// Locate finds tfg the way the shell will, and then next to the window.
+//
+// The window and the command line are separate downloads on every system, so
+// the window cannot know where tfg is without asking. Asked by reading PATH and
+// the file system rather than by starting anything, so this package stays a
+// writer and the window keeps its one approved process (internal/gui/again.go).
+//
+// A relative entry of PATH is skipped, and so is the current directory: both
+// are read from wherever the person's terminal is, which is not where the window
+// is - Go's own exec.LookPath refuses them for the same reason since 1.19.
+func Locate(sys System) Program {
+ if onPath(sys) {
+ return Program{Where: OnPath}
+ }
+ for _, dir := range besideDirs(sys) {
+ p := join(sys.GOOS, dir, programFile(sys.GOOS))
+ if runnable(sys, p) {
+ return Program{Where: Beside, path: p}
+ }
+ }
+ return Program{Where: Missing}
+}
+
+// word is how a line starts this program.
+//
+// In PowerShell a quoted path is a string rather than a command, and the call
+// operator in front is what runs it. A path with nothing to quote runs as it is.
+func (p Program) word(s Shell) string {
+ if p.Where != Beside {
+ return Name
+ }
+ quoted := quote(p.path, s)
+ if s == PowerShell && quoted != p.path {
+ return "& " + quoted
+ }
+ return quoted
+}
+
+// onPath reports whether the shell finds tfg by its name.
+func onPath(sys System) bool {
+ separator := ":"
+ if sys.GOOS == "windows" {
+ separator = ";"
+ }
+ for _, dir := range strings.Split(sys.Getenv("PATH"), separator) {
+ // Windows allows an entry in quotes, for a folder with a separator in
+ // its name, and the shell reads it without them.
+ dir = strings.Trim(dir, `"`)
+ if absolute(sys.GOOS, dir) && holdsTfg(sys, dir) {
+ return true
+ }
+ }
+ return false
+}
+
+// holdsTfg reports whether a folder holds a file the shell would take for tfg.
+func holdsTfg(sys System, dir string) bool {
+ for _, name := range namesOnPath(sys) {
+ if runnable(sys, join(sys.GOOS, dir, name)) {
+ return true
+ }
+ }
+ return false
+}
+
+// namesOnPath is every file name the shell would take for tfg.
+//
+// On Windows that is the name with each ending PATHEXT lists, which is how the
+// .cmd that npm installs is found as well as the .exe of an archive. Elsewhere
+// it is the name alone.
+func namesOnPath(sys System) []string {
+ if sys.GOOS != "windows" {
+ return []string{Name}
+ }
+ endings := sys.Getenv("PATHEXT")
+ if endings == "" {
+ endings = ".COM;.EXE;.BAT;.CMD"
+ }
+ var names []string
+ for _, e := range strings.Split(endings, ";") {
+ if e != "" {
+ names = append(names, Name+strings.ToLower(e))
+ }
+ }
+ return names
+}
+
+// programFile is the file a release archive holds tfg in.
+func programFile(goos string) string {
+ if goos == "windows" {
+ return Name + ".exe"
+ }
+ return Name
+}
+
+// besideDirs is where tfg would be if it was unpacked next to the window.
+//
+// On macOS the window runs from inside its bundle, tfg-gui.app/Contents/MacOS,
+// and the archive of the command line puts a link called tfg next to its own
+// bundle - so the folder that holds the window's bundle comes first. The folder
+// of the program itself is asked as well, which is where a build from source
+// puts both.
+func besideDirs(sys System) []string {
+ dir := parent(sys.GOOS, sys.Executable)
+ if dir == "" {
+ return nil
+ }
+ const inside = "/Contents/MacOS"
+ if sys.GOOS == "darwin" && strings.HasSuffix(dir, ".app"+inside) {
+ bundle := strings.TrimSuffix(dir, inside)
+ return []string{parent(sys.GOOS, bundle), dir}
+ }
+ return []string{dir}
+}
+
+// runnable reports whether a file is there and the system would start it: any
+// file of a listed ending on Windows, a file with a bit for running it
+// elsewhere.
+func runnable(sys System, path string) bool {
+ info, err := sys.Stat(path)
+ if err != nil || !info.Mode().IsRegular() {
+ return false
+ }
+ return sys.GOOS == "windows" || info.Mode().Perm()&0o111 != 0
+}
+
+// absolute reports whether a path names the same place from any directory.
+func absolute(goos, path string) bool {
+ if goos != "windows" {
+ return strings.HasPrefix(path, "/")
+ }
+ if strings.HasPrefix(path, `\\`) {
+ return true
+ }
+ return len(path) >= 3 && path[1] == ':' && (path[2] == '\\' || path[2] == '/')
+}
+
+// join puts a name in a folder with the separator of the named system, which
+// is not filepath.Join: that one joins for the system the guard runs on.
+func join(goos, dir, name string) string {
+ if goos == "windows" {
+ return strings.TrimRight(dir, `\/`) + `\` + name
+ }
+ return strings.TrimRight(dir, "/") + "/" + name
+}
+
+// parent is the folder a path is in, by the separators of the named system.
+func parent(goos, path string) string {
+ cut := strings.LastIndex(path, "/")
+ if goos == "windows" {
+ cut = strings.LastIndexAny(path, `\/`)
+ }
+ if cut <= 0 {
+ return ""
+ }
+ return path[:cut]
+}
diff --git a/internal/commandline/quote.go b/internal/commandline/quote.go
new file mode 100644
index 00000000..6bdf4b51
--- /dev/null
+++ b/internal/commandline/quote.go
@@ -0,0 +1,170 @@
+package commandline
+
+import (
+ "strings"
+ "unicode"
+ "unicode/utf8"
+)
+
+// Shell is the syntax a line is written in.
+type Shell int
+
+const (
+ // PowerShell is what Windows opens a terminal with, both Windows
+ // PowerShell 5.1 and PowerShell 7.
+ PowerShell Shell = iota + 1
+ // POSIX is sh and the shells that read its quoting the same way: bash and
+ // zsh, which is what macOS and Linux open a terminal with.
+ POSIX
+)
+
+// ShellFor is the shell a terminal on this system opens with, by the name Go
+// gives the system.
+//
+// One per system rather than a choice on the screen, the decision the owner
+// made for the same button in QA Data Generator. cmd.exe is not one of them: it
+// expands %NAME% even inside quotes, and a line pasted there has no way to keep
+// a value from being read as a variable.
+func ShellFor(goos string) Shell {
+ if goos == "windows" {
+ return PowerShell
+ }
+ return POSIX
+}
+
+// quote writes a value so that the shell reads it as one argument and as
+// nothing else.
+//
+// Every value outside a short list is quoted, not only one with a space. A value
+// is often the name of a folder or a file, and a name may carry what a shell
+// reads as code: in PowerShell a semicolon starts a second command and $( runs
+// one inside double quotes. Single quotes in both shells take the text as it
+// stands, and the one character that has to be written differently inside them
+// is the single quote itself - so that is the only part that follows the system.
+func quote(value string, s Shell) string {
+ if bare(value, s) {
+ return value
+ }
+ if s == PowerShell {
+ return "'" + powerShellQuotes.Replace(value) + "'"
+ }
+ return "'" + strings.ReplaceAll(value, "'", `'\''`) + "'"
+}
+
+// powerShellQuotes doubles every character PowerShell reads as a single quote:
+// the plain one and four typographic forms of it. Measured with the parser of
+// PowerShell 7 in QA Data Generator on 2026-10-26: each of the four, left single
+// inside quotes, closed them and gave the line a second command. Written as
+// numbers so that this file stays plain ASCII.
+var powerShellQuotes = strings.NewReplacer(
+ "'", "''",
+ string(rune(0x2018)), strings.Repeat(string(rune(0x2018)), 2),
+ string(rune(0x2019)), strings.Repeat(string(rune(0x2019)), 2),
+ string(rune(0x201A)), strings.Repeat(string(rune(0x201A)), 2),
+ string(rune(0x201B)), strings.Repeat(string(rune(0x201B)), 2),
+)
+
+// bare reports whether a value means only itself in the shell as it stands.
+//
+// ASCII letters and digits and eight marks, with the backslash as well in
+// PowerShell, where it separates the parts of a path and means nothing else.
+// Everything outside ASCII is quoted, because PowerShell reads some of those
+// characters as quotes and dashes. The comma is quoted although sh would leave
+// it alone, because PowerShell reads an unquoted comma as a list.
+//
+// Two first characters are quoted wherever they stand: a dash, which a shell
+// may read as the start of a flag of its own, and an equals sign, which zsh
+// expands into the path of the program named after it.
+func bare(value string, s Shell) bool {
+ if value == "" || value[0] == '-' || value[0] == '=' {
+ return false
+ }
+ for _, c := range value {
+ switch {
+ case c >= 'a' && c <= 'z', c >= 'A' && c <= 'Z', c >= '0' && c <= '9':
+ case strings.ContainsRune("_-./:=+%", c):
+ case c == '\\' && s == PowerShell:
+ default:
+ return false
+ }
+ }
+ return true
+}
+
+// olderPowerShellDiffers reports whether Windows PowerShell 5.1 hands this value
+// to a program differently from PowerShell 7.3 and later.
+//
+// Measured on 2026-11-25 on this project's own machine, 5.1.26100 against
+// 7.7.0, with the same line given to a program that prints what it received.
+// 5.1 does not escape a double quote when it builds the command line, so 'a"b'
+// arrives as ab, and it wraps a value holding a space in quotes without
+// doubling a backslash at its end, so 'C:\My Dir\' swallows the closing quote
+// and the next argument with it. 7.7 gets both right, and no one line is right
+// in both, so the window says which PowerShell the line needs instead. 7.3 is
+// the first that builds the line this way by default - the documentation of
+// $PSNativeCommandArgumentPassing - and 7.0 to 7.2 hand values over as 5.1 does.
+func olderPowerShellDiffers(value string) bool {
+ if strings.ContainsRune(value, '"') {
+ return true
+ }
+ return strings.ContainsAny(value, " \t") && strings.HasSuffix(value, `\`)
+}
+
+// writable refuses a value no line can carry.
+//
+// A line break would end the command in the middle of a value, and a terminal
+// pasting it would run the first half. Every other control character is refused
+// with it, because it cannot be seen in the line it would be pasted as.
+func writable(value, setting string) error {
+ if !utf8.ValidString(value) {
+ return &Unwritable{Setting: setting, Reason: NotText}
+ }
+ for _, c := range value {
+ if unicode.IsControl(c) || c == 0x2028 || c == 0x2029 {
+ return &Unwritable{Setting: setting, Reason: ControlCharacter}
+ }
+ }
+ return nil
+}
+
+// Reason is why a value cannot be written on a command line.
+type Reason int
+
+const (
+ // ControlCharacter is a line break, a tab or another character that
+ // cannot be seen.
+ ControlCharacter Reason = iota + 1
+ // NotText is a value that is not valid UTF-8.
+ NotText
+ // CommaInDamage is a comma in a setting of a damage, which --damage uses
+ // to separate its settings and has no way to escape.
+ CommaInDamage
+ // LeadingDash is an argument starting with a dash, which the command
+ // would read as a flag.
+ LeadingDash
+ // EndsText is a line of a file a Script saves that the shell would read
+ // as the end of the text - see Script.Write.
+ EndsText
+)
+
+// Unwritable is a value the line cannot carry, and the setting it came from.
+type Unwritable struct {
+ Setting string
+ Reason Reason
+}
+
+func (u *Unwritable) Error() string {
+ switch u.Reason {
+ case ControlCharacter:
+ return u.Setting + " holds a line break or another control character, which a command line cannot carry"
+ case NotText:
+ return u.Setting + " is not valid text"
+ case CommaInDamage:
+ return u.Setting + " holds a comma, and --damage separates its settings with commas"
+ case LeadingDash:
+ return u.Setting + " starts with a dash, which the command would read as a flag"
+ case EndsText:
+ return "a line of the file would end the text the shell saves before the file is whole"
+ }
+ return u.Setting + " cannot be written on a command line"
+}
diff --git a/internal/commandline/script.go b/internal/commandline/script.go
new file mode 100644
index 00000000..283ea5e1
--- /dev/null
+++ b/internal/commandline/script.go
@@ -0,0 +1,95 @@
+package commandline
+
+import "strings"
+
+// Command is what a screen copies: one Line, or a Script that saves a file
+// and then runs a line.
+type Command interface {
+ Write(p Program, s Shell) (Written, error)
+}
+
+// Script is a file the shell saves in the folder the terminal is in, and a
+// line run after it.
+//
+// For what one line cannot say. The Several batches screen holds a recipe -
+// several batches, the files inside an archive, a group and a purpose for
+// each - and the command line takes a recipe as a file, with no flags for
+// most of it. So the clipboard gets the recipe as text the shell saves, then
+// the command that runs the file: two commands a person can read, and nothing
+// new the command line has to promise. docs, the analysis of 2026-11-25,
+// section 5, where reading the recipe from standard input was weighed and
+// left, because Windows PowerShell 5.1 hands a program its input in ASCII.
+type Script struct {
+ file string
+ content string
+ then *Line
+}
+
+// FileThen is a script that saves content as file, then runs then.
+func FileThen(file, content string, then *Line) *Script {
+ return &Script{file: file, content: content, then: then}
+}
+
+// RecipeFile is the name a recipe is saved under, from its hash as
+// recipe.Hash gives it - the name of the algorithm, a colon, the digest in
+// hexadecimal. Twelve characters of the digest, so pasting the same commands
+// twice writes the same bytes over the same file, and a different recipe gets
+// a name of its own rather than replacing the one saved before it.
+func RecipeFile(hash string) string {
+ _, sum, found := strings.Cut(hash, ":")
+ if !found {
+ sum = hash
+ }
+ if len(sum) > 12 {
+ sum = sum[:12]
+ }
+ return "tfg-recipe-" + sum + ".yaml"
+}
+
+// endOfFile closes the text in sh. Quoted where it opens, so nothing inside
+// is expanded, and only a line that is this word and nothing else ends it.
+const endOfFile = "TFG_EOF"
+
+// Write is the script for one shell, its last line started the way this
+// computer starts tfg.
+//
+// PowerShell takes the text as a here-string in single quotes, where nothing
+// is read as code, and saves it with Set-Content -Encoding utf8: PowerShell 7
+// writes no byte order mark and 5.1 writes one, which the recipe reader
+// drops. Only a line that starts with '@ ends that text early - measured on
+// 2026-11-25 on 5.1.26100 and 7.7.0, where an indented '@ stayed inside. sh
+// takes it as a here-document. Every line is held to what any line here is
+// held to, and one the shell would read as the end of the text is refused
+// rather than written to save half a file.
+func (sc *Script) Write(p Program, s Shell) (Written, error) {
+ body := strings.TrimSuffix(sc.content, "\n")
+ for _, line := range strings.Split(body, "\n") {
+ if err := writable(line, ""); err != nil {
+ return Written{}, err
+ }
+ if endsText(line, s) {
+ return Written{}, &Unwritable{Reason: EndsText}
+ }
+ }
+ run, err := sc.then.Write(p, s)
+ if err != nil {
+ return Written{}, err
+ }
+ file := quote(sc.file, s)
+ save := "cat > " + file + " <<'" + endOfFile + "'\n" + body + "\n" + endOfFile
+ if s == PowerShell {
+ save = "@'\n" + body + "\n'@ | Set-Content -LiteralPath " + file + " -Encoding utf8"
+ }
+ run.Text = save + "\n" + run.Text
+ run.File = sc.file
+ return run, nil
+}
+
+// endsText reports whether the shell would read this line of the text as its
+// end.
+func endsText(line string, s Shell) bool {
+ if s == PowerShell {
+ return strings.HasPrefix(line, "'@")
+ }
+ return line == endOfFile
+}
diff --git a/internal/engine/engine.go b/internal/engine/engine.go
index 13c9e157..78b16c52 100644
--- a/internal/engine/engine.go
+++ b/internal/engine/engine.go
@@ -443,16 +443,7 @@ func PlanContext(ctx context.Context, targets []Target, opt Options) ([]PlannedF
}
if opt.OutDir == "" {
- return nil, &RecipeError{Setting: SettingOutDir,
- Detail: core.Says("engine.NoOutDir", "the output directory is empty"),
- // "or leave it out to use the current one" used to close this
- // sentence and it was removed on 2026-08-26. It is true of a
- // recipe file and of the command line, and it is a thing a person
- // CANNOT do in the window: there, leaving it out is exactly what
- // they just did, and all three screens refuse it. One refusal
- // cannot carry two surfaces' advice, and the half that survives is
- // the half that is true on both. O125.
- Remedy: core.Says("engine.NoOutDirFix", "Name a directory, for example ./fixtures")}
+ return nil, NoOutDir()
}
// Worked out after the budget took its reference point, so the reserved
diff --git a/internal/engine/errors.go b/internal/engine/errors.go
index 40679e44..a972b3bc 100644
--- a/internal/engine/errors.go
+++ b/internal/engine/errors.go
@@ -132,6 +132,25 @@ const (
SettingLabel = "label"
)
+// NoOutDir is the refusal of a run with no output directory.
+//
+// Its own function because two places give it: Plan, and the window's Copy
+// command, which has to refuse an emptied box before any plan is made. The
+// command line would otherwise take a line without --out to mean the folder
+// the terminal is in, and write there while the window refuses.
+func NoOutDir() error {
+ return &RecipeError{Setting: SettingOutDir,
+ Detail: core.Says("engine.NoOutDir", "the output directory is empty"),
+ // "or leave it out to use the current one" used to close this
+ // sentence and it was removed on 2026-08-26. It is true of a
+ // recipe file and of the command line, and it is a thing a person
+ // CANNOT do in the window: there, leaving it out is exactly what
+ // they just did, and all three screens refuse it. One refusal
+ // cannot carry two surfaces' advice, and the half that survives is
+ // the half that is true on both. O125.
+ Remedy: core.Says("engine.NoOutDirFix", "Name a directory, for example ./fixtures")}
+}
+
// atTarget gives a refusal from below the position of the target it happened
// in, so a screen showing twenty of them can mark the right box.
//
diff --git a/internal/guard/codeshape_test.go b/internal/guard/codeshape_test.go
index 2e6f9395..dc57ef58 100644
--- a/internal/guard/codeshape_test.go
+++ b/internal/guard/codeshape_test.go
@@ -81,7 +81,11 @@ const (
// out of format/jpg/jpg.go into stream.go, when the size word smallest
// and the placeholder took both past the ceiling. The longest file is
// engine/engine.go now.
- longestFile = 386
+ // Lowered from 386 on 2026-11-25: the refusal of a run with no output
+ // directory moved out of engine/engine.go into errors.go, so the window's
+ // Copy command gives it in the same words. engine/engine.go is still the
+ // longest.
+ longestFile = 384
// Depth answers a different question than length, and it is the better
// question of the two. A hundred line function that is flat reads top to
diff --git a/internal/guard/copycommand_test.go b/internal/guard/copycommand_test.go
new file mode 100644
index 00000000..e48fc130
--- /dev/null
+++ b/internal/guard/copycommand_test.go
@@ -0,0 +1,362 @@
+package guard
+
+import (
+ "bytes"
+ "context"
+ "crypto/sha256"
+ "encoding/hex"
+ "encoding/json"
+ "errors"
+ "os"
+ "path/filepath"
+ "reflect"
+ "runtime"
+ "strings"
+ "testing"
+
+ "fyne.io/fyne/v2"
+
+ "github.com/donislawdev/TestingFilesGenerator/internal/cli"
+ "github.com/donislawdev/TestingFilesGenerator/internal/commandline"
+ "github.com/donislawdev/TestingFilesGenerator/internal/damage"
+ "github.com/donislawdev/TestingFilesGenerator/internal/engine"
+ "github.com/donislawdev/TestingFilesGenerator/internal/gui/parts"
+ "github.com/donislawdev/TestingFilesGenerator/internal/gui/text"
+ "github.com/donislawdev/TestingFilesGenerator/internal/gui/window"
+)
+
+// The Copy command button promises one thing: pasted into a terminal, the line
+// makes what the screen would have made. These guards hold that promise rather
+// than the presence of flags - each one pastes the copied line into the command
+// line and compares the files with the files the window writes from the same
+// form. A flag the command line no longer takes, a default that moved, a value
+// written so the command line reads it differently: each makes different files
+// or none, and turns these red. See docs, the analysis of 2026-11-25.
+
+func TestACommandCopiedFromSingleBatchMakesTheFilesTheWindowMakes(t *testing.T) {
+ host := newFakeHost(t)
+ gen := window.NewGenerate(host)
+ content := gen.Object()
+ t.Cleanup(func() { join(host) })
+
+ // Every box the line writes a flag for is moved off its starting value, so
+ // a flag the line forgets is a difference in the files rather than a
+ // default that happened to agree.
+ fields := gen.Fields()
+ chooserIn(t, fields, "format").SetSelected("txt")
+ chooserIn(t, fields, "encoding").SetSelected("utf-16le")
+ setBox(t, fields, "size", "4kb")
+ setBox(t, fields, "count", "3")
+ setBox(t, fields, "id", "copied")
+ setBox(t, fields, "name", "copied_{index:04}.txt")
+ setBox(t, fields, "seed", "42")
+ chooser, ok := controlUnder(content, text.FieldDamage()).(*parts.Chooser)
+ if !ok {
+ t.Fatalf("the damage field is not a list to choose from")
+ }
+ chooser.SetSelected(damage.ZeroHead)
+ setBox(t, fields, damage.SettingBytes, "16")
+ label, ok := findField(fields, engine.SettingLabel).Control.(*parts.Toggle)
+ if !ok {
+ t.Fatalf("the label field is not a switch")
+ }
+ label.SetChecked(false)
+
+ fromLine := t.TempDir()
+ entryUnder(t, content, text.FieldOutputDir()).SetText(fromLine)
+ line := copiedFrom(t, host, content)
+ for _, flag := range []string{commandline.Format, commandline.Set, commandline.Count, commandline.ID,
+ commandline.NameTemplate, commandline.Seed, commandline.Damage, commandline.Clean, commandline.Out} {
+ if !strings.Contains(line, flag) {
+ t.Fatalf("the copied line has no %s, so this guard would compare a form it did not set up:\n%s", flag, line)
+ }
+ }
+ runCopied(t, line)
+
+ fromWindow := t.TempDir()
+ entryUnder(t, content, text.FieldOutputDir()).SetText(fromWindow)
+ press(t, content, text.ButtonGenerate())
+ join(host)
+
+ sameRun(t, line, fromLine, fromWindow)
+}
+
+func TestACommandCopiedFromPresetsMakesTheFilesTheWindowMakes(t *testing.T) {
+ host := newFakeHost(t)
+ screen := window.NewPreset(host)
+ content := screen.Object()
+ t.Cleanup(func() { join(host) })
+
+ fields := screen.Fields()
+ chooserIn(t, fields, "preset").SetSelected(choiceNamed(t, chooserIn(t, fields, "preset"), "size-boundaries"))
+ setBox(t, fields, "limit", "2kb")
+ setBox(t, fields, "spread", "1B")
+ putIn(t, fields, "format", "txt")
+ setBox(t, fields, engine.SettingSeed, "7")
+
+ fromLine := t.TempDir()
+ entryUnder(t, content, text.FieldOutputDir()).SetText(fromLine)
+ line := copiedFrom(t, host, content)
+ for _, flag := range []string{commandline.Preset, "--limit", "--spread", commandline.Format, commandline.Seed} {
+ if !strings.Contains(line, flag) {
+ t.Fatalf("the copied line has no %s:\n%s", flag, line)
+ }
+ }
+ runCopied(t, line)
+
+ fromWindow := t.TempDir()
+ entryUnder(t, content, text.FieldOutputDir()).SetText(fromWindow)
+ press(t, content, text.ButtonGenerate())
+ join(host)
+
+ sameRun(t, line, fromLine, fromWindow)
+}
+
+// The Tools screen makes no files, so its line is held to the answer: the
+// checksum the command prints is the one worked out here, of the file the
+// box named - not of a file the terminal happened to find under the same
+// relative name.
+func TestACommandCopiedFromToolsReadsTheFileTheBoxNames(t *testing.T) {
+ host := newFakeHost(t)
+ screen := window.NewTools(host)
+ content := screen.Object()
+ t.Cleanup(func() { join(host) })
+
+ file := filepath.Join(t.TempDir(), "read me.bin")
+ body := []byte("the file the box names")
+ if err := os.WriteFile(file, body, 0o600); err != nil {
+ t.Fatal(err)
+ }
+ fields := screen.Fields()
+ pick := chooserIn(t, fields, "tool")
+ pick.SetSelected(choiceNamed(t, pick, "checksum"))
+ setBox(t, fields, "file", file)
+ setBox(t, fields, "algorithm", "sha256")
+
+ line := copiedFrom(t, host, content)
+ out := runCopied(t, line)
+ sum := sha256.Sum256(body)
+ if !strings.Contains(out, hex.EncodeToString(sum[:])) {
+ t.Errorf("the copied line printed\n%s\nwhich does not hold the sha256 of the file the box names.\nThe line: %s", out, line)
+ }
+}
+
+// A form Generate refuses is refused by Copy command under the same box, and
+// nothing reaches the clipboard. The same form with the box put right copies a
+// line - the canary that the press reaches the screen at all, without which an
+// empty clipboard proves nothing.
+//
+// The comma in a damage setting is refused while the line is put together,
+// before it is written for a shell, so it is a refusal of its own here: it
+// once reached the foot of the form in the words of the commandline package
+// rather than under its box.
+func TestCopyCommandRefusesWhatGenerateRefusesAndCopiesNothing(t *testing.T) {
+ cases := []struct {
+ label, damage, box, bad, good string
+ says string
+ }{
+ {"a size that is not a size", "", "size", "ten", "10kb", ""},
+ {"a name template with a tab in it", "", "name", "a\tb_{index}.txt", "ab_{index}.txt", text.CommandControlCharacter()},
+ {"a damage setting with a comma in it", damage.ZeroHead, damage.SettingBytes, "1,6", "16", text.CommandCommaInDamage()},
+ // The command does not refuse this one itself: without --out it writes
+ // into the folder the terminal is in, where the window refuses.
+ {"an output folder left empty", "", engine.SettingOutDir, "", os.TempDir(), ""},
+ }
+ for _, c := range cases {
+ t.Run(c.label, func(t *testing.T) {
+ host := newFakeHost(t)
+ gen := window.NewGenerate(host)
+ content := gen.Object()
+ t.Cleanup(func() { join(host) })
+ fields := gen.Fields()
+ entryUnder(t, content, text.FieldOutputDir()).SetText(t.TempDir())
+ if c.damage != "" {
+ chooser, ok := controlUnder(content, text.FieldDamage()).(*parts.Chooser)
+ if !ok {
+ t.Fatalf("the damage field is not a list to choose from")
+ }
+ chooser.SetSelected(c.damage)
+ }
+
+ setBox(t, fields, c.box, c.bad)
+ if got := boxText(t, fields, c.box); got != c.bad {
+ t.Fatalf("the box holds %q rather than %q, so there is nothing to refuse", got, c.bad)
+ }
+ press(t, content, text.ButtonCopyCommand())
+ if host.copied != "" {
+ t.Errorf("a refused form put %q on the clipboard", host.copied)
+ }
+ said := findField(fields, c.box).Saying()
+ if said == "" || (c.says != "" && !strings.Contains(said, c.says)) {
+ t.Errorf("the %s box says %q. Marked: %v", c.box, said, fields.Marked())
+ }
+
+ setBox(t, fields, c.box, c.good)
+ press(t, content, text.ButtonCopyCommand())
+ if host.copied == "" {
+ t.Fatalf("the form put right copied nothing either, so the refusal above proves nothing")
+ }
+ if said := findField(fields, c.box).Saying(); said != "" {
+ t.Errorf("the refusal stayed under the box after the copy worked: %q", said)
+ }
+ })
+ }
+}
+
+// copiedFrom presses Copy command and answers the line, after asking that the
+// status line says which shell it was written for.
+func copiedFrom(t *testing.T, host *fakeHost, o fyne.CanvasObject) string {
+ t.Helper()
+ host.copied = ""
+ press(t, o, text.ButtonCopyCommand())
+ if host.copied == "" {
+ t.Fatalf("Copy command put nothing on the clipboard. The screen says: %s", textIn(o))
+ }
+ said := text.CommandCopiedTerminal()
+ if commandline.ShellFor(runtime.GOOS) == commandline.PowerShell {
+ said = text.CommandCopiedPowerShell()
+ }
+ if !strings.Contains(textIn(o), said) {
+ t.Errorf("after a copy the screen does not say %q. It says: %s", said, textIn(o))
+ }
+ return host.copied
+}
+
+// runCopied reads the line the way the shell of this system would, leaves out
+// the word that starts tfg and hands the rest to the command line. It answers
+// what the command printed.
+func runCopied(t *testing.T, line string) string {
+ t.Helper()
+ words, err := readLine(line, commandline.ShellFor(runtime.GOOS))
+ if err != nil {
+ t.Fatalf("reading the copied line: %v\n%s", err, line)
+ }
+ args := withoutProgram(words)
+ var out, errOut bytes.Buffer
+ if code := cli.Run(context.Background(), args, &out, &errOut); code != cli.ExitOK {
+ t.Fatalf("the copied line ended with code %d:\n%s\n%s", code, line, errOut.String())
+ }
+ return out.String()
+}
+
+// sameRun compares what two runs wrote: every file of the set, byte for byte,
+// and what the manifests say about each.
+func sameRun(t *testing.T, line, fromLine, fromWindow string) {
+ t.Helper()
+ a := damageManifest(t, filepath.Join(fromLine, engine.DefaultManifestName))
+ b := damageManifest(t, filepath.Join(fromWindow, engine.DefaultManifestName))
+ if len(a.Files) == 0 {
+ t.Fatalf("the copied line wrote no files, so there is nothing to compare:\n%s", line)
+ }
+ if !reflect.DeepEqual(a.Files, b.Files) {
+ left, _ := json.MarshalIndent(a.Files, "", " ")
+ right, _ := json.MarshalIndent(b.Files, "", " ")
+ t.Fatalf("the copied line and the window wrote different sets.\nThe line: %s\nFrom the line:\n%s\nFrom the window:\n%s", line, left, right)
+ }
+ for _, f := range a.Files {
+ x, errX := os.ReadFile(filepath.Join(fromLine, f.Path))
+ y, errY := os.ReadFile(filepath.Join(fromWindow, f.Path))
+ if errX != nil || errY != nil || !bytes.Equal(x, y) {
+ t.Errorf("%s differs between the copied line and the window (%v, %v)", f.Path, errX, errY)
+ }
+ }
+}
+
+// putIn sets a field whether it is a box or a list.
+func putIn(t *testing.T, fields *parts.Fields, at, value string) {
+ t.Helper()
+ f := findField(fields, at)
+ if f == nil {
+ t.Fatalf("no field is registered at %q", at)
+ }
+ if c, ok := f.Control.(*parts.Chooser); ok {
+ c.SetSelected(choiceNamed(t, c, value))
+ return
+ }
+ setBox(t, fields, at, value)
+}
+
+// choiceNamed is the entry of a list that is, or starts with, an id - a list of
+// presets or tools shows the id with its question after it.
+func choiceNamed(t *testing.T, c *parts.Chooser, id string) string {
+ t.Helper()
+ for _, o := range c.Options {
+ if o == id || strings.HasPrefix(o, id+" ") {
+ return o
+ }
+ }
+ t.Fatalf("the list has no entry for %q: %v", id, c.Options)
+ return ""
+}
+
+// withoutProgram drops the word that starts tfg: the name, a path, or the
+// call operator of PowerShell and the path after it.
+func withoutProgram(words []string) []string {
+ if len(words) > 1 && words[0] == "&" {
+ return words[2:]
+ }
+ if len(words) > 0 {
+ return words[1:]
+ }
+ return nil
+}
+
+// readLine splits a line the way the shell would, for the quoting this
+// project writes: single quotes in both, a doubled quote inside them in
+// PowerShell, and in sh a quote closed, a backslashed quote and a quote opened
+// again. Anything outside that is refused rather than
+// guessed at, so a line written in some other way fails here.
+//
+// A model of the shell, which is why it is not the only reader: the guard in
+// copyquoting_test.go hands lines to the real shells.
+func readLine(line string, s commandline.Shell) ([]string, error) {
+ var words []string
+ var word strings.Builder
+ inWord, quoted := false, false
+ runes := []rune(line)
+ for i := 0; i < len(runes); i++ {
+ c := runes[i]
+ switch {
+ case quoted && isSingleQuote(c, s) && s == commandline.PowerShell && i+1 < len(runes) && runes[i+1] == c:
+ word.WriteRune(c)
+ i++
+ case quoted && isSingleQuote(c, s):
+ quoted = false
+ case quoted:
+ word.WriteRune(c)
+ case c == '\'' || (s == commandline.PowerShell && isSingleQuote(c, s)):
+ quoted, inWord = true, true
+ case c == '\\' && s == commandline.POSIX && i+1 < len(runes):
+ word.WriteRune(runes[i+1])
+ inWord = true
+ i++
+ case c == ' ':
+ if inWord {
+ words = append(words, word.String())
+ word.Reset()
+ inWord = false
+ }
+ default:
+ word.WriteRune(c)
+ inWord = true
+ }
+ }
+ if quoted {
+ return nil, errUnclosedQuote
+ }
+ if inWord {
+ words = append(words, word.String())
+ }
+ return words, nil
+}
+
+// isSingleQuote is a character the shell reads as a single quote: the plain
+// one, and in PowerShell four typographic ones as well.
+func isSingleQuote(c rune, s commandline.Shell) bool {
+ if c == '\'' {
+ return true
+ }
+ return s == commandline.PowerShell && (c == 0x2018 || c == 0x2019 || c == 0x201A || c == 0x201B)
+}
+
+var errUnclosedQuote = errors.New("a quote is opened and never closed")
diff --git a/internal/guard/copyquoting_test.go b/internal/guard/copyquoting_test.go
new file mode 100644
index 00000000..2451cbf0
--- /dev/null
+++ b/internal/guard/copyquoting_test.go
@@ -0,0 +1,449 @@
+package guard
+
+import (
+ "encoding/hex"
+ "errors"
+ "fmt"
+ "io/fs"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "reflect"
+ "runtime"
+ "strings"
+ "testing"
+ "time"
+
+ "github.com/donislawdev/TestingFilesGenerator/internal/commandline"
+)
+
+// A copied line is pasted into a real shell, so its quoting is asked of real
+// shells rather than of a model of them. A small program stands in for tfg and
+// prints every argument it was handed, the shells on this machine run a line
+// written for them, and each value has to arrive exactly as it was typed.
+//
+// The values are the ones that broke something in a shell somewhere: quotes of
+// every kind, the marks that start a second command, a variable, a pattern, a
+// dash that makes a flag, and the stop-parsing token of PowerShell. Measured on
+// 2026-11-25 before this was written - docs, the analysis of that day, section 2.
+//
+// Windows PowerShell 5.1 is asked separately. It hands a double quote and a
+// last backslash after a space to a program differently from PowerShell 7.3, the
+// line says so instead of pretending, and this guard holds both halves of that
+// sentence: every value the line does NOT warn about arrives whole in 5.1, and
+// every value it does warn about really arrives changed - a warning nobody
+// needs any more is a sentence on the screen that is no longer true.
+func TestEveryValueReachesTheProgramAsItWasWritten(t *testing.T) {
+ program := echoProgram(t)
+ values := hostileValues()
+ ran := 0
+ for _, dialect := range []commandline.Shell{commandline.PowerShell, commandline.POSIX} {
+ for _, shell := range shellsFor(dialect) {
+ ran++
+ t.Run(filepath.Base(shell), func(t *testing.T) {
+ if olderPowerShell(shell) {
+ checkOlderPowerShell(t, shell, program, values)
+ return
+ }
+ line := lineOf(t, program, dialect, values)
+ expectArrived(t, shell, dialect, line.Text, wordsFor(values))
+ canary(t, shell, dialect, program)
+ })
+ }
+ }
+ if ran == 0 {
+ t.Skip("NOT CHECKED: no PowerShell and no sh on this machine. CI runs this on Windows, Linux and macOS, each with PowerShell 7.3 or later.")
+ }
+}
+
+// hostileValues is the table. Characters outside ASCII are written as numbers
+// so that this file stays plain ASCII.
+func hostileValues() []string {
+ r := func(code rune) string { return string(code) }
+ return []string{
+ "plain", "with space", "two spaces", " lead", "trail ", "it's", "'", "''", `a\'b`,
+ "typographic " + r(0x2019) + " quote", r(0x2018) + "a" + r(0x2019), r(0x201A) + r(0x201B),
+ r(0x201C) + "double" + r(0x201D), r(0x2013) + "x", r(0x2014) + "x",
+ "$HOME", "$(echo x)", "${HOME}", "`x`", "a;b", "a|b", "a&b", "R&D", "a&&b", ">out", "&1",
+ "#c", "@x", "@(1)", "{a}", "(x)", "a,b", "1,000",
+ "-foo.txt", "--%", "--% x", "-", "--", "-5", "--x=y", "=x", "~/x", "~",
+ "*", "?", "[a]", "!x", "!!", "%PATH%", "%", "50%",
+ `C:\x\y`, `\\server\share`, `\`, "/usr/bin", "1mb", "1e3", "0x10", "1kb-8kb", "1..5", "+5", "a=b",
+ "za" + r(0x017C) + r(0x00F3) + r(0x0142) + r(0x0107) + " g" + r(0x0119) + r(0x015B) + "l" + r(0x0105),
+ `a"b`, `"quoted"`, `C:\My Dir\`,
+ }
+}
+
+// lineOf writes one flag per value, each under a setting named after its
+// place, so a warning can be traced back to the value it is about.
+func lineOf(t *testing.T, program commandline.Program, s commandline.Shell, values []string) commandline.Written {
+ t.Helper()
+ l := commandline.New("generate")
+ for i, v := range values {
+ l.Flag("--v", v, fmt.Sprint(i))
+ }
+ w, err := l.Write(program, s)
+ if err != nil {
+ t.Fatalf("writing the line: %v", err)
+ }
+ return w
+}
+
+// wordsFor is what the program should receive for the values: the verb, then
+// each value after its flag, or joined to it when the value starts with a dash.
+func wordsFor(values []string) []string {
+ words := []string{"generate"}
+ for _, v := range values {
+ if strings.HasPrefix(v, "-") {
+ words = append(words, "--v="+v)
+ continue
+ }
+ words = append(words, "--v", v)
+ }
+ return words
+}
+
+// checkOlderPowerShell holds the two halves of the warning in 5.1.
+func checkOlderPowerShell(t *testing.T, shell string, program commandline.Program, values []string) {
+ warned := map[string]bool{}
+ for _, setting := range lineOf(t, program, commandline.PowerShell, values).OlderPowerShell {
+ warned[setting] = true
+ }
+ if len(warned) == 0 {
+ t.Fatalf("the line warns about none of the values, and the table holds three that 5.1 changes - so the warning is not reached")
+ }
+ var calm []string
+ for i, v := range values {
+ if !warned[fmt.Sprint(i)] {
+ calm = append(calm, v)
+ continue
+ }
+ one := lineOf(t, program, commandline.PowerShell, []string{v})
+ if got := arrived(t, shell, commandline.PowerShell, one.Text); reflect.DeepEqual(got, wordsFor([]string{v})) {
+ t.Errorf("Windows PowerShell 5.1 handed %q to the program whole, so the line warns about a value it does not change", v)
+ }
+ }
+ expectArrived(t, shell, commandline.PowerShell, lineOf(t, program, commandline.PowerShell, calm).Text, wordsFor(calm))
+}
+
+// canary hands the shell a line written badly on purpose and asks that the
+// value does NOT arrive whole. A guard that cannot see a broken line would pass
+// every line.
+func canary(t *testing.T, shell string, s commandline.Shell, program commandline.Program) {
+ start, err := commandline.New().Write(program, s)
+ if err != nil {
+ t.Fatal(err)
+ }
+ bad, broken := start.Text+" --v -foo.txt", []string{"--v", "-foo.txt"}
+ if s == commandline.POSIX {
+ bad, broken = start.Text+" --v $HOME", []string{"--v", "$HOME"}
+ }
+ if got := arrived(t, shell, s, bad); reflect.DeepEqual(got, broken) {
+ t.Errorf("CANARY: %s handed the badly written %q over whole, so this guard cannot tell a broken line from a good one", shell, bad)
+ }
+ // An empty word is an argument too. A line that gained one would ask the
+ // program something else, and a reader that split the output on white
+ // space would lose it and pass the line.
+ extra, whole := start.Text+" --v x ''", []string{"--v", "x", ""}
+ if got := arrived(t, shell, s, extra); !reflect.DeepEqual(got, whole) {
+ t.Errorf("CANARY: %s handed %q over as %q, so this guard cannot see an empty argument", shell, extra, got)
+ }
+}
+
+// expectArrived runs a line and compares what the program received.
+func expectArrived(t *testing.T, shell string, s commandline.Shell, line string, want []string) {
+ t.Helper()
+ got := arrived(t, shell, s, line)
+ if reflect.DeepEqual(got, want) {
+ return
+ }
+ for i := 0; i < len(want) || i < len(got); i++ {
+ var w, g string
+ if i < len(want) {
+ w = want[i]
+ }
+ if i < len(got) {
+ g = got[i]
+ }
+ if w != g {
+ t.Errorf("%s: argument %d arrived as %q, written as %q", shell, i, g, w)
+ }
+ }
+ t.Logf("the line was:\n%s", line)
+}
+
+// arrived runs the line from a script file - a file rather than an argument,
+// so nothing between this guard and the shell quotes it a second time - and
+// answers the arguments the program printed.
+func arrived(t *testing.T, shell string, s commandline.Shell, line string) []string {
+ t.Helper()
+ return ranIn(t, shell, s, t.TempDir(), line, "")
+}
+
+// ranIn runs a script the way a terminal open in dir would, with first put
+// at the front of PATH when it is given, and answers the arguments the stand
+// in printed. The script file is written into dir as well.
+func ranIn(t *testing.T, shell string, s commandline.Shell, dir, line, first string) []string {
+ t.Helper()
+ var cmd *exec.Cmd
+ if s == commandline.PowerShell {
+ // With a byte order mark, without which 5.1 reads the script in the
+ // code page of the machine and changes every letter outside ASCII
+ // before the line is even parsed.
+ script := filepath.Join(dir, "line.ps1")
+ writeScript(t, script, "\xef\xbb\xbf"+line+"\n")
+ cmd = exec.Command(shell, "-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-File", script)
+ } else {
+ script := filepath.Join(dir, "line.sh")
+ writeScript(t, script, line+"\n")
+ cmd = exec.Command(shell, script)
+ }
+ cmd.Dir = dir
+ if first != "" {
+ // Last wins, and on Windows without regard to case, so this PATH
+ // replaces the Path the environment already holds.
+ cmd.Env = append(os.Environ(), "PATH="+first+string(os.PathListSeparator)+os.Getenv("PATH"))
+ }
+ out, err := cmd.Output()
+ if err != nil {
+ t.Fatalf("%s did not run the line: %v\n%s", shell, err, line)
+ }
+ // One line per argument, each behind a mark, so an empty argument is a
+ // line of its own rather than nothing between two others.
+ var args []string
+ for line := range strings.Lines(string(out)) {
+ h, marked := strings.CutPrefix(strings.TrimRight(line, "\r\n"), echoMark)
+ b, err := hex.DecodeString(h)
+ if !marked || err != nil {
+ t.Fatalf("%s printed %q, which is not what the stand in prints", shell, line)
+ }
+ args = append(args, string(b))
+ }
+ return args
+}
+
+// echoMark stands before every argument the stand in prints.
+const echoMark = "arg:"
+
+func writeScript(t *testing.T, path, body string) {
+ t.Helper()
+ if err := os.WriteFile(path, []byte(body), 0o600); err != nil {
+ t.Fatal(err)
+ }
+}
+
+// echoProgram builds the stand in for tfg next to a window that is not there,
+// and finds it the way the window would. Asserted to be found BESIDE the
+// window, because that is the path the line writes in full - the hardest word
+// of the line to get right - and a stand in found any other way would leave it
+// out.
+func echoProgram(t *testing.T) commandline.Program {
+ t.Helper()
+ dir := echoBuilt(t)
+ p := commandline.Locate(commandline.System{
+ GOOS: runtime.GOOS,
+ Getenv: func(string) string { return "" },
+ Executable: filepath.Join(dir, "tfg-gui"),
+ Stat: os.Stat,
+ })
+ if p.Where != commandline.Beside {
+ t.Fatalf("the stand in at %s was not found beside the window (found: %v)", dir, p.Where)
+ }
+ return p
+}
+
+// echoBuilt builds the stand in for tfg, a program that prints every argument
+// it is handed, and answers the folder it is in.
+func echoBuilt(t *testing.T) string {
+ t.Helper()
+ dir := t.TempDir()
+ src := filepath.Join(dir, "echo.go")
+ writeScript(t, src, "package main\n\nimport (\n\t\"encoding/hex\"\n\t\"fmt\"\n\t\"os\"\n)\n\n"+
+ "func main() {\n\tfor _, a := range os.Args[1:] {\n\t\tfmt.Println(\""+echoMark+"\" + hex.EncodeToString([]byte(a)))\n\t}\n}\n")
+ name := "tfg"
+ if runtime.GOOS == "windows" {
+ name = "tfg.exe"
+ }
+ build := exec.Command("go", "build", "-o", filepath.Join(dir, name), src)
+ build.Dir = dir
+ build.Env = append(os.Environ(), "CGO_ENABLED=0", "GOFLAGS=")
+ if out, err := build.CombinedOutput(); err != nil {
+ t.Fatalf("building the stand in for tfg: %v\n%s", err, out)
+ }
+ return dir
+}
+
+// shellsFor is every shell on this machine that reads a dialect. sh is not
+// asked on Windows: the one there translates arguments that look like paths
+// before a program sees them, which is not what a terminal on macOS or Linux
+// does, and those systems run this guard in CI.
+func shellsFor(s commandline.Shell) []string {
+ names := []string{"pwsh"}
+ if runtime.GOOS == "windows" {
+ names = append(names, "powershell")
+ }
+ if s == commandline.POSIX {
+ if runtime.GOOS == "windows" {
+ return nil
+ }
+ names = []string{"sh", "bash", "zsh"}
+ }
+ var found []string
+ for _, n := range names {
+ if p, err := exec.LookPath(n); err == nil {
+ found = append(found, p)
+ }
+ }
+ return found
+}
+
+// olderPowerShell reports whether a shell is Windows PowerShell 5.1, which is
+// powershell.exe, where 7 is pwsh.
+func olderPowerShell(shell string) bool {
+ return strings.EqualFold(strings.TrimSuffix(filepath.Base(shell), ".exe"), "powershell")
+}
+
+// Where tfg is found, asked of machines described rather than of this one, so
+// that every system is asked on every system. Each case carries the same
+// machine without the file as its canary: found there too would mean the
+// answer came from somewhere other than the file.
+func TestTheLineStartsTfgTheWayThisComputerFindsIt(t *testing.T) {
+ cases := []struct {
+ label string
+ goos string
+ path string
+ exe string
+ file string
+ mode fs.FileMode
+ where commandline.Where
+ starts string
+ pathext string
+ }{
+ {"on PATH on Windows", "windows", `C:\Windows;C:\tools`, `C:\apps\tfg-gui.exe`, `C:\tools\tfg.exe`, 0o644, commandline.OnPath, "tfg", ""},
+ {"the .cmd npm installs, in a quoted PATH entry", "windows", `C:\Windows;"C:\node bin"`, `C:\apps\tfg-gui.exe`, `C:\node bin\tfg.cmd`, 0o644, commandline.OnPath, "tfg", ".COM;.EXE;.BAT;.CMD"},
+ {"beside the window on Windows", "windows", `C:\Windows`, `C:\apps\tfg\tfg-gui.exe`, `C:\apps\tfg\tfg.exe`, 0o644, commandline.Beside, `C:\apps\tfg\tfg.exe`, ""},
+ {"beside the window in a folder with a space", "windows", ``, `C:\My Apps\tfg-gui.exe`, `C:\My Apps\tfg.exe`, 0o644, commandline.Beside, `& 'C:\My Apps\tfg.exe'`, ""},
+ {"a relative PATH entry is the terminal's folder, not one to trust", "windows", `bin`, `C:\apps\tfg-gui.exe`, `bin\tfg.exe`, 0o644, commandline.Missing, "tfg", ""},
+ {"on PATH on Linux", "linux", "/usr/bin:/usr/local/bin", "/opt/w/tfg-gui", "/usr/local/bin/tfg", 0o755, commandline.OnPath, "tfg", ""},
+ {"a file nobody may run is not a program", "linux", "/usr/bin", "/opt/w/tfg-gui", "/usr/bin/tfg", 0o644, commandline.Missing, "tfg", ""},
+ {"an empty PATH entry is the terminal's folder", "linux", ":/usr/bin", "/home/me/tfg/tfg-gui", "tfg", 0o755, commandline.Missing, "tfg", ""},
+ {"beside the window on Linux", "linux", "/usr/bin", "/home/me/tfg/tfg-gui", "/home/me/tfg/tfg", 0o755, commandline.Beside, "/home/me/tfg/tfg", ""},
+ {"beside the bundle on macOS", "darwin", "/usr/bin", "/Users/me/tfg/tfg-gui.app/Contents/MacOS/tfg-gui", "/Users/me/tfg/tfg", 0o755, commandline.Beside, "/Users/me/tfg/tfg", ""},
+ {"beside the bundle in a folder with a space", "darwin", "/usr/bin", "/Users/me/My tfg/tfg-gui.app/Contents/MacOS/tfg-gui", "/Users/me/My tfg/tfg", 0o755, commandline.Beside, "'/Users/me/My tfg/tfg'", ""},
+ }
+ for _, c := range cases {
+ t.Run(c.label, func(t *testing.T) {
+ sys := describedSystem(c.goos, c.path, c.pathext, c.exe, map[string]fs.FileMode{c.file: c.mode})
+ p := commandline.Locate(sys)
+ if p.Where != c.where {
+ t.Fatalf("found %v, want %v", p.Where, c.where)
+ }
+ w, err := commandline.New("generate").Write(p, commandline.ShellFor(c.goos))
+ if err != nil {
+ t.Fatal(err)
+ }
+ if got := strings.TrimSuffix(w.Text, " generate"); got != c.starts {
+ t.Errorf("the line starts %q, want %q", got, c.starts)
+ }
+ if c.where == commandline.Missing {
+ return
+ }
+ if commandline.Locate(describedSystem(c.goos, c.path, c.pathext, c.exe, nil)).Where != commandline.Missing {
+ t.Errorf("CANARY: the same machine without %s still finds tfg", c.file)
+ }
+ })
+ }
+}
+
+func describedSystem(goos, path, pathext, exe string, files map[string]fs.FileMode) commandline.System {
+ return commandline.System{
+ GOOS: goos,
+ Getenv: func(name string) string {
+ switch name {
+ case "PATH":
+ return path
+ case "PATHEXT":
+ return pathext
+ }
+ return ""
+ },
+ Executable: exe,
+ Stat: func(p string) (fs.FileInfo, error) {
+ mode, ok := files[p]
+ if !ok {
+ return nil, fs.ErrNotExist
+ }
+ return describedFile{mode: mode}, nil
+ },
+ }
+}
+
+// describedFile is a file that exists only in a case of the guard above.
+type describedFile struct{ mode fs.FileMode }
+
+func (f describedFile) Name() string { return "tfg" }
+func (f describedFile) Size() int64 { return 1 }
+func (f describedFile) Mode() fs.FileMode { return f.mode }
+func (f describedFile) ModTime() time.Time { return time.Time{} }
+func (f describedFile) IsDir() bool { return false }
+func (f describedFile) Sys() any { return nil }
+
+// A value no line can carry is refused under the setting it came from, and a
+// value that starts with a dash with no flag to join it to is refused too.
+func TestAValueNoLineCanCarryIsRefusedUnderItsSetting(t *testing.T) {
+ missing := commandline.Program{}
+ for _, c := range []struct {
+ label string
+ line *commandline.Line
+ why commandline.Reason
+ }{
+ {"a line break", commandline.New("generate").Flag("--name", "a\nb", "name"), commandline.ControlCharacter},
+ {"a tab", commandline.New("generate").Flag("--name", "a\tb", "name"), commandline.ControlCharacter},
+ {"a line separator", commandline.New("generate").Flag("--name", "a"+string(rune(0x2028))+"b", "name"), commandline.ControlCharacter},
+ {"bytes that are not text", commandline.New("generate").Flag("--name", "a\xffb", "name"), commandline.NotText},
+ {"an argument starting with a dash", commandline.New("tool", "checksum").Argument("-x", "name"), commandline.LeadingDash},
+ } {
+ for _, s := range []commandline.Shell{commandline.PowerShell, commandline.POSIX} {
+ _, err := c.line.Write(missing, s)
+ var u *commandline.Unwritable
+ if !errors.As(err, &u) || u.Reason != c.why || u.Setting != "name" {
+ t.Errorf("%s: Write answered %v, want a refusal of kind %d under name", c.label, err, c.why)
+ }
+ }
+ }
+ if _, err := commandline.DamageValue("zero-head", map[string]string{"bytes": "1,6"}); err == nil {
+ t.Errorf("a comma inside a setting of a damage was written, and --damage would split it in two")
+ }
+ if got, _ := commandline.DamageValue("zero-head", map[string]string{"z": "1", "bytes": "16"}); got != "zero-head:bytes=16,z=1" {
+ t.Errorf("DamageValue wrote %q, want the settings in the order of their names", got)
+ }
+ checkTextEnds(t, missing)
+}
+
+// checkTextEnds holds a Script to the one line each shell reads as the end of
+// the text it saves - '@ at the start of a line in PowerShell, the word that
+// closes the text in sh - and asks that a line merely holding it, or an
+// indented '@, which both PowerShells kept inside on 2026-11-25, is written.
+func checkTextEnds(t *testing.T, missing commandline.Program) {
+ then := commandline.New("generate").Argument("r.yaml", "")
+ for _, c := range []struct {
+ content string
+ shell commandline.Shell
+ refused bool
+ }{
+ {"a: 1\n'@x\n", commandline.PowerShell, true},
+ {"a: 1\n '@\nb: '@\n", commandline.PowerShell, false},
+ {"a: 1\nTFG_EOF\n", commandline.POSIX, true},
+ {"a: 1\n TFG_EOF\nb: TFG_EOF\n", commandline.POSIX, false},
+ {"a: 1\nb: \x01\n", commandline.POSIX, true},
+ } {
+ w, err := commandline.FileThen("r.yaml", c.content, then).Write(missing, c.shell)
+ var u *commandline.Unwritable
+ switch {
+ case c.refused && !errors.As(err, &u):
+ t.Errorf("a text holding %q was written for shell %d, and the shell would save part of it:\n%s", c.content, c.shell, w.Text)
+ case !c.refused && (err != nil || !strings.Contains(w.Text, strings.TrimSuffix(c.content, "\n"))):
+ t.Errorf("a text holding %q was refused or changed for shell %d (%v):\n%s", c.content, c.shell, err, w.Text)
+ }
+ }
+}
diff --git a/internal/guard/copyrecipe_test.go b/internal/guard/copyrecipe_test.go
new file mode 100644
index 00000000..6c05a99e
--- /dev/null
+++ b/internal/guard/copyrecipe_test.go
@@ -0,0 +1,157 @@
+package guard
+
+import (
+ "bytes"
+ "context"
+ "os"
+ "path/filepath"
+ "runtime"
+ "strings"
+ "testing"
+
+ "github.com/donislawdev/TestingFilesGenerator/internal/cli"
+ "github.com/donislawdev/TestingFilesGenerator/internal/commandline"
+ "github.com/donislawdev/TestingFilesGenerator/internal/gui/text"
+ "github.com/donislawdev/TestingFilesGenerator/internal/gui/window"
+ "github.com/donislawdev/TestingFilesGenerator/internal/recipe"
+)
+
+// The Several batches screen copies two commands: the recipe of the screen,
+// which the shell saves as a file, and tfg generate on that file. They are
+// pasted into the real shells of this machine rather than read by a model,
+// because what they lean on - a here-string in PowerShell, a here-document in
+// sh, and the file each saves - is the shell's to get right. The class and
+// the purpose hold what a shell reads as code when a text is not taken as it
+// stands, so a saved recipe that went through the shell's hands changed is a
+// difference in the hash and in the manifest.
+//
+// The saved file is held to the name the window gave it, which is the start
+// of the hash of the recipe the window composed, and the files the second
+// command makes are held to the files Generate makes from the same form.
+// The canary hands the shell the same text with quoting that expands, and
+// asks that what it saves is NOT the recipe - without that, a value the shell
+// leaves alone either way would prove nothing about the quoting.
+func TestACommandCopiedFromSeveralBatchesMakesTheFilesTheWindowMakes(t *testing.T) {
+ dialect := commandline.ShellFor(runtime.GOOS)
+ shells := shellsFor(dialect)
+ if len(shells) == 0 {
+ t.Skip("NOT CHECKED: no shell of this system on this machine. CI runs this on Windows, Linux and macOS.")
+ }
+ stand := echoBuilt(t)
+
+ host := newFakeHost(t)
+ screen := window.NewRecipe(host)
+ body := screen.Object()
+ t.Cleanup(func() { join(host) })
+ pressNamed(t, body, text.ButtonAddBatch())
+ fields := screen.Fields()
+ set := func(position int, setting, value string) {
+ setBox(t, fields, recipe.TargetAddress(position, setting), value)
+ }
+ r := func(code rune) string { return string(code) }
+ read := `it's "$HOME" $(echo x) ` + "`echo y`" + ` @' '@ TFG_EOF z` + r(0x017C) + r(0x00F3) + r(0x0142) + "w " + r(0x2019)
+ set(1, recipe.KeyID, "first")
+ chooserIn(t, fields, recipe.TargetAddress(1, recipe.KeyFormat)).SetSelected("txt")
+ set(1, recipe.KeySize, "1kb")
+ set(1, recipe.KeyCount, "2")
+ set(1, recipe.KeyGroup, read)
+ set(1, recipe.KeyPurpose, read)
+ set(2, recipe.KeyID, "second")
+ chooserIn(t, fields, recipe.TargetAddress(2, recipe.KeyFormat)).SetSelected("csv")
+ set(2, recipe.KeySize, "2kb")
+ setBox(t, fields, recipe.KeySeed, "4242")
+
+ // An emptied folder is refused under its box and nothing is copied: the
+ // recipe would leave output.dir out, and the command reads that as the
+ // folder the terminal is in, where Generate refuses.
+ setBox(t, fields, recipe.KeyOutputDir, "")
+ press(t, body, text.ButtonCopyCommand())
+ if host.copied != "" || findField(fields, recipe.KeyOutputDir).Saying() == "" {
+ t.Errorf("with the output folder emptied the clipboard holds %q and the box says %q", host.copied, findField(fields, recipe.KeyOutputDir).Saying())
+ }
+
+ fromWindow := t.TempDir()
+ setBox(t, fields, recipe.KeyOutputDir, fromWindow)
+ press(t, body, text.ButtonGenerate())
+ join(host)
+
+ for _, shell := range shells {
+ t.Run(filepath.Base(shell), func(t *testing.T) {
+ fromScript := t.TempDir()
+ setBox(t, fields, recipe.KeyOutputDir, fromScript)
+ script := copiedFrom(t, host, body)
+ last := script[strings.LastIndex(script, "\n")+1:]
+ if !strings.HasPrefix(last, commandline.Name+" ") {
+ t.Fatalf("the last command does not start tfg by its name, so the stand in put first on PATH is not what runs:\n%s", script)
+ }
+
+ cwd := t.TempDir()
+ args := ranIn(t, shell, dialect, cwd, script, stand)
+ if len(args) < 2 || args[0] != commandline.Generate {
+ t.Fatalf("the script ran tfg with %q:\n%s", args, script)
+ }
+ file := args[1]
+ saved := savedRecipe(t, cwd, file, script)
+ if !strings.Contains(textIn(body), text.CommandSavesRecipe(file)) {
+ t.Errorf("the screen does not say the recipe is saved as %s. It says: %s", file, textIn(body))
+ }
+
+ // The canary, in a folder of its own.
+ elsewhere := t.TempDir()
+ ranIn(t, shell, dialect, elsewhere, expanding(t, script, dialect), stand)
+ if bytes.Equal(savedRecipe(t, elsewhere, file, ""), saved) {
+ t.Errorf("CANARY: %s saved the recipe whole from text it was told to expand, so the values on this form cannot tell a quoted text from one that is not", shell)
+ }
+
+ t.Chdir(cwd)
+ var out, errOut bytes.Buffer
+ if code := cli.Run(context.Background(), args, &out, &errOut); code != cli.ExitOK {
+ t.Fatalf("the saved recipe ended with code %d:\n%s\n%s", code, script, errOut.String())
+ }
+ sameRun(t, script, fromScript, fromWindow)
+ })
+ }
+}
+
+// savedRecipe reads the file the shell saved and holds it to its name. The
+// name carries the start of the hash of the recipe the window composed, so a
+// file that does not hash to it is not the recipe that was copied. hold is
+// the script, or empty for a file that is expected to differ.
+func savedRecipe(t *testing.T, dir, file, hold string) []byte {
+ t.Helper()
+ saved, err := os.ReadFile(filepath.Join(dir, file))
+ if err != nil {
+ t.Fatalf("the shell saved no %s: %v", file, err)
+ }
+ if hold == "" {
+ return saved
+ }
+ hash, err := recipe.Hash(saved)
+ if err != nil {
+ t.Fatalf("the saved recipe does not read: %v\n%s", err, hold)
+ }
+ if want := strings.TrimPrefix(hash, "sha256:")[:12]; !strings.Contains(file, want) {
+ t.Fatalf("the saved recipe hashes to %s, which is not the %s it was copied as:\n%s", hash, file, hold)
+ }
+ return saved
+}
+
+// expanding is the script with the quoting that keeps the text as it stands
+// taken away: a here-string in double quotes in PowerShell, a here-document
+// whose end is not quoted in sh. Both expand a variable and run a command
+// written inside the text.
+func expanding(t *testing.T, script string, s commandline.Shell) string {
+ t.Helper()
+ open, close, opened, closed := "<<'TFG_EOF'", "", "<: red each time.",
- "TestSmallestCannotBeChosenUntilTheWidthAndHeightAreSet": "a canary of its own - a switch holding Smallest for every picture " +
- "has to disagree with the engine, which takes it for svg at its defaults - a reach check that the engine both took and " +
- "refused it, and broken by hand on 2026-11-18 six ways: never held, a press choosing a held option, the keys stepping " +
- "onto it, no reason under the pointer, the batch screen not following what is typed, the declared sides ignored - red " +
- "each time (the press only after each way of reaching it was asked on its own: End stepped back off it).",
- "TestAPlaceholderSettingIsOnTheScreenExactlyWhileItApplies": "the bad background is refused while it is shown, so the " +
- "preview is known to reach the box, and broken by hand on 2026-11-17 four ways - every row always shown, a hidden value " +
- "sent, the menu not wired to show the rows again, the heading never hidden: red each time.",
- "TestASettingThatChangesNothingIsRefusedRatherThanIgnored": "a canary of its own - a png that drops background before " +
- "planning has to be found silent - the same plan without the setting taken first, and broken by hand on 2026-11-17 by " +
- "letting text through on the test pattern: red, png, jpg and svg.",
- "TestARegistryRefusesAConditionItCannotKeep": "a canary of its own - a condition on a choice declared before it has to be " +
- "taken - beside one declaration for each way a condition cannot be kept.",
- "TestEveryNameWrittenByHandBelongsToADeclaredValue": "a canary of its own - a name for a value nothing declares has to be " +
- "found - and a floor on how many names there are.",
- "TestNoListShowsAValueSpelledAsARecipeKey": "a canary of its own - a list showing record-per-line as it is has to be found " +
- "- and each standard token let through has to still be a declared value.",
- "TestTheEnglishWindowShowsAListValueByItsName": "broken by hand on 2026-11-17 twice, ChoiceName saying the value and the " +
- "folded summary saying the value: red both times. It reads the window, so a stale registry/en.json cannot hide either.",
- "TestTheEnglishWindowRewordsOnlyNamesAndLabels": "a canary of its own - a planted sentence has to come out reworded, " +
- "names and labels in and no quotes - a floor on the refusals and the names they carry, and broken by hand on " +
- "2026-11-17 six ways (names, labels, a sentence inside, quotes, a wrapper at the foot, a join): red every time.",
- "TestTheWindowSaysNoWordOfTheRecipe": "a canary of its own - a sentence made of the recipe's words has to be found " +
- "to carry each kind, and a layout that dropped a value has to be told from one that keeps them - floors on the " +
- "keys, the values and the refusals a window was asked about, and broken by hand on 2026-11-17 seven ways (no " +
- "phrases, a sentence inside not laid out, a place of the recipe not reworded, the sentence itself not laid out, " +
- "a phrase dropping a value, Polish saying a key, a listed sentence shown): red every time.",
- "TestEveryScrollingAreaMovesAsFarAsTheSystemSays": "a canary of its own - the toolkit's bare scroll turned " +
- "one notch has to be told apart from the system's distance - every screen asserted to have something below " +
- "its fold, and broken by hand on 2026-11-17 three ways (the wheel left at the toolkit's step, a screen on " +
- "the toolkit's own area, a whole view at a time ignored): red every time.",
- "TestTheWheelStepIsTheToolkitsStep": "a canary of its own - a declared step of 31 has to be read as 31 - and " +
- "broken by hand on 2026-11-17 by taking the toolkit's step for 20: red.",
- "TestTheWheelLinesAreWhatWindowsIsSetTo": "a canary of its own - reg.exe's line for a setting of 7 has to read " +
- "as 7 - and broken by hand on 2026-11-17 by reading the system's answer one too high: red.",
- "TestEveryPictureOfTheSizesSetIsTheSizeItIsNamed": "a canary of its own - a picture named for another size has " +
- "to be caught and one named for its own size let through - a floor on the pictures read back, and broken by " +
- "hand on 2026-11-17 two ways (width and height swapped, a size with two uses made two files): red both times.",
- "TestThePictureSizesSetSaysWhatTheFormatCannotDraw": "broken by hand on 2026-11-17 two ways (the placeholder let " +
- "through for a format without one, the sizes left out not said): red both times, the first by naming the " +
- "wrong setting to change.",
- "TestThePresetScreenBuildsThePictureSizesTheCommandLineBuilds": "asserts the count of pictures it compared, and " +
- "broken by hand on 2026-11-17 by the preset screen not sending its menu: red, the pictures differ.",
- "TestARefusalWithNoBoxNamesItsSettingsByTheirLabels": "broken by hand on 2026-11-17 by giving the foot of the form " +
- "no name to put in: red in English (the two keys) and in Polish (the empty place) alike.",
- "TestTheWindowSaysASwitchAsOnOrOff": "a canary of its own - the line it was written against, Guides true, has to be " +
- "found - a floor on how many switches are asked, and broken by hand on 2026-11-17 three ways (the folded line, " +
- "the explanation saying true or false, the explanation naming the wrong start): red every time.",
- "TestTheSizeSwitchAndTheSizeBoxNeverSayDifferentThings": "a refusal at the size box asked before the acceptance, so the " +
- "preview is known to be able to refuse, and broken by hand on 2026-11-17 four ways - typing smallest leaving the switch, " +
- "choosing Smallest writing nothing, leaving Smallest putting nothing back, a switch losing its choice saying nothing: red " +
- "each time.",
- "TestATruncatedTextSaysHowMuchWasCut": "broken on 2026-11-12 twice: Request.LabelSized ignoring OnDisk, and leaving the damage out. Red both times.",
- "TestALongDamageLabelLeavesEveryFormatWhole": "broken on 2026-11-12 by letting damage.Chain.Label return the whole chain past LabelLimit: red, " +
- "its own reach check says forty damages no longer fit the limit (docs/REVIEW-234-2026-11-12.md).",
- "TestEveryAvifRungStillFitsInsideItsDeclaredCeilings": "its own reach check - no damaged label drawn is a failure - and broken on 2026-11-12 twice, with " +
- "the heaviest seeds: the first ceiling of 640x480 set back to 16389 (red, 17314 B) and the second to 18722 (red, 20024 B). " +
- "Without those seeds both stayed green (docs/REVIEW-234-2026-11-12.md).",
- "TestEveryFormatsMapIsTheOneItsStructureReadsBack": "its own canaries - the first boundary moved by a byte must not pass, a mark for bytes already written must be " +
- "reported, a sweep with no padding or with no padding on both sides of a content is a failure - and broken on 2026-11-12 by marking the png " +
- "padding a byte late: red, and by marking the picture of a png laid out for a cut a byte late: red at 8 KiB and at 64 KiB.",
- "TestACutFileSaysWhereTheCutFellAndWhatIsLeft": "its own canary - a cut named in the wrong role, and content claimed gone that is there, must not pass - " +
- "and broken on 2026-11-12 by reporting every cut in the content: red for the picture and the icon.",
- "TestATarGzLaidOutForACutComesToEverySizeAndReads": "its own canary - a stream built by hand, one and then two empty blocks of " +
- "fixed codes, must inflate to its bytes and read as those runs - its reach check, every frame of the marker met - and red on " +
- "2026-11-13 for a frame a byte short (the plan refuses at 65541 B) and for an empty block's BTYPE bit one place off " +
- "(compress/flate refuses at 65537 B), where the first passed the share and the map guards.",
- "TestAJPEGXLKeepsNothingBehindItsCodestream": "its own canary - the same file with an empty box behind its " +
- "codestream must be refused - and red on 2026-11-13 with the padding of a file nothing cuts put back behind the " +
- "codestream (all 8 sizes).",
- "TestAnAVIFOrAJPEGXLLaidOutForACutComesToEverySizeAndReads": "its own canary - an item location a byte off must be " +
- "refused - its reach check, every layout of the split met, and red on 2026-11-13 with the item locations not moved " +
- "(50 cuts), with the widening's four bytes left out of the move (5 GiB: 4831825054 where the media data starts at " +
- "4831825058), with a side of padding allowed below a box (4000 B came to 4007 B) and with a free box rather than a " +
- "skip box in front of a JPEG XL's codestream (81 cuts).",
- "TestAnMP4OrAWebMLaidOutForACutComesToEverySizeAndPlays": "its own canary - a chunk place a byte off must be refused " +
- "- its reach check, every layout of the split met, and red on 2026-11-13 with stco not counting the free boxes in " +
- "front of the media data (sample 1 not the bytes of the film nothing cuts), with the Cues not moved by the Void in " +
- "front of the clusters (a cue giving 226 where no cluster starts), with a side of a WebM's padding allowed below a " +
- "Void (16000 B came to 16008 B), with an MP4 that never widens to co64 (5 GiB: no co64 in the head) and with the " +
- "widening's growth left out of the head the share is counted from (40 B more in front than the share).",
- "TestABMPATIFFOrAWebPLaidOutForACutComesToEverySizeAndKeepsItsPixels": "its own canaries - a TIFF's StripOffsets and " +
- "a BMP's bfOffBits a byte off must be refused - its reach check, every layout of the split met, and red on " +
- "2026-11-14 with a WebP that never splits (nothing in front where the share wants 1 B), a TIFF that never splits " +
- "(the directory at 12, not behind the header), a WebP front not rounded to an even chunk (16000 B came to 16001 B), " +
- "a TIFF StripOffsets that leaves out the directory's values (the pixels given at 158, written at 180) and a BMP " +
- "whose padding behind the pixels is not written (59 B came to 58 B).",
- "TestAPDFLaidOutForACutComesToEverySizeAndItsOffsetsLand": "its own canaries - a table that sends one object a byte off " +
- "must be refused, and the layout of a document nothing cuts must fail a cut at its half - its reach check, every " +
- "layout of the split met, red on 2026-11-13 with nothing in front of a document under 400 B of padding (398 sizes, " +
- "where the guard before the review passed), and red without the candidate of a " +
- "byte more in front (that layout never met), with the length of startxref taken before the padding moved it (10212 B " +
- "came to 10213 B) and without the stop at ten digits (20 GiB, objects ending at 19327353153).",
- "TestATarGzCutNearItsSmallestComesToEverySize": "its reach check - the frame met, and without a label the size after its floor " +
- "that keeps the layout of an archive nothing cuts, which with a label is due never - and red on 2026-11-13 without the " +
- "case of one byte over the floor (an internal defect at 9757 B) and with that case taken for a label too (label true).",
- "TestACutAtTheSmallestSizeSaysHowLongTheContentWas": "its own canaries - a cut that does not state the content's length, and one stating a " +
- "byte less than the map runs, must not pass - its reach check - the ZIP packages at their smallest have no padding in front and are cut " +
- "in the content - and red on 2026-11-13 before the Office packages marked their parts with a length without a padding part in front: " +
- "docx at 610 B, xlsx at 863 B, pptx at 2405 B.",
- "TestACutTakesTheShareOfTheContentItIsAskedFor": "its own canaries - a cut that kept all its content must not pass for one that took half, and txt listed as " +
- "not cutting at the share must be reported - and broken on 2026-11-12 by never telling png where its cut falls: red in all six of its files.",
- "TestAGuardThatDrawsAfterALongPauseStillDraws": "its own canary - the box drawn after test.NewApp alone has to come out blank, or the pause " +
- "does not reach the state - and broken on 2026-11-12 by making readFyneClock do nothing: red, the box drawn after newTestApp was blank too.",
- "TestEveryGuardTakesItsApplicationWithTheClockRead": "its own canary - a source with test.NewApp and test.NewTempApp has to give both calls - and " +
- "a reach check on the number of guard files it read.",
- "TestTheRecordOfACutRunIsNeverLongerThanItsForecast": "its own reach check - a run with no cut in the padding is a failure - and broken on 2026-11-12 " +
- "by leaving the cut out of the forecast: red, a record of 9638 B told 8130 B.",
- "TestADamageLabelIsBoundedAndSaysHowManyItLeftOut": "its own canary - no chain up to 200 damages shortened is a failure - and broken on 2026-11-12 by letting damage.Chain.Label return the whole chain: red.",
- "TestADamagedMailCarriesItsLabelWholeInEveryTextEncoding": "broken on 2026-11-12 twice: eml writing the label raw in quoted-printable (red, the one damage label read back as bytesd), " +
- "and eml leaving a long label on one line (red, a line of 92 characters).",
- "TestEveryCharacterOfADamagedLabelCanBeDrawn": "its own canary - a character the font never had must not count as drawn - and broken on 2026-11-12 by taking = out of the picture font: red.",
- // What breaks it lives in a module, not in a file of this repository, so
- // no mutation of this tree reaches it - the dependency it was written
- // against is the break.
- "TestAnAVIFLargerThanOneAV1TileSurvivesItsReferenceTool": "broken on 2026-11-11 by gav1d v0.2.5, go.mod as it stood before v0.2.6: both pictures went red saying tile_start_and_end_present_flag is set in an OBU_FRAME, " +
- "the tile_info of several tiles read over the data of one. With v0.2.6 both read back as 2 tiles, gav1d's decoder read them whole and Pillow accepted them (docs/GAV1D-026-2026-11-11.md).",
- // Their canaries run inside them on every machine with python, which is
- // the proof the owner asked for first on 2026-11-11: a check that cannot
- // fail turns them red where they stand, with no entry to rewrite when the
- // code moves.
- "TestTheOTLPCheckRefusesMetricsThatDoNotAddUp": "its own canaries: six files of metrics broken one way each - a temporality, the empty negative buckets, a bucket, a date, a counter that falls, exemplars nobody asked for - " +
- "each refused with the reason that names it, beside two healthy files that pass. On 2026-11-11 one canary was refused for another reason and the guard went red, which is how it found that a count one more never reaches the check of the buckets.",
- "TestTheExponentialBucketsEndWhereTheirBoundsSay": "its own canary: the table with one entry a microsecond high and then a microsecond low, each refused at that entry alone, before the table itself is asked.",
- "TestEveryOTLPPitfallMeetsItsReferenceTool": "its own canary: a file of ids in capitals handed to the oracle as ids in base64, which the Collector reads whole where it was told to expect nothing back, and the oracle has to refuse it. " +
- "On 2026-11-11 the guard passed with the Collector 0.165.0 on Windows over 34 files, every pitfall in every kind of telemetry, in 124 s.",
- // Runs only in the CI job that has the Collector, so a mutation job without
- // one would meet a skip. What the guard adds to the structural check is the
- // oracle itself, and the oracle was handed three files it has to refuse.
- "TestEveryOTLPSettingSurvivesItsReferenceTool": "broken on 2026-11-11 by its input, through the same script in Docker with the Collector 0.165.0 (tools/probes/otlp/oracle-in-docker.py): a span with no status member, an enum written as its name and a line of 2 MiB. " +
- "The oracle said the first two came back different at the byte where the Collector writes its own spelling, and that 0 of 1 batches came back for the third. Three healthy files passed beside them.",
- // Reached only where the filesystem folds case and still keeps STRASSE.txt
- // apart from a sharp s spelling - NTFS does, the Linux the mutation job runs
- // on keeps every case apart and APFS joins the pair, so no CI mutation of
- // the branch can redden it.
- "TestARefusalNamesTheFileThatIsReallyInTheWay": "broken by hand on Windows on 2026-10-27: os.SameFile(here, there) in listing.holds (preflight.go) turned into os.SameFile(there, there), so the first spelling of a fold is named. " +
- "The guard went red saying the refusal named STRASSE.txt, and the file was put back and checked with md5sum -c.",
- // Three guards each held by two layers, so no single substitution can redden
- // them and each mutation of one layer scored a HOLE in the CI run of
- // 2026-10-15. Broken that day in a worker tree, one layer at a time and then
- // both: green, green, red, for all three.
- "TestAShortcutCannotStartASecondRunDuringTheFirst": "broken on 2026-10-15 in two places at once: the check on the button in pressIfLive (runactions.go) and the refusal of onGenerate while the state is occupied (run.go, since 2026-09-21). " +
- "With either one taken away alone the guard stayed green, because the other refused the second run. With both gone it went red saying the screen reports a run that wrote nothing, which is the second one.",
- "TestAFieldWiredBeforeTheScreenListensReportsOnce": "broken on 2026-10-15 in two places at once: WhenTypedIn walking the fields it already has, and chainOnce chaining again rather than pointing the one handler it put in (both in parts/fields.go). " +
- "With either alone the guard stayed green - a second wiring is pointed rather than chained, and without the walk nothing wires twice. With both it went red: typing into one box told the screen 2 times.",
- "TestEveryPresetRendersARecipeThatParsesBack": "broken on 2026-10-15 in two places at once: the whitelist in checkDistance (preset/sizeboundaries.go) and the refusal in recipe.Compose of a character a recipe cannot hold (refuseUnwritable). " +
- "With either alone the guard stayed green, 154 values tried. With both it went red: size-boundaries accepted spread=\"1\\rB\" and produced source the parser refuses. " +
- "The whitelist's other job, a space reaching a file name, is the mutation on TestEveryPresetEndingHasTheCodeItShould.",
- "TestARefusalShowsANameNobodyCanReadAsAnEscape": "broken on 2026-10-15 in three places at once: the escape of the two names in the refusal of a case collision (engine/names.go), the escape of the path in the refusal of a taken name (engine/errors.go), and the escape of the whole message on its way out of the command line (describeError in cli/errors.go). " +
- "With any one of them gone the guard stayed green, because the line is escaped either way. With all three it went red: the refusal of two names that collide printed U+200B raw. " +
- "The two escapes in the sentences are the mutations on TestTheWindowsWordsForARefusalShowANameNobodyCanReadAsAnEscape, where the window has no funnel to cover them.",
- "TestAFolderThatCannotBeListedIsRefusedWholeAndVerifyStillStopsAtIt": "broken on 2026-09-30 in a Linux container (golang:1.27-alpine, the repository read only, an ordinary user), through the command line rather than through this test, which cannot build there without the window's libraries. " +
- "With internal/audit/walk.go as it is, verify of a run with a folder nobody may list ended with 5 naming it. With the three lines that hand verify the first unreadable folder removed - the overlay put the mutated file in place - the same verify ended with 0 and said the directory matches. " +
- "A probe rather than a mutation entry because this guard skips on Windows, where the runner runs, and would score NOT CAUGHT about a healthy guard.",
- "TestAWalkStoppedHalfWayHandsBackNothingItFound": "broken on 2026-10-05 in the same kind of container (golang:1.27-alpine, the repository read only, user 1000), through a program that does what this guard does - the folder a locked, b/y after it, a whole walk to count its looks, then a walk cancelled at the last look. " +
- "With internal/audit/walk.go as it is, the cancelled walk handed back nothing it had found. With the three lines that turn a stopped walk into an empty Found replaced by \"return found, err\" - the overlay put the mutated file in place - it handed back the folder it could not list, which is what this guard reads as red. " +
- "A probe rather than a mutation entry for the reason the guard above is one.",
- "TestThePackageSourcesAreTrackedByGit": "broken by hand on 2026-09-25 and put back: git rm --cached on packaging/chocolatey/tools/chocolateyuninstall.window.ps1.in made it red, naming that file, and git add made it green again. " +
- "A probe rather than a mutation entry because what it reads is git's index, not the text of a file - no substitution in any file untracks one.",
- "TestAManifestCarryingACredentialIsWrittenForItsOwner": "broken by hand on 2026-09-06 and put back, because the mutation is expressible and the OBSERVATION is not - Windows has no permission bits, Go maps only the owner write bit onto its read only attribute, and this machine is the one the mutation runner runs on. Changed internal/manifest mode() from 0o600 to 0o666, cross compiled the guard binary for linux/amd64 and ran it in a debian container against the real repository: red, naming the case - \"a manifest with a password came out 0644 and should be 0600\" - while the two cases that must stay 0644 stayed green. A probe rather than a mutation entry because a runner on Windows would score this NOT CAUGHT about a healthy guard, which is the worst answer of the three. The half of this pair that runs everywhere is TestTheRecordAndTheRegistryAgreeOnWhatIsACredential, and that one has a mutation.",
- "TestTheEncoderSurvivesTheSizeThatCrashedItsAssembly": "proved by tools/probes/avifasm on 2026-08-29, which is the sweep that found the fault in the first place. Run with the assembly, a 640x256 picture killed the process inside cflAcMain8AVX2 at av1/cfl_amd64.s:281 with an access violation - in two runs out of three, so it turns on what the heap looks like rather than on the input alone. One size out of 240 crashed. Run with the tag this project ships, 240 out of 240 encoded and the bytes were identical either way. A probe rather than a mutation entry because what would have to be broken is a BUILD FLAG, not a line of code: the substitution that removes the tag lives in .github/build-tags, and a run without it does not fail this guard, it takes the whole test binary down with it. That is loud, and it is the honest shape for a guard against memory read outside its buffer, but it is not something the runner can score.",
- "TestTheIconMacOSReadsCarriesEverySizeItIsAskedFor": "broken by hand on 2026-08-28, three ways, and put back byte for byte - the file is untracked in git, so the restore was checked by hash rather than by a clean diff. " +
- "Cutting the icp4 chunk out made it red naming that entry and the 16 px it holds, which is the failure that matters most: the file still opens, still shows an icon, and is missing the size a screen without Retina asks for. " +
- "Resizing the 1024 px picture to 900 made it red as well, which is what an upscale from the wrong master would look like. " +
- "Lying in the length field of the header made it red a third time, and that is the one a viewer would forgive and a reader that trusts the header would not. " +
- "A probe rather than a mutation entry because what it reads is a committed BINARY asset, not code: no substitution in a .go or .py file changes those bytes, " +
- "and the script that writes them - tools/appicon.py - is not run in CI at all, so mutating it would leave this guard green while proving nothing. " +
- "Apple's own iconutil was asked the same question on a real Mac on the day this went in and handed back all ten entries at these pixel sizes, " +
- "which is the half of the answer that cannot be asked again on a machine without macOS.",
-
- "TestEveryScriptAWorkflowRunsDirectlyIsExecutable": "broken by hand on 2026-08-28, in both directions, and put back byte for byte. " +
- "git update-index --chmod=-x on .github/scripts/make_app_bundle.sh made it red, naming the file, the mode it found and the command that fixes it. " +
- "Putting the bit back made it green again. " +
- "A probe rather than a mutation entry because what it reads is not text: the thing that can be wrong is a FILE MODE recorded in the git index, " +
- "and entries in entries.py substitute one string for another inside a file, which never touches a mode. " +
- "Worth having at all because this failure is invisible on the machine it is written on - Windows has no such bit and git bash ignores it, " +
- "so the script looks fine, passes every guard that reads it as text, and the FIRST release build stops on it with exit 126. " +
- "That is not hypothetical: make_app_bundle.sh went in as 100644 and this guard is what found it.",
-
- "TestEveryFakeHostComesFromTheConstructorThatJoinsIt": "broken by hand on 2026-08-27, in both directions it can fail, and put back byte for byte. " +
- "Turning one newFakeHost(t) in tabstrip_test.go back into the literal made it red, naming the file and the line. " +
- "The other direction matters more and was checked first: written as a plain constant, the search string in this guard is itself a hand built host, " +
- "and the guard reported ITSELF on its first run - so it is assembled from two pieces, which keeps its own file under the same rule as the rest. " +
- "It also refuses to pass when the literal appears nowhere at all, because a search that finds nothing reads exactly like a search that finds nothing wrong. " +
- "A probe rather than a mutation entry because there is no product code underneath: it reads the test files of this package, " +
- "so a substitution in a shipped .go file never reaches it.",
-
- "TestTheSummaryFitsItsCeilingAndHoldsNoState": "broken by hand on 2026-09-21 in all five directions it can fail - a dated STAN NA block in CLAUDE.md, a promised heading gone, " +
- "2 KB past the ceiling, STATE.md with a second \"Gdzie jestesmy\", STATE.md past its ceiling - red each time, green with the files put back byte for byte (cmp). " +
- "A probe rather than a mutation entry because there is no product code underneath: it reads CLAUDE.md and docs/STATE.md, neither of which is in the repository.",
-
- "TestEveryGuardCitedInTheSummaryIsJustifiedInRegression": "broken by hand on 2026-08-26, in all three directions it can fail, and put back byte for byte through the checked restore in tools/mutate/runner.py. " +
- "Taking keyboard_test.go off notYetJustified made it red, because CLAUDE.md cites that guard and REGRESSION.md still says nothing about it. " +
- "Adding verify_test.go to the list made it red the other way, which is the direction that matters most: a list nobody prunes is where this drift would hide next. " +
- "Naming a guard that does not exist made it red as well. Green again after each, and the run before them all was green, so none of the three was red for a reason that was already there. " +
- "A probe rather than a mutation entry because there is no product code underneath: it reads docs/REGRESSION.md (both halves of it since 2026-09-21), which is not in the repository, " +
- "so a substitution in a .go file never reaches it.",
-
- "TestARunIsStoppableFromTheMomentItStarts": "checked 2026-08-23 and again 2026-11-04 with tools/probes/run-stop-order.py, which reproduces the original defect faithfully: it moves the assignment of the handle " +
- "(r.stop then, r.work since the work got a type of its own) to after the goroutine that writes the files, builds, and runs the guard. Reported CAUGHT both times, and the file was restored. " +
- "A probe rather than a mutation entry because the defect is a MOVE of a statement past the goroutine, not a substitution of one piece of text for another, " +
- "and the entries in entries.py have to be literals. Deleting the handle would compile since 2026-11-04 and would only prove that it is assigned, not where.",
-
- "TestTheTaskbarIconIsTheSameDrawingAsTheWindowIcon": "checked 2026-08-13 with tools/probes/exe-icon.ps1, run on both binaries. " +
- "It reported 7 of 7 icon images inside tfg-gui.exe and 0 of 7 inside tfg.exe, which is the right answer for a command line with no window. " +
- "The defect it was written for was reported from a real taskbar the same day: app.SetIcon was in place and working, the window wore our chickpea, " +
- "and the taskbar wore the placeholder Windows draws for a binary with no icon resource - because that one is compiled into the exe and had never been. " +
- "Every guard was green because every guard was asking the toolkit. " +
- "A probe rather than a mutation because what this guard reads is three committed binary artefacts, and there is no product code beneath it " +
- "for a substitution in a .go file to break. The staleness it really watches for - a redraw that regenerates the PNG and forgets the ICO - " +
- "was confirmed by hand: emptying the ICO makes it red, and so does leaving an older .syso in place.",
-
- "TestReplacingAFileKeepsTheModeItHad": "checked 2026-08-12 with tools/probes/atomic-replace, run on Windows and on Linux through WSL2. " +
- "The version this replaced wrote the temporary copy with 0644 and renamed it over the original, and a rename moves the file it renames - " +
- "so a recipe somebody had made private at 0600 came back at 0644, readable by everyone on the machine. Measured on Linux, on the code that was shipping. " +
- "It cannot be a mutation entry because the guard SKIPS on Windows, which is where the mutation runner lives: Windows has no permission bits, " +
- "so the question cannot be put there at all and a substitution would be reported NOT CAUGHT for a guard that is working. " +
- "The probe is the honest instrument here, because it is the one that can be run where the answer exists.",
-
- "TestNoNumberATestPrintsIsCopiedIntoTheProse": "checked 2026-08-05 by planting a document in docs/ carrying one bad number per rule - " +
- "a D1 parity pair, an identifier count, a link count, a mutation breakdown in three spellings, a guard count and a coverage figure. " +
- "All eight were named, and deleting the file put the run back to green. " +
- "A probe rather than a mutation because what this guard reads is prose, not product code, so there is nothing beneath it for a substitution to break - " +
- "and breaking the guard itself would be mutating the judge. " +
- "The first probe also earned its keep: six planted numbers, only three caught, because the patterns wanted Polish diacritics " +
- "and these documents carry passages typed without them. The patterns now accept both.",
-
- "TestNothingIsQuietlyCreepingTowardsTheCeiling": "checked 2026-08-05 by hand. A function of seventy lines of code was dropped into internal/core, the count went from eleven to twelve against a cap of eleven, and the guard went red naming it. Removing the file put it back to green. It cannot be a mutation entry because the break is sixty extra lines rather than one substitution, and a mutation aimed at a function that happens to sit just under the threshold today would go stale at the first refactor that moves it.",
-
- "TestEveryTextFormatIsValidUTF8": "checked 2026-08-02 with tools/probes/probe-utf8-filler.py, which swaps in a vocabulary of Polish words and sweeps 304 sizes. " +
- "Before core.AppendFiller cut on a character boundary: 304 files, every one the right size, 86 of them carrying invalid UTF-8. After: 0. " +
- "It was a mutation until the fix landed, and the runner then reported it NOT CAUGHT - which is the fix being proven rather than a hole. " +
- "Breaking this guard now needs two changes at once, a non ASCII vocabulary and a byte cut, and that is not one substitution.",
-
- "TestNoFunctionOrFileHasGrownPastWhatAPersonCanFollow": "checked 2026-08-02 three ways, with tools/probes/probe-shape.py: a function grown past 80 lines of code went red, " +
- "a file grown past 550 went red, and the same function padded with 90 lines of COMMENT stayed green - so the ceiling is on code and not on explaining. " +
- "A probe rather than a mutation because the substitution is ninety lines long and the entries in entries.py have to be literals.",
-
- "TestEveryIdentifierAReferencePointsAtExists": "checked 2026-08-01 three ways: a reference to a decision that does not exist, " +
- "a number removed from the middle of a range, and the summary table in CLAUDE.md announcing a range the document no longer defines. All three went red.",
-
- "TestEveryGuardIsEitherProvenByMutationOrListedAsNotProven": "checked 2026-08-01 three ways: a guard added with neither a mutation nor an entry, " +
- "an entry naming a guard that was renamed away, and a guard left on the list after it gained a mutation. All three went red. " +
- "And 2026-10-14 (review of #185): the name read between two quote classes again, with an empty group kept for the second " +
- "capture. Red with the canary's own message. Not a mutation entry, because on the machine with tools/ this guard was " +
- "red that day before anything was broken, ten old findings, so a runner would have called any entry caught.",
-
- "TestEveryLinkBetweenDocumentsLeadsSomewhere": "checked 2026-08-01 by adding a link to a document that does not exist. It went red.",
-
- "TestTheObservationsAreNumberedOnceEach": "checked 2026-08-02 two ways: one number used twice, and a number cut out of the middle leaving a hole. " +
- "Both went red. Written the same day the rule it guards was broken - two rows were appended reusing 25 and 26, and nothing noticed.",
-
- "TestTheWindowBinaryDoesNotImportOpenGLAtLoadTime": "broken by hand on 2026-09-17 and put back byte for byte: the one line of the patched " +
- "Windows lookup in third_party/go-gl-gl/v2.1/gl/procaddr.go turned back into a direct call of wglGetProcAddress. " +
- "Red, naming opengl32.dll among the fifteen libraries the binary imported - resolved through the -lopengl32 the windowing " +
- "library links on the same line, which is the exact way the import would come back in practice. " +
- "A probe rather than a mutation entry because of what the runner would score, not because the substitution cannot be written: " +
- "the guard itself took 3.1 s, and the run took 3 min 56 s, because a change to the binding recompiles the binding, " +
- "the toolkit above it and the guard binary above that. The runner's ceiling is 120 s at one worker and 240 s at six, so every " +
- "entry touching that package would be CAPPED, which is neither caught nor a failure. The companion guard that CAN be scored, " +
- "TestTheOpenGLBindingIsThePinnedModulePlusExactlyThePatch, holds the copy to the published module plus the patch and has entries " +
- "that touch nothing the compiler reads.",
-}
-
var (
// A guard takes *testing.T. TestMain takes *testing.M and is how go test
// starts the package (guardpart_test.go), not a guard of anything.
diff --git a/internal/guard/provenbyprobe_test.go b/internal/guard/provenbyprobe_test.go
new file mode 100644
index 00000000..7ec47192
--- /dev/null
+++ b/internal/guard/provenbyprobe_test.go
@@ -0,0 +1,495 @@
+package guard
+
+// The list of guards proven by a canary or by a break made by hand, apart from
+// the guard that reads it (mutationcoverage_test.go), because the list grows
+// with every guard and the code that reads it does not - in one file it would
+// outgrow the cap on the length of a test file (testshape_test.go).
+
+// provenByProbe are the guards the mutation runner cannot express, broken on
+// purpose by hand instead. Each entry says what was broken and what happened.
+//
+// Three reasons a guard lands here, and they are different:
+//
+// - there is no product code underneath it. It reads documents and compares
+// lists, so a substitution in a .go file never reaches it.
+// - the substitution that would break it is not a literal. Entries in
+// entries.py are read with ast.literal_eval, so a break that needs ninety
+// generated lines cannot be written as one.
+// - untouchable rule 26, mutation sparingly, the owner's: a guard's
+// proof by default is a canary inside it, or a break made by hand once
+// while it was written, and a lasting entry is kept for a guard reading
+// the project's own files or guarding a user's data, network, secrets or
+// permissions - at most three to a piece of work. Every entry in that
+// state names its canary or its break, so the proof can be made again.
+//
+// A separate list rather than a note in the one above, because "unproven" and
+// "proven another way" are different states and lumping them together would
+// send a later session to re-prove what is already proven.
+var provenByProbe = map[string]string{
+ // Written on 2026-11-14 with the placeholder typeface and rasteriser
+ // (docs/PLACEHOLDER-2026-11-14.md section 13).
+ "TestThePlaceholderTypefaceIsInter": "its own canary - a Chinese letter must be reported missing - and red on 2026-11-14 the first " +
+ "time it ran, when it asked for kerning the font library never read (the pairs were taken out, not the check loosened).",
+ "TestARasterCoversWhatItsOutlineEncloses": "its own canary - the same square a pixel to the right must fail the comparison.",
+ "TestAPlaceholderIsTheSamePixelsOnEverySystem": "its own canary - a picture with one digit changed must hash differently - and " +
+ "the CI matrix draws it on three systems against one pinned hash.",
+ // The settings and smallest, the same day. Each carries its canary, and
+ // two were also broken once by hand and restored: an empty colour taken as
+ // left out turned the recipe guard red, and the walk to the smallest size
+ // stepping two bytes at a time turned the smallest guard red.
+ "TestAPlaceholderSettingRefusesWhatItCannotDraw": "its own canary - the accepted half of the table, which a Read refusing every value fails.",
+ "TestEachPlaceholderSaysItsOwnNumber": "it reads three different numbers off three planned files and the colour as the manifest spells it, " +
+ "so a text that skipped its tokens or a file that took another's number reads wrong.",
+ "TestSmallestIsTheSmallestFile": "two canaries of its own - a size a hundred bytes over the smallest, and the far side of the PNG " +
+ "band above it, must not pass as the smallest - red on 2026-11-14 when the walk was broken by hand to step two bytes at a " +
+ "time, and on 2026-11-16 when the check was cut back to the one byte below.",
+ "TestAFlattenedCurveStaysWithinASixteenthOfAPixel": "its own canary - the review's curve with one line fewer than the count " +
+ "must stray past a sixteenth of a pixel - and red on 2026-11-16 against a count taken from the larger coordinate, on a curve " +
+ "bent along a diagonal.",
+ "TestTheLineSaysASmallestPictureIsKnownAfterPreview": "its own canary - the same form at a stated size must say its total, so the " +
+ "line is this form's - and red on 2026-11-16 when the summary's smallest branch was switched off by hand: the line said 0 B.",
+ "TestSmallestSaysWhyItCannotBeAnswered": "its own canaries - the same picture with a width and height must be planned, and so must " +
+ "a damage the smallest file can hold, so each refusal is about smallest rather than about the picture or the damage.",
+ "TestAColourAfterAHashInARecipeIsNotLostInSilence": "its own canary - the same colour without the hash must run - and red on " +
+ "2026-11-14 when an empty colour was taken as left out by hand.",
+ "TestTheSeedSweepMovesEveryNumeralOfTheLabel": "it is the canary of the seed sweep beside it, and that sweep went red on " +
+ "2026-11-14 when the label of a placeholder drawing was put back as outlines by hand.",
+ // Broken once each on 2026-11-14 while they were written, one change at a
+ // time and restored (docs/RUN-FOLDERS-2026-11-14.md section 12). The sixth
+ // guard of the piece, TestANameAnEarlierRecordStillListsIsNotWrittenAgain,
+ // has an entry of its own: it holds the user's files (rule 26 b).
+ "TestARunThatTakesANumberLeavesTheEarlierRunAsItWas": "its own canary - a changed file and a missing one must both be named - " +
+ "and broken on 2026-11-14 by saving the record under the plain name: red.",
+ "TestTheNumberGoesWhereTheOwnerChose": "broken on 2026-11-14 by putting the number before the ending in every name: red, other_0001-2.txt.",
+ "TestARunIntoAFreeDirectoryKeepsItsNames": "broken on 2026-11-14 by giving an empty directory number 2: red.",
+ "TestANumberAnythingHoldsIsPassedOver": "broken on 2026-11-14 by no longer asking about the files of the plan: red, the run was refused on the held name.",
+ "TestTheInstructionsFollowTheNumberedManifest": "broken on 2026-11-14 by numbering the manifest alone when the record is saved: red, the instructions kept the plain name.",
+ "TestANameTheNumberMakesTooLongIsRefusedBeforeAnythingIsWritten": "broken on 2026-11-14 by dropping the refusal of the numbered name: red, the run went ahead.",
+ "TestTheCommandLineNumbersOnlyWhenTold": "its own control - the same second run without the flag must be refused - and broken on 2026-11-14 " +
+ "by leaving --number-if-taken unwired: red, the run with it ended 5.",
+ "TestTheSwitchBesideTheFolderDecidesWhatASecondRunDoesOnEveryScreen": "its own control - the same run with the switch off must be refused - " +
+ "and broken on 2026-11-14 by the batch screen not passing the switch to the run: red, no manifest-2.json.",
+ "TestTheSwitchTravelsAndIsRememberedWithTheFolder": "broken on 2026-11-14 three times: not carried to the next screen, not written down " +
+ "at the close, not given back at the start. Red each time.",
+ "TestARunNoteOpensWithACapitalUnlessItOpensWithAName": "broken on 2026-11-14 both ways: text.Line never giving a capital, and always " +
+ "giving one - red, files_0001.txt became Files_0001.txt (docs/REVIEW-246-2026-11-14.md).",
+ // Broken once each on 2026-11-14 while they were written, one change at a
+ // time and restored (docs/DRAG-DROP-2026-11-14.md section 13).
+ "TestEveryControlOfAFieldIsOffWhileARunOwnsTheScreen": "its own canary - a live button must be reported live - and red on 2026-11-14 " +
+ "before Fields.Freeze walked every control of a field: Choose... stood live beside the frozen output directory.",
+ "TestADropGoesWhereItsRulesSay": "its own canaries - three planted decisions (always the first box, busy ignored, the position " +
+ "asked when one box takes the kind) must each fail a row.",
+ "TestAFolderDroppedOnAWorkScreenBecomesItsOutputDirectory": "broken on 2026-11-14 three times: the drop sent to the first screen " +
+ "whatever was on show, the path kept with the toolkit's forward slashes, and SetText left out. Red each time.",
+ "TestADroppedPathComesBackOutOfTheToolkitAsItWent": "its own canary - the escaped address must not come back as the path.",
+ "TestADropOnTheToolsTabFollowsWhatTheChosenToolTakes": "broken on 2026-11-14 five times: the first screen whatever was on show, " +
+ "forward slashes kept, SetText left out, a file put into a folder box, and a refusal with no sentence. Red each time.",
+ "TestADropTheBoxCannotTakeSaysWhyAndChangesNothing": "broken on 2026-11-14 twice: a file put into a folder box, and a refusal " +
+ "with no sentence. Red both times.",
+ "TestADropWhileWorkOwnsTheScreenChangesNothing": "its own positive control - the same drop on an idle screen must say something - " +
+ "and broken on 2026-11-14 by handing the decision false for busy: red.",
+ "TestADropMadeDuringWorkStaysOutWhenTheDiskAnswersAfterIt": "its own positive control - the same drop on an idle screen must land - " +
+ "and broken on 2026-11-14 by taking out the busy check before the disk is asked: red (docs/REVIEW-245-2026-11-14.md).",
+ "TestAPathTypedWhileTheDiskIsAskedIsNotWrittenOver": "its own positive control - with nothing typed the drop must land - " +
+ "and broken on 2026-11-14 by no longer asking whether a path box was typed into: red (docs/REVIEW-245-2026-11-14.md).",
+ // Broken once each on 2026-11-12 while they were written, one change at a
+ // time and restored (docs/DAMAGE-SETTINGS-LABEL-2026-11-12.md). The first
+ // also carries a canary of its own check.
+ "TestEveryDamageSettingItsDeclarationForbidsIsRefusedWithoutARecipe": "its own canary - a plan that went through and a refusal about the first entry of the chain, both rejected by its check - and broken on 2026-11-12 " +
+ "by taking damage.Chain.Check out of engine.prepareDamage: red, every value went through.",
+ "TestADamageSettingOutsideItsRangeIsRefusedUnderItsBox": "broken on 2026-11-12 by taking damage.Chain.Check out of engine.prepareDamage: red, the window wrote the file and the box said nothing.",
+ "TestADamagedFileStatesItsSizeOnDiskAndItsDamage": "its own canary - the label it was written against, naming the size before the damage and no damage, rejected by its check - and broken on 2026-11-12 " +
+ "twice: Request.LabelSized ignoring OnDisk, and leaving the damage out. Red both times. A second canary for the label of a drawing, " +
+ "and broken on 2026-11-16 by leaving the damage out of Request.PictureLabel: red, the SVG did not carry it.",
+ // The label of a picture without its size (docs/SIZE-FIXES-2026-11-16.md section 3.1).
+ "TestAPictureIsTheSameWhateverSizeItIsAskedFor": "three canaries of its own - the same picture behind different padding, two pictures a byte apart, " +
+ "and two drawings whose labels differ - and red on 2026-11-16 in all fifteen of its cases on the code before the change, " +
+ "where the label drawn into a picture stated the size.",
+ "TestEveryFixUnderASizeRefusalLeadsToARunThatIsAccepted": "a canary of its own - the button as it was, the first file's minimum, " +
+ "has to be refused for a batch of three pictures - a reach check that some case is refused and some offers smallest, and " +
+ "broken by hand on 2026-11-16 three times: the batch walk off (every picture with its size set, pdf and a film red), only " +
+ "the number left at the first file's (batches of gif, jpg, png and mp4, and pdf, targz and wav red), and smallest never " +
+ "offered (every picture with its width and height set red).",
+ "TestSmallestWithTheLabelIsThePictureAlone": "a canary of its own - a hundred bytes over the smallest png has to fail - a " +
+ "reach check that some format drew its label, and broken by hand on 2026-11-16 by giving the picture label its size " +
+ "again: red, avif, gif, jpg and jxl among the first lines (O350).",
+ "TestBothButtonsUnderABatchOfSmallPicturesAreAcceptedInTheWindow": "broken by hand on 2026-11-16 by leaving the number at the " +
+ "first file's minimum: red, the preview refused 1573 B for three PNGs needing 1574 B. Broken again on 2026-11-17 by " +
+ "leaving the switch where it was when smallest is typed into the box: red, the switch read One size.",
+ "TestSmallestIsOfferedForExactlyTheFormatsTheEngineTakesItFor": "a canary of its own - a window offering smallest for every " +
+ "format has to disagree with the engine - a reach check that the engine both took and refused smallest, and broken by " +
+ "hand on 2026-11-17 by offering smallest for every format: red on both screens.",
+ "TestAPlanIsTheSameHoweverManyFilesArePlannedAtOnce": "a canary of its own - two plans of different seeds have to be " +
+ "told apart - a reach check that the pictures were planned beside each other and that each refusal case is refused, " +
+ "and broken by hand on 2026-11-18 three ways: answers put in the wrong place, the walk reading past a refusal and " +
+ "nothing ever planned beside anything: red each time.",
+ "TestThePicturesPlannedAtOnceHoldNoMoreThanTheMemorySettingLeaves": "a reach check of its own - with room to spare the " +
+ "pictures have to be seen planned beside each other - and broken by hand on 2026-11-18 by dropping the memory bound " +
+ "and by not planning the first file of a target alone: red both times.",
+ "TestANewBatchIsTheOneOpen": "a reach check of its own - the screen has to open with one open batch and the " +
+ "first batch has to be shut before it is opened again - and broken by hand on 2026-11-18 by taking out what " +
+ "foldAbove sets: red, every batch left open.",
+ "TestAPartRunsTheTestsItIsHandedAndNoOther": "three children of its own, one of them a refusal, each with a deadline - " +
+ "and broken by hand on 2026-11-18 by a TestMain that ignores the file: red after 90 s, the child ran the whole package " +
+ "from its first test. Broken by hand again that day by a TestMain that reads a relative path from the package's " +
+ "directory, as every part of the first run of the parts did: red, mine.txt cannot be read.",
+ "TestAVerdictPassesOnlyWhenEveryPartRanAndPassed": "a table of runs, the first of which has to pass, so the refusals " +
+ "are not the script refusing everything.",
+ "TestTheSiteWaitsForEveryJobOfCIButTheOnesOnMacOS": "a table of runs, the first two of which have to pass. Broken " +
+ "by hand on 2026-11-24 by reading every job as one on macOS: red on both.",
+ "TestTheLogOfAPartIsAFileGitIgnores": "a canary of its own - a name no rule ignores has to be found not ignored - " +
+ "and it asks that it reached the log of the test, race and coverage jobs. Broken by hand on 2026-11-18 by taking " +
+ "/part.log out of .gitignore: red in all three jobs.",
+ "TestAJobOnMacOSUsesOnlyWhatItsBashHas": "a table of canaries of its own - each construct in a job on macOS, in a " +
+ "script it names and in a local action it uses has to be found, the same on Linux and a comment have not to be - " +
+ "and it asks that it reached the test job of ci.yml and the script that job hands its part to.",
+ "TestAVerdictOfPartsRunsWhateverThePartsDid": "a canary of its own - the test job's verdict read with if: success() " +
+ "has to be found wrong.",
+ "TestEveryValueASettingTakesIsMarked": "a canary of its own - a choice with a default, none of them marked, has " +
+ "to give three faults - and it asks that it read 150 settings or more. Broken by hand on 2026-11-18 by a default " +
+ "left bare in Allowed: red.",
+ "TestTheHelpOfAFlagKeepsTheMarksOfItsValues": "a canary of its own - a usage printed by flag.PrintDefaults has to " +
+ "be found to lose its marks. Broken by hand on 2026-11-18 by generate printing its flags with PrintDefaults: red.",
+ "TestTheSmallestPictureIsEncodedOnceWhileItIsPlanned": "a canary of its own - a walk whose generator drops what the " +
+ "walk kept has to be caught in jpg and png. Broken by hand on 2026-11-18 by a walk that makes no Measured: red in " +
+ "all six formats that encode while planning.",
+ "TestAWalkThatRemembersWritesTheBytesOfOneThatMeasuresAgain": "it asks that it reached ten picture formats and three " +
+ "placeholders. Broken by hand on 2026-11-18 by a Measure that hands back what it kept for another key: red in the " +
+ "walk without a size of jpg, png, gif and ico.",
+ "TestWindowsHoldsTheTitleBarDarkOnceAsked": "a canary of its own - a window nobody asked about has to read as " +
+ "not dark before the asked one may read as dark - and a window of none has to be refused. What it cannot see, the " +
+ "look of the bar, was measured on Windows Server 2025 on 2026-11-18: 243 before, 32 after.",
+ "TestTheSampleFilesPageOffersAFileOfEveryFormat": "a canary of its own - a planted set missing a format and two " +
+ "sections, with an undamaged corrupt file, has to give every gap. Broken by hand on 2026-11-23 by taking the webp " +
+ "target out of web/samples/samples.yaml, and by taking the checksum-check line out of pages.yml: red both times.",
+ "TestTheToolVersionCheckReadsNpmInstallAsACommand": "a canary of its own - an npm install that names no version " +
+ "has to fail the check. Broken by hand on 2026-11-24 by reading npm install as any text holding the words again: " +
+ "red on the message in npm.yml that stopped the weekly runs of 2026-11-16 and 2026-11-23.",
+ "TestOneFailingToolVersionCheckLeavesTheOthersRunning": "its canary is the planted failure of the first check. " +
+ "Broken by hand on 2026-11-24 by ending the run at the first failure again: red, the pins after it unprinted.",
+ "TestTheSiteIsDeployedInAJobAfterTheUploadWithMoreThanOneTry": "two canaries of its own, the old layout and a retry " +
+ "reading the conclusion. Broken by hand on 2026-11-24 by main's pages.yml and by that retry: red both times.",
+ "TestTheCommandReferenceIsReadFromTheHelp": "a canary help of every shape it reads, and one it cannot. Broken by hand " +
+ "on 2026-11-24 by reading flags only after three spaces: red.",
+ "TestTheReferenceDescribesEveryKeyFieldAndRecipe": "a canary of an item without a sentence and a sentence without an " +
+ "item. Broken by hand on 2026-11-24 by taking files[].send_as out of the English reference: red.",
+ "TestEveryRecipeOfTheGalleryIsValidAndWritesToItsOwnFolder": "a canary recipe writing into another folder. Broken " +
+ "by hand on 2026-11-24 by pointing ci-smoke.yaml at ./out: red.",
+ "TestEveryLanguageLeadsToTheEnglishDocumentation": "the canary of the comparison it shares, and English pages must " +
+ "exist. Broken by hand on 2026-11-24 by taking one guide out of the Polish language file: red.",
+ "TestEveryHeldBackAdvisoryHasAnEndDateAndAReason": "a canary of its own - an entry without a date and one without " +
+ "a reason have to give two problems. Broken by hand on 2026-11-24 by taking one ignoreUntil out of the real file: red.",
+ "TestAReleaseCandidateIsSentNowhereButGitHub": "a canary of its own - a which step that sends whatever it is " +
+ "given has to fail the same cases. Broken by hand on 2026-11-23 by the npm.yml, pypi.yml and docker.yml of " +
+ "main before the change: red six times, each of the three sending a published release candidate and taking " +
+ "one by hand.",
+ "TestTheTitleBarIsAskedForAgainAfterEveryChangeOfSettings": "a canary of its own - an ask made straight from the " +
+ "listener, before the toolkit's answer, has to leave the bar light. Broken by hand on 2026-11-18 by " +
+ "KeepTitleBarDark without fyne.Do: red. On a real window that day a build without KeepTitleBarDark left the bar " +
+ "light after the desktop went to dark apps and back, attribute 0 and caption 243, where the build with it kept 1 and 32.",
+ "TestACaseWritingThroughALinkSkipsOnlyWhereTheHostRefusesAFreeName": "a table of its own, asked of " +
+ "requireNewNamesThroughLinkWith rather than of the predicate, as TestACaseBuiltOnALinkSkipsOnlyOffCI is. Broken by " +
+ "hand on 2026-11-18 by every refusal counted as the host's and by the host's refusal skipped on CI: red both times. " +
+ "A probe that left its name behind turned TestADirectoryReachedThroughALinkStillWorks red.",
+ "TestAMeasurementIsKeptForAnEqualKeyOnly": "a table whose first row has to be measured, so the rows after it are not " +
+ "a Measure that never measures. Broken by hand on 2026-11-18 with the key comparison taken out: red.",
+ "TestEveryMeasurementIsAFunctionOfItsKeyAlone": "a table of canaries of its own - a closure, a variable and a method " +
+ "value have to be found, a function of the package not - and it asks that it reached jpg and avif. Broken by hand " +
+ "on 2026-11-18 by a closure in jpg's chooseSize: red.",
+ "TestAGridAsksEveryPartOfAFieldForItsSizeOnce": "a canary of its own - a sentence behind a layout that asks it twice " +
+ "has to be found - every counted thing asked exactly once, so a field the grid never reached is red too, and run on " +
+ "2026-11-18 against the grid before the change: red, a field asked 5 times and a field in a group 15.",
+ "TestAValueToTypeIsTheSameInEveryLanguage": "a canary of its own - a translation that changed `all` into `wszystko` " +
+ "has to disagree - a reach check of how many marked texts the catalogues and the site carry, and broken by hand on " +
+ "2026-11-18 by changing one value in the Polish registry and by making no value ever a value: red both times.",
+ "TestEveryValueToTypeIsShownAsAValue": "a canary of its own - Prose of a marked text, drawing the backticks, has to be " +
+ "told apart - a reach check of the declared descriptions that name a value, and broken by hand on 2026-11-18 three " +
+ "ways: the explanation box drawing Prose, a value without the type of code, the published preset page without " +
+ ": red each time.",
+ "TestSmallestCannotBeChosenUntilTheWidthAndHeightAreSet": "a canary of its own - a switch holding Smallest for every picture " +
+ "has to disagree with the engine, which takes it for svg at its defaults - a reach check that the engine both took and " +
+ "refused it, and broken by hand on 2026-11-18 six ways: never held, a press choosing a held option, the keys stepping " +
+ "onto it, no reason under the pointer, the batch screen not following what is typed, the declared sides ignored - red " +
+ "each time (the press only after each way of reaching it was asked on its own: End stepped back off it).",
+ "TestAPlaceholderSettingIsOnTheScreenExactlyWhileItApplies": "the bad background is refused while it is shown, so the " +
+ "preview is known to reach the box, and broken by hand on 2026-11-17 four ways - every row always shown, a hidden value " +
+ "sent, the menu not wired to show the rows again, the heading never hidden: red each time.",
+ "TestASettingThatChangesNothingIsRefusedRatherThanIgnored": "a canary of its own - a png that drops background before " +
+ "planning has to be found silent - the same plan without the setting taken first, and broken by hand on 2026-11-17 by " +
+ "letting text through on the test pattern: red, png, jpg and svg.",
+ "TestARegistryRefusesAConditionItCannotKeep": "a canary of its own - a condition on a choice declared before it has to be " +
+ "taken - beside one declaration for each way a condition cannot be kept.",
+ "TestEveryNameWrittenByHandBelongsToADeclaredValue": "a canary of its own - a name for a value nothing declares has to be " +
+ "found - and a floor on how many names there are.",
+ "TestNoListShowsAValueSpelledAsARecipeKey": "a canary of its own - a list showing record-per-line as it is has to be found " +
+ "- and each standard token let through has to still be a declared value.",
+ "TestTheEnglishWindowShowsAListValueByItsName": "broken by hand on 2026-11-17 twice, ChoiceName saying the value and the " +
+ "folded summary saying the value: red both times. It reads the window, so a stale registry/en.json cannot hide either.",
+ "TestTheEnglishWindowRewordsOnlyNamesAndLabels": "a canary of its own - a planted sentence has to come out reworded, " +
+ "names and labels in and no quotes - a floor on the refusals and the names they carry, and broken by hand on " +
+ "2026-11-17 six ways (names, labels, a sentence inside, quotes, a wrapper at the foot, a join): red every time.",
+ "TestTheWindowSaysNoWordOfTheRecipe": "a canary of its own - a sentence made of the recipe's words has to be found " +
+ "to carry each kind, and a layout that dropped a value has to be told from one that keeps them - floors on the " +
+ "keys, the values and the refusals a window was asked about, and broken by hand on 2026-11-17 seven ways (no " +
+ "phrases, a sentence inside not laid out, a place of the recipe not reworded, the sentence itself not laid out, " +
+ "a phrase dropping a value, Polish saying a key, a listed sentence shown): red every time.",
+ "TestEveryScrollingAreaMovesAsFarAsTheSystemSays": "a canary of its own - the toolkit's bare scroll turned " +
+ "one notch has to be told apart from the system's distance - every screen asserted to have something below " +
+ "its fold, and broken by hand on 2026-11-17 three ways (the wheel left at the toolkit's step, a screen on " +
+ "the toolkit's own area, a whole view at a time ignored): red every time.",
+ "TestTheWheelStepIsTheToolkitsStep": "a canary of its own - a declared step of 31 has to be read as 31 - and " +
+ "broken by hand on 2026-11-17 by taking the toolkit's step for 20: red.",
+ "TestTheWheelLinesAreWhatWindowsIsSetTo": "a canary of its own - reg.exe's line for a setting of 7 has to read " +
+ "as 7 - and broken by hand on 2026-11-17 by reading the system's answer one too high: red.",
+ "TestEveryPictureOfTheSizesSetIsTheSizeItIsNamed": "a canary of its own - a picture named for another size has " +
+ "to be caught and one named for its own size let through - a floor on the pictures read back, and broken by " +
+ "hand on 2026-11-17 two ways (width and height swapped, a size with two uses made two files): red both times.",
+ "TestThePictureSizesSetSaysWhatTheFormatCannotDraw": "broken by hand on 2026-11-17 two ways (the placeholder let " +
+ "through for a format without one, the sizes left out not said): red both times, the first by naming the " +
+ "wrong setting to change.",
+ "TestThePresetScreenBuildsThePictureSizesTheCommandLineBuilds": "asserts the count of pictures it compared, and " +
+ "broken by hand on 2026-11-17 by the preset screen not sending its menu: red, the pictures differ.",
+ "TestARefusalWithNoBoxNamesItsSettingsByTheirLabels": "broken by hand on 2026-11-17 by giving the foot of the form " +
+ "no name to put in: red in English (the two keys) and in Polish (the empty place) alike.",
+ "TestTheWindowSaysASwitchAsOnOrOff": "a canary of its own - the line it was written against, Guides true, has to be " +
+ "found - a floor on how many switches are asked, and broken by hand on 2026-11-17 three ways (the folded line, " +
+ "the explanation saying true or false, the explanation naming the wrong start): red every time.",
+ "TestTheSizeSwitchAndTheSizeBoxNeverSayDifferentThings": "a refusal at the size box asked before the acceptance, so the " +
+ "preview is known to be able to refuse, and broken by hand on 2026-11-17 four ways - typing smallest leaving the switch, " +
+ "choosing Smallest writing nothing, leaving Smallest putting nothing back, a switch losing its choice saying nothing: red " +
+ "each time.",
+ "TestATruncatedTextSaysHowMuchWasCut": "broken on 2026-11-12 twice: Request.LabelSized ignoring OnDisk, and leaving the damage out. Red both times.",
+ "TestALongDamageLabelLeavesEveryFormatWhole": "broken on 2026-11-12 by letting damage.Chain.Label return the whole chain past LabelLimit: red, " +
+ "its own reach check says forty damages no longer fit the limit (docs/REVIEW-234-2026-11-12.md).",
+ "TestEveryAvifRungStillFitsInsideItsDeclaredCeilings": "its own reach check - no damaged label drawn is a failure - and broken on 2026-11-12 twice, with " +
+ "the heaviest seeds: the first ceiling of 640x480 set back to 16389 (red, 17314 B) and the second to 18722 (red, 20024 B). " +
+ "Without those seeds both stayed green (docs/REVIEW-234-2026-11-12.md).",
+ "TestEveryFormatsMapIsTheOneItsStructureReadsBack": "its own canaries - the first boundary moved by a byte must not pass, a mark for bytes already written must be " +
+ "reported, a sweep with no padding or with no padding on both sides of a content is a failure - and broken on 2026-11-12 by marking the png " +
+ "padding a byte late: red, and by marking the picture of a png laid out for a cut a byte late: red at 8 KiB and at 64 KiB.",
+ "TestACutFileSaysWhereTheCutFellAndWhatIsLeft": "its own canary - a cut named in the wrong role, and content claimed gone that is there, must not pass - " +
+ "and broken on 2026-11-12 by reporting every cut in the content: red for the picture and the icon.",
+ "TestATarGzLaidOutForACutComesToEverySizeAndReads": "its own canary - a stream built by hand, one and then two empty blocks of " +
+ "fixed codes, must inflate to its bytes and read as those runs - its reach check, every frame of the marker met - and red on " +
+ "2026-11-13 for a frame a byte short (the plan refuses at 65541 B) and for an empty block's BTYPE bit one place off " +
+ "(compress/flate refuses at 65537 B), where the first passed the share and the map guards.",
+ "TestAJPEGXLKeepsNothingBehindItsCodestream": "its own canary - the same file with an empty box behind its " +
+ "codestream must be refused - and red on 2026-11-13 with the padding of a file nothing cuts put back behind the " +
+ "codestream (all 8 sizes).",
+ "TestAnAVIFOrAJPEGXLLaidOutForACutComesToEverySizeAndReads": "its own canary - an item location a byte off must be " +
+ "refused - its reach check, every layout of the split met, and red on 2026-11-13 with the item locations not moved " +
+ "(50 cuts), with the widening's four bytes left out of the move (5 GiB: 4831825054 where the media data starts at " +
+ "4831825058), with a side of padding allowed below a box (4000 B came to 4007 B) and with a free box rather than a " +
+ "skip box in front of a JPEG XL's codestream (81 cuts).",
+ "TestAnMP4OrAWebMLaidOutForACutComesToEverySizeAndPlays": "its own canary - a chunk place a byte off must be refused " +
+ "- its reach check, every layout of the split met, and red on 2026-11-13 with stco not counting the free boxes in " +
+ "front of the media data (sample 1 not the bytes of the film nothing cuts), with the Cues not moved by the Void in " +
+ "front of the clusters (a cue giving 226 where no cluster starts), with a side of a WebM's padding allowed below a " +
+ "Void (16000 B came to 16008 B), with an MP4 that never widens to co64 (5 GiB: no co64 in the head) and with the " +
+ "widening's growth left out of the head the share is counted from (40 B more in front than the share).",
+ "TestABMPATIFFOrAWebPLaidOutForACutComesToEverySizeAndKeepsItsPixels": "its own canaries - a TIFF's StripOffsets and " +
+ "a BMP's bfOffBits a byte off must be refused - its reach check, every layout of the split met, and red on " +
+ "2026-11-14 with a WebP that never splits (nothing in front where the share wants 1 B), a TIFF that never splits " +
+ "(the directory at 12, not behind the header), a WebP front not rounded to an even chunk (16000 B came to 16001 B), " +
+ "a TIFF StripOffsets that leaves out the directory's values (the pixels given at 158, written at 180) and a BMP " +
+ "whose padding behind the pixels is not written (59 B came to 58 B).",
+ "TestAPDFLaidOutForACutComesToEverySizeAndItsOffsetsLand": "its own canaries - a table that sends one object a byte off " +
+ "must be refused, and the layout of a document nothing cuts must fail a cut at its half - its reach check, every " +
+ "layout of the split met, red on 2026-11-13 with nothing in front of a document under 400 B of padding (398 sizes, " +
+ "where the guard before the review passed), and red without the candidate of a " +
+ "byte more in front (that layout never met), with the length of startxref taken before the padding moved it (10212 B " +
+ "came to 10213 B) and without the stop at ten digits (20 GiB, objects ending at 19327353153).",
+ "TestATarGzCutNearItsSmallestComesToEverySize": "its reach check - the frame met, and without a label the size after its floor " +
+ "that keeps the layout of an archive nothing cuts, which with a label is due never - and red on 2026-11-13 without the " +
+ "case of one byte over the floor (an internal defect at 9757 B) and with that case taken for a label too (label true).",
+ "TestACutAtTheSmallestSizeSaysHowLongTheContentWas": "its own canaries - a cut that does not state the content's length, and one stating a " +
+ "byte less than the map runs, must not pass - its reach check - the ZIP packages at their smallest have no padding in front and are cut " +
+ "in the content - and red on 2026-11-13 before the Office packages marked their parts with a length without a padding part in front: " +
+ "docx at 610 B, xlsx at 863 B, pptx at 2405 B.",
+ "TestACutTakesTheShareOfTheContentItIsAskedFor": "its own canaries - a cut that kept all its content must not pass for one that took half, and txt listed as " +
+ "not cutting at the share must be reported - and broken on 2026-11-12 by never telling png where its cut falls: red in all six of its files.",
+ "TestAGuardThatDrawsAfterALongPauseStillDraws": "its own canary - the box drawn after test.NewApp alone has to come out blank, or the pause " +
+ "does not reach the state - and broken on 2026-11-12 by making readFyneClock do nothing: red, the box drawn after newTestApp was blank too.",
+ "TestEveryGuardTakesItsApplicationWithTheClockRead": "its own canary - a source with test.NewApp and test.NewTempApp has to give both calls - and " +
+ "a reach check on the number of guard files it read.",
+ "TestTheRecordOfACutRunIsNeverLongerThanItsForecast": "its own reach check - a run with no cut in the padding is a failure - and broken on 2026-11-12 " +
+ "by leaving the cut out of the forecast: red, a record of 9638 B told 8130 B.",
+ "TestADamageLabelIsBoundedAndSaysHowManyItLeftOut": "its own canary - no chain up to 200 damages shortened is a failure - and broken on 2026-11-12 by letting damage.Chain.Label return the whole chain: red.",
+ "TestADamagedMailCarriesItsLabelWholeInEveryTextEncoding": "broken on 2026-11-12 twice: eml writing the label raw in quoted-printable (red, the one damage label read back as bytesd), " +
+ "and eml leaving a long label on one line (red, a line of 92 characters).",
+ "TestEveryCharacterOfADamagedLabelCanBeDrawn": "its own canary - a character the font never had must not count as drawn - and broken on 2026-11-12 by taking = out of the picture font: red.",
+ // What breaks it lives in a module, not in a file of this repository, so
+ // no mutation of this tree reaches it - the dependency it was written
+ // against is the break.
+ "TestAnAVIFLargerThanOneAV1TileSurvivesItsReferenceTool": "broken on 2026-11-11 by gav1d v0.2.5, go.mod as it stood before v0.2.6: both pictures went red saying tile_start_and_end_present_flag is set in an OBU_FRAME, " +
+ "the tile_info of several tiles read over the data of one. With v0.2.6 both read back as 2 tiles, gav1d's decoder read them whole and Pillow accepted them (docs/GAV1D-026-2026-11-11.md).",
+ // Their canaries run inside them on every machine with python, which is
+ // the proof the owner asked for first on 2026-11-11: a check that cannot
+ // fail turns them red where they stand, with no entry to rewrite when the
+ // code moves.
+ "TestTheOTLPCheckRefusesMetricsThatDoNotAddUp": "its own canaries: six files of metrics broken one way each - a temporality, the empty negative buckets, a bucket, a date, a counter that falls, exemplars nobody asked for - " +
+ "each refused with the reason that names it, beside two healthy files that pass. On 2026-11-11 one canary was refused for another reason and the guard went red, which is how it found that a count one more never reaches the check of the buckets.",
+ "TestTheExponentialBucketsEndWhereTheirBoundsSay": "its own canary: the table with one entry a microsecond high and then a microsecond low, each refused at that entry alone, before the table itself is asked.",
+ "TestEveryOTLPPitfallMeetsItsReferenceTool": "its own canary: a file of ids in capitals handed to the oracle as ids in base64, which the Collector reads whole where it was told to expect nothing back, and the oracle has to refuse it. " +
+ "On 2026-11-11 the guard passed with the Collector 0.165.0 on Windows over 34 files, every pitfall in every kind of telemetry, in 124 s.",
+ // Runs only in the CI job that has the Collector, so a mutation job without
+ // one would meet a skip. What the guard adds to the structural check is the
+ // oracle itself, and the oracle was handed three files it has to refuse.
+ "TestEveryOTLPSettingSurvivesItsReferenceTool": "broken on 2026-11-11 by its input, through the same script in Docker with the Collector 0.165.0 (tools/probes/otlp/oracle-in-docker.py): a span with no status member, an enum written as its name and a line of 2 MiB. " +
+ "The oracle said the first two came back different at the byte where the Collector writes its own spelling, and that 0 of 1 batches came back for the third. Three healthy files passed beside them.",
+ // Reached only where the filesystem folds case and still keeps STRASSE.txt
+ // apart from a sharp s spelling - NTFS does, the Linux the mutation job runs
+ // on keeps every case apart and APFS joins the pair, so no CI mutation of
+ // the branch can redden it.
+ "TestARefusalNamesTheFileThatIsReallyInTheWay": "broken by hand on Windows on 2026-10-27: os.SameFile(here, there) in listing.holds (preflight.go) turned into os.SameFile(there, there), so the first spelling of a fold is named. " +
+ "The guard went red saying the refusal named STRASSE.txt, and the file was put back and checked with md5sum -c.",
+ // Three guards each held by two layers, so no single substitution can redden
+ // them and each mutation of one layer scored a HOLE in the CI run of
+ // 2026-10-15. Broken that day in a worker tree, one layer at a time and then
+ // both: green, green, red, for all three.
+ "TestAShortcutCannotStartASecondRunDuringTheFirst": "broken on 2026-10-15 in two places at once: the check on the button in pressIfLive (runactions.go) and the refusal of onGenerate while the state is occupied (run.go, since 2026-09-21). " +
+ "With either one taken away alone the guard stayed green, because the other refused the second run. With both gone it went red saying the screen reports a run that wrote nothing, which is the second one.",
+ "TestAFieldWiredBeforeTheScreenListensReportsOnce": "broken on 2026-10-15 in two places at once: WhenTypedIn walking the fields it already has, and chainOnce chaining again rather than pointing the one handler it put in (both in parts/fields.go). " +
+ "With either alone the guard stayed green - a second wiring is pointed rather than chained, and without the walk nothing wires twice. With both it went red: typing into one box told the screen 2 times.",
+ "TestEveryPresetRendersARecipeThatParsesBack": "broken on 2026-10-15 in two places at once: the whitelist in checkDistance (preset/sizeboundaries.go) and the refusal in recipe.Compose of a character a recipe cannot hold (refuseUnwritable). " +
+ "With either alone the guard stayed green, 154 values tried. With both it went red: size-boundaries accepted spread=\"1\\rB\" and produced source the parser refuses. " +
+ "The whitelist's other job, a space reaching a file name, is the mutation on TestEveryPresetEndingHasTheCodeItShould.",
+ "TestARefusalShowsANameNobodyCanReadAsAnEscape": "broken on 2026-10-15 in three places at once: the escape of the two names in the refusal of a case collision (engine/names.go), the escape of the path in the refusal of a taken name (engine/errors.go), and the escape of the whole message on its way out of the command line (describeError in cli/errors.go). " +
+ "With any one of them gone the guard stayed green, because the line is escaped either way. With all three it went red: the refusal of two names that collide printed U+200B raw. " +
+ "The two escapes in the sentences are the mutations on TestTheWindowsWordsForARefusalShowANameNobodyCanReadAsAnEscape, where the window has no funnel to cover them.",
+ "TestAFolderThatCannotBeListedIsRefusedWholeAndVerifyStillStopsAtIt": "broken on 2026-09-30 in a Linux container (golang:1.27-alpine, the repository read only, an ordinary user), through the command line rather than through this test, which cannot build there without the window's libraries. " +
+ "With internal/audit/walk.go as it is, verify of a run with a folder nobody may list ended with 5 naming it. With the three lines that hand verify the first unreadable folder removed - the overlay put the mutated file in place - the same verify ended with 0 and said the directory matches. " +
+ "A probe rather than a mutation entry because this guard skips on Windows, where the runner runs, and would score NOT CAUGHT about a healthy guard.",
+ "TestAWalkStoppedHalfWayHandsBackNothingItFound": "broken on 2026-10-05 in the same kind of container (golang:1.27-alpine, the repository read only, user 1000), through a program that does what this guard does - the folder a locked, b/y after it, a whole walk to count its looks, then a walk cancelled at the last look. " +
+ "With internal/audit/walk.go as it is, the cancelled walk handed back nothing it had found. With the three lines that turn a stopped walk into an empty Found replaced by \"return found, err\" - the overlay put the mutated file in place - it handed back the folder it could not list, which is what this guard reads as red. " +
+ "A probe rather than a mutation entry for the reason the guard above is one.",
+ "TestThePackageSourcesAreTrackedByGit": "broken by hand on 2026-09-25 and put back: git rm --cached on packaging/chocolatey/tools/chocolateyuninstall.window.ps1.in made it red, naming that file, and git add made it green again. " +
+ "A probe rather than a mutation entry because what it reads is git's index, not the text of a file - no substitution in any file untracks one.",
+ "TestAManifestCarryingACredentialIsWrittenForItsOwner": "broken by hand on 2026-09-06 and put back, because the mutation is expressible and the OBSERVATION is not - Windows has no permission bits, Go maps only the owner write bit onto its read only attribute, and this machine is the one the mutation runner runs on. Changed internal/manifest mode() from 0o600 to 0o666, cross compiled the guard binary for linux/amd64 and ran it in a debian container against the real repository: red, naming the case - \"a manifest with a password came out 0644 and should be 0600\" - while the two cases that must stay 0644 stayed green. A probe rather than a mutation entry because a runner on Windows would score this NOT CAUGHT about a healthy guard, which is the worst answer of the three. The half of this pair that runs everywhere is TestTheRecordAndTheRegistryAgreeOnWhatIsACredential, and that one has a mutation.",
+ "TestTheEncoderSurvivesTheSizeThatCrashedItsAssembly": "proved by tools/probes/avifasm on 2026-08-29, which is the sweep that found the fault in the first place. Run with the assembly, a 640x256 picture killed the process inside cflAcMain8AVX2 at av1/cfl_amd64.s:281 with an access violation - in two runs out of three, so it turns on what the heap looks like rather than on the input alone. One size out of 240 crashed. Run with the tag this project ships, 240 out of 240 encoded and the bytes were identical either way. A probe rather than a mutation entry because what would have to be broken is a BUILD FLAG, not a line of code: the substitution that removes the tag lives in .github/build-tags, and a run without it does not fail this guard, it takes the whole test binary down with it. That is loud, and it is the honest shape for a guard against memory read outside its buffer, but it is not something the runner can score.",
+ "TestTheIconMacOSReadsCarriesEverySizeItIsAskedFor": "broken by hand on 2026-08-28, three ways, and put back byte for byte - the file is untracked in git, so the restore was checked by hash rather than by a clean diff. " +
+ "Cutting the icp4 chunk out made it red naming that entry and the 16 px it holds, which is the failure that matters most: the file still opens, still shows an icon, and is missing the size a screen without Retina asks for. " +
+ "Resizing the 1024 px picture to 900 made it red as well, which is what an upscale from the wrong master would look like. " +
+ "Lying in the length field of the header made it red a third time, and that is the one a viewer would forgive and a reader that trusts the header would not. " +
+ "A probe rather than a mutation entry because what it reads is a committed BINARY asset, not code: no substitution in a .go or .py file changes those bytes, " +
+ "and the script that writes them - tools/appicon.py - is not run in CI at all, so mutating it would leave this guard green while proving nothing. " +
+ "Apple's own iconutil was asked the same question on a real Mac on the day this went in and handed back all ten entries at these pixel sizes, " +
+ "which is the half of the answer that cannot be asked again on a machine without macOS.",
+
+ "TestEveryScriptAWorkflowRunsDirectlyIsExecutable": "broken by hand on 2026-08-28, in both directions, and put back byte for byte. " +
+ "git update-index --chmod=-x on .github/scripts/make_app_bundle.sh made it red, naming the file, the mode it found and the command that fixes it. " +
+ "Putting the bit back made it green again. " +
+ "A probe rather than a mutation entry because what it reads is not text: the thing that can be wrong is a FILE MODE recorded in the git index, " +
+ "and entries in entries.py substitute one string for another inside a file, which never touches a mode. " +
+ "Worth having at all because this failure is invisible on the machine it is written on - Windows has no such bit and git bash ignores it, " +
+ "so the script looks fine, passes every guard that reads it as text, and the FIRST release build stops on it with exit 126. " +
+ "That is not hypothetical: make_app_bundle.sh went in as 100644 and this guard is what found it.",
+
+ "TestEveryFakeHostComesFromTheConstructorThatJoinsIt": "broken by hand on 2026-08-27, in both directions it can fail, and put back byte for byte. " +
+ "Turning one newFakeHost(t) in tabstrip_test.go back into the literal made it red, naming the file and the line. " +
+ "The other direction matters more and was checked first: written as a plain constant, the search string in this guard is itself a hand built host, " +
+ "and the guard reported ITSELF on its first run - so it is assembled from two pieces, which keeps its own file under the same rule as the rest. " +
+ "It also refuses to pass when the literal appears nowhere at all, because a search that finds nothing reads exactly like a search that finds nothing wrong. " +
+ "A probe rather than a mutation entry because there is no product code underneath: it reads the test files of this package, " +
+ "so a substitution in a shipped .go file never reaches it.",
+
+ "TestTheSummaryFitsItsCeilingAndHoldsNoState": "broken by hand on 2026-09-21 in all five directions it can fail - a dated STAN NA block in CLAUDE.md, a promised heading gone, " +
+ "2 KB past the ceiling, STATE.md with a second \"Gdzie jestesmy\", STATE.md past its ceiling - red each time, green with the files put back byte for byte (cmp). " +
+ "A probe rather than a mutation entry because there is no product code underneath: it reads CLAUDE.md and docs/STATE.md, neither of which is in the repository.",
+
+ "TestEveryGuardCitedInTheSummaryIsJustifiedInRegression": "broken by hand on 2026-08-26, in all three directions it can fail, and put back byte for byte through the checked restore in tools/mutate/runner.py. " +
+ "Taking keyboard_test.go off notYetJustified made it red, because CLAUDE.md cites that guard and REGRESSION.md still says nothing about it. " +
+ "Adding verify_test.go to the list made it red the other way, which is the direction that matters most: a list nobody prunes is where this drift would hide next. " +
+ "Naming a guard that does not exist made it red as well. Green again after each, and the run before them all was green, so none of the three was red for a reason that was already there. " +
+ "A probe rather than a mutation entry because there is no product code underneath: it reads docs/REGRESSION.md (both halves of it since 2026-09-21), which is not in the repository, " +
+ "so a substitution in a .go file never reaches it.",
+
+ "TestARunIsStoppableFromTheMomentItStarts": "checked 2026-08-23 and again 2026-11-04 with tools/probes/run-stop-order.py, which reproduces the original defect faithfully: it moves the assignment of the handle " +
+ "(r.stop then, r.work since the work got a type of its own) to after the goroutine that writes the files, builds, and runs the guard. Reported CAUGHT both times, and the file was restored. " +
+ "A probe rather than a mutation entry because the defect is a MOVE of a statement past the goroutine, not a substitution of one piece of text for another, " +
+ "and the entries in entries.py have to be literals. Deleting the handle would compile since 2026-11-04 and would only prove that it is assigned, not where.",
+
+ "TestTheTaskbarIconIsTheSameDrawingAsTheWindowIcon": "checked 2026-08-13 with tools/probes/exe-icon.ps1, run on both binaries. " +
+ "It reported 7 of 7 icon images inside tfg-gui.exe and 0 of 7 inside tfg.exe, which is the right answer for a command line with no window. " +
+ "The defect it was written for was reported from a real taskbar the same day: app.SetIcon was in place and working, the window wore our chickpea, " +
+ "and the taskbar wore the placeholder Windows draws for a binary with no icon resource - because that one is compiled into the exe and had never been. " +
+ "Every guard was green because every guard was asking the toolkit. " +
+ "A probe rather than a mutation because what this guard reads is three committed binary artefacts, and there is no product code beneath it " +
+ "for a substitution in a .go file to break. The staleness it really watches for - a redraw that regenerates the PNG and forgets the ICO - " +
+ "was confirmed by hand: emptying the ICO makes it red, and so does leaving an older .syso in place.",
+
+ "TestReplacingAFileKeepsTheModeItHad": "checked 2026-08-12 with tools/probes/atomic-replace, run on Windows and on Linux through WSL2. " +
+ "The version this replaced wrote the temporary copy with 0644 and renamed it over the original, and a rename moves the file it renames - " +
+ "so a recipe somebody had made private at 0600 came back at 0644, readable by everyone on the machine. Measured on Linux, on the code that was shipping. " +
+ "It cannot be a mutation entry because the guard SKIPS on Windows, which is where the mutation runner lives: Windows has no permission bits, " +
+ "so the question cannot be put there at all and a substitution would be reported NOT CAUGHT for a guard that is working. " +
+ "The probe is the honest instrument here, because it is the one that can be run where the answer exists.",
+
+ "TestNoNumberATestPrintsIsCopiedIntoTheProse": "checked 2026-08-05 by planting a document in docs/ carrying one bad number per rule - " +
+ "a D1 parity pair, an identifier count, a link count, a mutation breakdown in three spellings, a guard count and a coverage figure. " +
+ "All eight were named, and deleting the file put the run back to green. " +
+ "A probe rather than a mutation because what this guard reads is prose, not product code, so there is nothing beneath it for a substitution to break - " +
+ "and breaking the guard itself would be mutating the judge. " +
+ "The first probe also earned its keep: six planted numbers, only three caught, because the patterns wanted Polish diacritics " +
+ "and these documents carry passages typed without them. The patterns now accept both.",
+
+ "TestNothingIsQuietlyCreepingTowardsTheCeiling": "checked 2026-08-05 by hand. A function of seventy lines of code was dropped into internal/core, the count went from eleven to twelve against a cap of eleven, and the guard went red naming it. Removing the file put it back to green. It cannot be a mutation entry because the break is sixty extra lines rather than one substitution, and a mutation aimed at a function that happens to sit just under the threshold today would go stale at the first refactor that moves it.",
+
+ "TestEveryTextFormatIsValidUTF8": "checked 2026-08-02 with tools/probes/probe-utf8-filler.py, which swaps in a vocabulary of Polish words and sweeps 304 sizes. " +
+ "Before core.AppendFiller cut on a character boundary: 304 files, every one the right size, 86 of them carrying invalid UTF-8. After: 0. " +
+ "It was a mutation until the fix landed, and the runner then reported it NOT CAUGHT - which is the fix being proven rather than a hole. " +
+ "Breaking this guard now needs two changes at once, a non ASCII vocabulary and a byte cut, and that is not one substitution.",
+
+ "TestNoFunctionOrFileHasGrownPastWhatAPersonCanFollow": "checked 2026-08-02 three ways, with tools/probes/probe-shape.py: a function grown past 80 lines of code went red, " +
+ "a file grown past 550 went red, and the same function padded with 90 lines of COMMENT stayed green - so the ceiling is on code and not on explaining. " +
+ "A probe rather than a mutation because the substitution is ninety lines long and the entries in entries.py have to be literals.",
+
+ "TestEveryIdentifierAReferencePointsAtExists": "checked 2026-08-01 three ways: a reference to a decision that does not exist, " +
+ "a number removed from the middle of a range, and the summary table in CLAUDE.md announcing a range the document no longer defines. All three went red.",
+
+ "TestEveryGuardIsEitherProvenByMutationOrListedAsNotProven": "checked 2026-08-01 three ways: a guard added with neither a mutation nor an entry, " +
+ "an entry naming a guard that was renamed away, and a guard left on the list after it gained a mutation. All three went red. " +
+ "And 2026-10-14 (review of #185): the name read between two quote classes again, with an empty group kept for the second " +
+ "capture. Red with the canary's own message. Not a mutation entry, because on the machine with tools/ this guard was " +
+ "red that day before anything was broken, ten old findings, so a runner would have called any entry caught.",
+
+ "TestEveryLinkBetweenDocumentsLeadsSomewhere": "checked 2026-08-01 by adding a link to a document that does not exist. It went red.",
+
+ "TestTheObservationsAreNumberedOnceEach": "checked 2026-08-02 two ways: one number used twice, and a number cut out of the middle leaving a hole. " +
+ "Both went red. Written the same day the rule it guards was broken - two rows were appended reusing 25 and 26, and nothing noticed.",
+
+ "TestTheWindowBinaryDoesNotImportOpenGLAtLoadTime": "broken by hand on 2026-09-17 and put back byte for byte: the one line of the patched " +
+ "Windows lookup in third_party/go-gl-gl/v2.1/gl/procaddr.go turned back into a direct call of wglGetProcAddress. " +
+ "Red, naming opengl32.dll among the fifteen libraries the binary imported - resolved through the -lopengl32 the windowing " +
+ "library links on the same line, which is the exact way the import would come back in practice. " +
+ "A probe rather than a mutation entry because of what the runner would score, not because the substitution cannot be written: " +
+ "the guard itself took 3.1 s, and the run took 3 min 56 s, because a change to the binding recompiles the binding, " +
+ "the toolkit above it and the guard binary above that. The runner's ceiling is 120 s at one worker and 240 s at six, so every " +
+ "entry touching that package would be CAPPED, which is neither caught nor a failure. The companion guard that CAN be scored, " +
+ "TestTheOpenGLBindingIsThePinnedModulePlusExactlyThePatch, holds the copy to the published module plus the patch and has entries " +
+ "that touch nothing the compiler reads.",
+ // The Copy command button, 2026-11-25 (docs, the analysis of that day).
+ // Each was broken by hand once and restored, and the ones on real shells
+ // carry a canary of their own.
+ "TestACommandCopiedFromSingleBatchMakesTheFilesTheWindowMakes": "broken by hand on 2026-11-25 by taking the seed the form " +
+ "states as the command line's default, so the line left out --seed 42: red, the files differed.",
+ "TestACommandCopiedFromPresetsMakesTheFilesTheWindowMakes": "broken by hand on 2026-11-25 the same way on the Presets " +
+ "screen, the line leaving out --seed 7: red.",
+ "TestACommandCopiedFromToolsReadsTheFileTheBoxNames": "broken by hand on 2026-11-25 by leaving the file out of the line: " +
+ "red, the command refused. The checksum it asks for is worked out in the guard, not by the tool.",
+ "TestCopyCommandRefusesWhatGenerateRefusesAndCopiesNothing": "its own canary - the same form with the box put right must " +
+ "copy a line, so an empty clipboard is a refusal and not a press that reached nothing.",
+ "TestEveryValueReachesTheProgramAsItWasWritten": "its own canary - a line written badly on purpose, a bare -foo.txt in " +
+ "PowerShell and a bare $HOME in sh, must not arrive whole, and a line with an extra '' must arrive with the empty " +
+ "argument - and broken by hand on 2026-11-25 by no longer doubling the typographic quote U+2019: red in PowerShell 7, " +
+ "the quote closed the value and split the line. The empty argument canary was red with a reader that skipped empty lines.",
+ "TestACommandCopiedFromSeveralBatchesMakesTheFilesTheWindowMakes": "its own canary - the same script with quoting that " +
+ "expands must save something other than the recipe - and broken by hand on 2026-11-25 by leaving the seed out of the " +
+ "saved recipe: red in pwsh and powershell, the files differed. Also red with an emptied output folder no longer refused. " +
+ "Leaving -Encoding utf8 out stayed GREEN on this machine, whose code page is UTF-8 (65001), so 5.1 writes UTF-8 anyway.",
+ "TestTheLineStartsTfgTheWayThisComputerFindsIt": "its own canary in every case that finds tfg - the same machine without " +
+ "the file must find nothing.",
+ "TestAValueNoLineCanCarryIsRefusedUnderItsSetting": "every row requires a refusal of one kind under one setting, so a " +
+ "writer that refused nothing, or refused under another name, fails every row. The rows of a saved text were red on " +
+ "2026-11-25 with the check of the line that ends it switched off.",
+}
diff --git a/internal/guard/testdata/screens/catalogue.png b/internal/guard/testdata/screens/catalogue.png
index bbe8f934..a653caef 100644
Binary files a/internal/guard/testdata/screens/catalogue.png and b/internal/guard/testdata/screens/catalogue.png differ
diff --git a/internal/guard/testdata/screens/catalogue.xml b/internal/guard/testdata/screens/catalogue.xml
index 61ba5e06..277ac99a 100644
--- a/internal/guard/testdata/screens/catalogue.xml
+++ b/internal/guard/testdata/screens/catalogue.xml
@@ -1,7 +1,7 @@
-