Regenerate goldens
Overview
A few tests pin rendered output as hardcoded "golden" values — they exist to catch
unintended drift in the look. When you change the pipeline on purpose (a default, the
TRC, primaries, a curve), those snapshots go stale and must be re-baselined.
Core principle — this is the one thing to get right: only regenerate a golden when the
change that moved it was intentional. A failing golden after an unrelated edit is a
real regression — fix the code, do not bless the new numbers. Regenerating to silence a
surprise defeats the entire point of the test.
Which tests carry rendered goldens
tests/test_scene_linear_relocation.py — _GOLDEN: full-engine output (6 pixels ×
default / expo_dark / expo_cmy). Depends on the whole creative chain, so it shifts on
almost any look change: working TRC/primaries, print curve, lab/toning/finish defaults
(saturation, vibrance, etc.).
tests/test_characteristic_curve.py::test_default_curve_shape — golden: the default
print curve sampled at x = 0, .25, .5, .75, 1 (exposure kernel only). Shifts on TRC or
print-curve changes, not on lab/saturation.
Not rendered snapshots (do not use this skill for them):
test_working_oetf.py — values are defined by the TRC formula; hand-edit if you change
the curve.
test_lab_colorspace.py / test_lab_logic.py — assert structural properties / explicit
inputs, not default-look pixels. A failure there usually means a real math change.
- Parity tests (
test_pipeline_parity.py) — relative CPU↔GPU; default-value changes apply
to both sides, so they don't need regeneration.
Workflow
Confirm the change was intentional. If you can't name why the look moved, stop and
investigate — that's a regression, not a golden update.
See what actually fails so you only touch real snapshots:
make test
Expect test_scene_linear_relocation and/or test_characteristic_curve if the change is
look-affecting. Anything else failing is a separate signal — read it, don't auto-bless.
Print the new values:
uv run python .claude/skills/regenerate-goldens/regenerate.py
It imports each test's own image / sample-point / curve helpers, so those stay in sync;
only the relocation config list is mirrored in the script — if you add or remove a config
or sample point in the test, update the script to match.
Paste the printed blocks over _GOLDEN (relocation) and golden (characteristic
curve). Keep the surrounding comment/docstring accurate (which TRC, which default).
Re-run to confirm green and eyeball the magnitude of the shift — a tiny tweak that
moved a pixel by 0.4 is a red flag the change did more than intended:
make test
If a non-golden test (lab_logic L* tolerance, etc.) also moved, decide per-test whether
the new behaviour is correct before loosening a bound — don't widen tolerances to pass.
1---2name: regenerate-goldens3description: Use when a deliberate look/pipeline change has shifted NegPy's golden / characterization test values and they need updating — e.g. after changing the working-space TRC or primaries, the print curve, a lab/toning default (saturation, vibrance), or any default that alters rendered output, and a snapshot test now fails. Keywords: golden, goldens, characterization test, snapshot, regenerate, update expected values, test_scene_linear_relocation, test_characteristic_curve, _GOLDEN, look drift.4---56# Regenerate goldens78## Overview910A few tests pin **rendered output** as hardcoded "golden" values — they exist to catch11*unintended* drift in the look. When you change the pipeline on purpose (a default, the12TRC, primaries, a curve), those snapshots go stale and must be re-baselined.1314**Core principle — this is the one thing to get right:** only regenerate a golden when the15change that moved it was **intentional**. A failing golden after an unrelated edit is a16*real regression* — fix the code, do not bless the new numbers. Regenerating to silence a17surprise defeats the entire point of the test.1819## Which tests carry rendered goldens2021- **`tests/test_scene_linear_relocation.py`** — `_GOLDEN`: full-engine output (6 pixels ×22 default / `expo_dark` / `expo_cmy`). Depends on the whole creative chain, so it shifts on23 almost any look change: working TRC/primaries, print curve, lab/toning/finish defaults24 (saturation, vibrance, etc.).25- **`tests/test_characteristic_curve.py::test_default_curve_shape`** — `golden`: the default26 print curve sampled at x = 0, .25, .5, .75, 1 (exposure kernel only). Shifts on TRC or27 print-curve changes, **not** on lab/saturation.2829Not rendered snapshots (do **not** use this skill for them):30- `test_working_oetf.py` — values are defined by the TRC *formula*; hand-edit if you change31 the curve.32- `test_lab_colorspace.py` / `test_lab_logic.py` — assert structural properties / explicit33 inputs, not default-look pixels. A failure there usually means a real math change.34- Parity tests (`test_pipeline_parity.py`) — relative CPU↔GPU; default-value changes apply35 to both sides, so they don't need regeneration.3637## Workflow38391. **Confirm the change was intentional.** If you can't name why the look moved, stop and40 investigate — that's a regression, not a golden update.41422. **See what actually fails** so you only touch real snapshots:43 ```bash44 make test45 ```46 Expect `test_scene_linear_relocation` and/or `test_characteristic_curve` if the change is47 look-affecting. Anything else failing is a separate signal — read it, don't auto-bless.48493. **Print the new values:**50 ```bash51 uv run python .claude/skills/regenerate-goldens/regenerate.py52 ```53 It imports each test's own image / sample-point / curve helpers, so those stay in sync;54 only the relocation config list is mirrored in the script — if you add or remove a config55 or sample point in the test, update the script to match.56574. **Paste** the printed blocks over `_GOLDEN` (relocation) and `golden` (characteristic58 curve). Keep the surrounding comment/docstring accurate (which TRC, which default).59605. **Re-run to confirm green** and eyeball the magnitude of the shift — a tiny tweak that61 moved a pixel by 0.4 is a red flag the change did more than intended:62 ```bash63 make test64 ```65666. If a *non-golden* test (lab_logic L* tolerance, etc.) also moved, decide per-test whether67 the new behaviour is correct before loosening a bound — don't widen tolerances to pass.