Skip to content

Testing & Release Hardening Initiative #917

Open

Description

@tsouza

Why

Gigapipe's correctness surface has outgrown its test coverage. Today, PRs run a build, untagged unit tests (no race detector), one focused Content-Type regression against a live ClickHouse, and CodeQL — while releases are published by build_release.yml with no test gate at all. The transpilers (LogQL/PromQL/TraceQL → SQL), the hybrid PromQL execution path, the writer's ingestion pipeline, the schema migration scripts, and the recording-rules ruler all carry real regression risk that nothing currently pins.

This initiative builds a layered test harness inside this repository and restructures CI around a two-tier fence:

  • Merge gate — a small, fixed set of fast required checks on every PR (build, race-enabled unit tests, lint, golden corpora, conformance, single-node schema migration). Target: under ~10 minutes.
  • Release gate — the heavy lanes (parity vs reference Prometheus/Loki/Tempo, full roundtrip corpus walks, e2e stacks, chaos, perf). These trigger on every PR but short-circuit to a green no-op unless the event is a push to master, a nightly schedule, a manual dispatch, or a release/* PR. A publish preflight in build_release.yml refuses to release unless every release lane posted green on the exact commit being shipped.

Two principles run through everything:

  1. Ratchets over hard gates. Where gigapipe deliberately diverges from reference behavior (15s range alignment, downsampled-table semantics), a hard-fail parity gate would be permanently red and get ignored. Instead, parity results are scored against a committed per-case baseline with a per-case reason classification; the gate fails only when a case changes state. Regressions are caught from day one; burndown of known divergences is visible and deliberate.
  2. Tests version with the code. E2E lives in this repo under test/e2e/ (compose stacks, Go drivers behind build tags, a deterministic all-signal seed generator). The external test repository will not be used; a behavior change and its test update land in the same PR.

A parallel workstream refactors the codebase for testability (constructor injection, one config package, a narrow DB-access seam, process-exit policy only in cmd/) — sequenced behind the black-box safety net so every refactor PR is provably behavior-preserving.

Milestones

Each milestone is a sub-issue of this one, in dependency order:

M1 originally included a SQL-text golden corpus per query head. That's been descoped in favor of pinning behavior at two other layers instead — decision pins (M6) for internal routing/pushdown choices, and response-level goldens (M2) for the Loki/Prometheus/Tempo JSON contracts Grafana actually depends on. A static SQL-text contract bakes in today's emitted shape, including shapes that may themselves be bugs, so every fix becomes two edits (code + golden) instead of one. M7 is new: it was split out of the former M6 (now M4) so that milestone's Loki/Tempo constructor-injection work stays sequenced behind M6's (formerly M4's) config-extraction groundwork, rather than either dragging that groundwork forward or leaving a dangling dependency.

Definition of done (initiative level)

  • Branch protection requires the merge-gate set on every PR; no release publishes without the preflight verifying green release-gate lanes on the released commit.
  • Every generated baseline/golden/inventory is regenerable by a single command, -merge-gated in .gitattributes, and protected by a regenerate-and-diff check.
  • Migrated packages carry no package-level mutable state, no os.Getenv outside the config package, no os.Exit/policy-panic outside cmd/, and are constructible in tests with fakes only — enforced by scoped static checks so they cannot regress while the rest of the tree waits.

Activity

  1. rita7lopes commented on Sep 18, 2026

    @rita7lopes
    Contributor

    Updating this epic against decisions made since it was written.

    Two corrections to the body:

    1. "releases published by build_release.yml with no test gate at all" is not accurate. Pushes to master run make e2e-ci (node-clickhouse-cluster.js.yml) and k6. The real gaps are narrower: go.yml and integration.yml are pull_request-only, so they never run on the master commit itself; the cluster lane carries paths-ignore: ['**.md','**.yml']; and build_release.yml has no needs: on any check-run. The publish preflight is still justified — the premise sentence isn't.

    2. "Tests version with the code. E2E lives in this repo under test/e2e/. The external test repository will not be used." — reversed. E2E stays in metrico/gigapipe-tests, and continues to run against its current main: that suite is the living specification, and testing against its head is deliberate, not an oversight. Policy for this repo is: unit tests alongside the code, Go integration tests in test/integration/, full-stack e2e in gigapipe-tests.

    A criterion for what belongs in this repo's suites. A test must assert a behaviour that holds regardless of how the code is written — a user-visible outcome, or a function's contract. Tests that only record current shape go red on refactors and catch nothing a behaviour-level test wouldn't catch first, and a negative pin turns a bug into a requirement. The exception is a persisted or wire contract, where today's output genuinely is the contract.

    Resequencing. M2 moves to next. The table refactor beginning with #972 is the concrete thing it protects.

    New. #991 pins the label-fingerprint contract — three implementations, zero tests, and it is the join key in every deployment's ClickHouse. Folding into M2.

    M6 and M7 stay as scoped. The read path is being refactored, not retired: the same queries will read the same data from different tables. Constructor injection, the no-substrate conformance suites, and the shared/chaccess seam are what make that safe to do.

    Path note. Milestones referencing test/e2e/seed/ need that path updated — the shared fixture package belongs under test/integration/ now.

  2. Guess-Who-sec commented on Nov 20, 2026

    @Guess-Who-sec
    Contributor

    @rita7lopes a short note on the open epic PRs, since several are stacked: here is the order that unblocks the most, in case it helps you pick what to review first. All are green in CI.

    Start of a stack (no dependencies):

    Stacked (review after the one before it):

    Independent (any time): #1070 (k6 builds the PR image), #1097 (M5 profile parser fuzz), #1071 (Loki query_range defaults), #1083, #1084

    I'll rebase each stacked PR onto master as the ones below it merge. #1069, #1112, #1113, #1114 and #1117 also have open questions for you in their descriptions.

    Next I'm starting M8 ingestion conformance, as you suggested on #924: one protocol per PR, Loki push first, then Prometheus remote-write.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions