freshness

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package freshness reads the one harness setting that decides whether a test comparing a committed, generated artifact runs that comparison now or leaves it to the run where the artifact is refreshed.

Why the question exists

Every freshness gate (the README stats, llms*.txt, the tool snapshots, the token footprint, the testing reference, the site data, the request inventory, the manifests) holds a committed file against what the source tree would generate now. In a stack of pull requests the artifacts are refreshed once, at the top, so every layer below carries them stale on purpose and would fail on drift the top overwrites. CI computes that answer once, as FRESHNESS in .github/workflows/ci.yml, and hands it to the unit suite through EnvVar.

What reads it

Test files only. SkipIfDeferred is called by the tests of internal/tools, cmd/audit_metrics, cmd/audit_tokens and cmd/gen_llms, each of which reads a committed artifact and compares it. Nothing in the server reads any of this, which is why TestDependencies_TestSupport_NeverReachesTheServerBinary in cmd/server names this package alongside internal/testutil.

What deferring does not mean

It never means the artifact goes unchecked. The comparison runs wherever the refresh lands: at the top of a stack, on a pull request to main, and on every push to main, where CI answers "checked" and the generated-artifacts job runs the matching make check-* gate as well.

Index

Constants

View Source
const EnvVar = "GITLAB_MCP_TEST_SNAPSHOT_PARITY"

EnvVar is the harness setting that defers a committed-artifact comparison. It is developer-only, like GITLAB_MCP_TEST_INVENTORY_DIR: it configures the harness rather than the server, so it is read here with os.Getenv rather than through internal/config, which resolves the settings the server itself defines.

View Source
const SkipReason = "" /* 184-byte string literal not displayed */

SkipReason says what was deferred and on whose authority, so a reader of the log sees a decision rather than a gap.

The setting is spelled out rather than concatenated from the two constants above: a constant expression is not executable, so nothing can exercise the concatenation and no analysis can tell a correct one from a wrong one. What keeps the message honest is TestSkipReason_NamesTheSettingAndTheValue, which asserts both names appear here.

Variables

This section is empty.

Functions

func Deferred

func Deferred() bool

Deferred reports whether the harness asked for committed-artifact comparisons to be left to the run that refreshes them.

func SkipIfDeferred

func SkipIfDeferred(tb testing.TB)

SkipIfDeferred skips the calling test when Deferred holds, naming SkipReason. Call it before the comparison reads anything, so a deferred run neither fails on a stale artifact nor pays for measuring one.

Types

This section is empty.

Jump to

Keyboard shortcuts

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