Skip to content

test(prom): PromQL parity baseline and ratchet (M3, #922) - #1112

Open
Guess-Who-sec wants to merge 3 commits into
metrico:masterfrom
Guess-Who-sec:test/m3-parity-ratchet
Open

Guess-Who-sec wants to merge 3 commits into
metrico:masterfrom
Guess-Who-sec:test/m3-parity-ratchet

Conversation

@Guess-Who-sec

@Guess-Who-sec Guess-Who-sec commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Part of #922 (M3): the parity baseline, the ratchet and the baseline triage. Next in #922: the release-gate skeleton, which runs this in CI.

Depends on #1069 (the harness): this branch is built on it, so its first 2 commits are #1069's. Merge #1069 first; I'll rebase this one onto master then. Only the last commit is new here.

What it does

  • baseline.json records every compliance query: its state (agree or differ) and, for each query that differs, a reason. One query per line, sorted, so a diff shows exactly which queries changed.
  • make parity-prom-check runs the suite and fails if any query changed state since the baseline, naming each one:
    • a query that agreed now differs
    • a baselined query didn't run
    • a new query differs
    • a new query isn't in the baseline yet
    • a query that differed now agrees (so fixes get recorded too)
  • make parity-prom-baseline rewrites the baseline from a fresh run. It keeps the reasons already there, and new differences get unclassified.
  • make parity-prom stays report-only.

The comparison is in compatibility/ratchet/ (Go, standard library only, in gigapipe's main module so the LogQL and TraceQL parity harnesses of M4 can use it too; -test names the parity test whose results it reads, TestPromQLParity by default). run.sh now saves go test -json output and hands it to the checker, which it builds before the suite runs.

Triage: the 131 differences

Facts only; whether each one is expected is your call:

Count Reason in the baseline Open question
113 not covered: the target sends no native histograms #1069 Q4
15 reference gap: the reference Prometheus drops the 7 oldest replay snapshots; gigapipe keeps them #1069 Q6
3 gigapipe: negative offset is disabled (PQRC001) Is this intended?

None is unclassified. #922 suggested reasons like deliberate-15s-alignment; none of the 131 fits those, so the reasons say what was measured. If you answer Q4/Q6 differently on #1069, the reasons (or the harness) change with it.

Verification

  • Unit tests (with -race), including M3 — PromQL parity harness + release-gate skeleton + publish preflight #922's acceptance check: a run where one query flips from agree to differ fails the check, and the same run passes once that query is baselined with a reason. Also: reasons kept on regenerate, a failed or missing _setup and an empty run are refused, bad usage exits 2, and with two parity tests in one output each -test name reads only its own queries.
  • Real runs against master 640f1c02:
    • make parity-prom-baseline: 529 agree / 131 differ; regenerating gives a byte-identical baseline.json
    • make parity-prom-check: 3 runs, all matches the baseline (660 queries)
    • make parity-prom: 529 / 131, exit 0
    • Planted change: PARITY_KEEP_SERVICE_NAME=1 make parity-prom-check (compares service_name too) fails and names 333 queries "agreed in the baseline, now differs" (529 - 196)
  • go vet, gofmt, staticcheck and golangci-lint (--new-from-rev=upstream/master, all findings shown) clean on the new code; shellcheck: no warnings
  • Root go build ./... and go test ./... pass (34 packages, including the checker); root go vet has no new findings compared with test(prom): PromQL parity harness against Prometheus (M3, #922) #1069's tip; gigapipe's go.mod and go.sum unchanged

Potential risks

  • Not in CI yet: only make runs it; the release-gate PR adds it to CI.
  • The baseline depends on the pinned suite and Prometheus: bumping either can change queries, and the check then fails until make parity-prom-baseline is rerun and reviewed (intended).
  • Fails on fixes too: a query that starts agreeing fails the check until the baseline is updated. This keeps the file exact, but a gigapipe fix needs a baseline update in the same PR.
  • Query names are Go subtest names (spaces become _), as go test reports them.

Run the PromQL compliance suite with a real Prometheus 3.15.1 as the
reference and gigapipe built from this tree as the target. Gigapipe
doesn't scrape, so its target scrapes the suite's replayer itself,
remote-writes the samples and proxies the queries. `make parity-prom`
prints how many queries agree; it is report-only for now.

The suite lives in its own module under compatibility/prometheus, so
gigapipe's go.mod and binary are unchanged.
@socket-security

socket-security Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedgithub.com/​prometheus/​prometheus@​v0.315.17610010075100
Addedgithub.com/​prometheus/​common@​v0.72.2-0.20261027144952-e257672f3db69110010010080
Addedgithub.com/​prometheus/​compliance@​v0.0.0-20261029144141-6ae8d35df52c82100100100100

View full report

baseline.json records the state of all 660 compliance queries (529 agree,
131 differ) and why each difference exists. `make parity-prom-check` fails
when a query changes state: a query that agreed now differs, a query that
differed now agrees, a baselined query didn't run, or a new query isn't in
the baseline. `make parity-prom-baseline` rewrites the file and keeps its
reasons. `make parity-prom` stays report-only.

run.sh now saves `go test -json` output and hands it to the checker in
compatibility/ratchet, which it builds before the suite runs. The checker
is in gigapipe's main module (standard library only) so the LogQL and
TraceQL parity harnesses can use it too; -test names the parity test whose
results it reads, TestPromQLParity by default.

Reasons for the 131 differences, facts only:
- 113: the target sends no native histograms
- 15: the reference Prometheus drops the 7 oldest replay snapshots
- 3: gigapipe disables negative offsets (PQRC001)
@rita7lopes

Copy link
Copy Markdown
Contributor

This inherits the hardcoded versions from #1069 (nested go.mod, PROM_VERSION, README). I asked for those to come from the root go.mod instead, so please rebase this once #1069 is updated, and don't add versions here.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants