Skip to content

Require deliberate, reviewable updates to the golden_master.json fixture instead of silent overwrite #330

Closed

Description

@squid-protocol

Problem

Once golden_diff.py is actually wired into CI and passing/failing the
build, nothing stops a contributor from simply re-running the tool and
copying its new output over the golden master to make a failing diff
"pass." A green check on this test currently means (and would continue to
mean) "output matches the last accepted snapshot" or "output was just
silently re-blessed" -- there's no way for a reviewer to tell the difference
from the CI result alone.

This matters because the whole point of this test is to catch unintended
output drift. If updating the baseline is as easy as cp new_output.json golden_master.json, the test provides a false sense of safety: a
bug that changes output will "fail" once, and can be silently
made to "pass" again without anyone examining whether the new output is
actually correct.

Fix

Make golden-master updates deliberate and reviewable:

  1. A separate, explicit update path. e.g. a make update-golden-master
    target or a script under tests/tools/, clearly distinct from the normal
    test-run path, so updating the baseline is never an accidental side
    effect of just running tests.
  2. A PR-level forcing function. Either:
    • A CONTRIBUTING.md requirement: any PR that touches
      tests/golden_master/*.json must explain in the PR description what
      output change was intended and why.
    • Or a lightweight CI check that flags (not necessarily blocks) any PR
      modifying the golden master file, so it's never invisible in a large
      diff.
  3. Ownership/review requirement (optional, if the repo grows past a
    single maintainer): require a specific reviewer or label on any PR that
    touches the golden master fixture.

Explicitly out of scope for this issue

  • The mechanics of the diff test itself (companion issues).
  • A true correctness test suite with hand-verified expected findings --
    golden-diff testing, even done perfectly with full governance, can only
    ever prove output hasn't silently drifted from a prior baseline. It can
    never prove the baseline was correct in the first place. That's a
    separate, larger piece of work.

Activity

  1. added
    bug
    ci-cd
    testing
    on Jul 23, 2026
  2. squid-protocol commented on Jul 25, 2026

    @squid-protocol
    OwnerAuthor

    Resolved by #399: tests/tools/update_golden_master.py is now the one sanctioned update path (shows the diff, requires confirmation before writing), and .github/workflows/golden-master-guard.yml flags any PR touching the fixture files for reviewer attention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugci-cdpriority: mediumtesting

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions