Draft: ci(metrics): run the S03-B spec tests on spec edits (#1718 stack: 2/2)

Summary

  • Problem: internal/metrics/spec_test.go (added in !3524 (merged)) reads docs/specs/S03-b-metrics.md. Its three TestSpec* tests fail when the ### Database table, the instrumenter prose, or the name budget row of the spec stops matching the code. CI runs these tests only in go_unittests and test:race. Both jobs skip an MR that changes only files under docs/ or .md files (.changes-non-docs), and both jobs always run on main.
  • Impact: A docs-only MR that edits the S03-B spec can merge with a green pipeline and then fail go_unittests on main. After that, every non-docs MR fails its merged-results pipeline until somebody corrects the spec. Users see nothing.
  • Change: This MR adds the job test:spec-tables to .gitlab-ci.yml, after test:race. The job runs go test -count=1 -run '^TestSpec' ./internal/metrics/ on MR and branch-push pipelines when docs/specs/S03-b-metrics.md or .gitlab-ci.yml changes. It has no rule for the default branch or for tags, because go_unittests runs these tests there.
  • Downsides: MRs that change the spec or .gitlab-ci.yml run one more job. If a later rename removes the TestSpec prefix, -run '^TestSpec' selects no test, and the job passes with no check.

Checklist

  • Ran it: n/a for the service, because this MR changes only CI configuration. On this branch, go test -count=1 -v -run '^TestSpec' ./internal/metrics/ passes and runs the three TestSpec* tests. glab ci lint did not run. The changes: list includes .gitlab-ci.yml, so the pipeline of this MR is the first run of the job.
  • Interfaces and data: None. The change is CI configuration only.
  • Failure: If the spec stops matching the code, the job fails, and the test output names the spec file and the missing item. The MR pipeline shows the failure before the spec edit merges.
  • Rollout: n/a. No service code, schema or configuration changes.
  • Hot path: n/a. No request path changes.
  • Database: n/a. No migration or query changes.
  • Security: n/a. No input, route, permission or audited action changes.
  • ADRs: None. The review research for this finding found no ADR, spec or plan that settles which CI job runs a Go test that reads a spec.
  • E2E: None. The change adds no service behavior, so no scenario row changes.
  • Simplicity: A wider .changes-non-docs filter was rejected, because it runs the full unit-test suite on every docs-only MR. A move of the check into a go run checker with its own job (the lint:e2e-catalog-sync shape) was rejected, because it changes what !3524 (merged) delivers and still needs a CI job. A scoped job runs the existing tests with no move.

Merge order

This MR is the second MR in a stack with !3524 (merged). It targets the branch of !3524 (merged) and merges after !3524 (merged). It is a separate MR because AGENTS.md keeps changes to CI gate configuration in their own MR.

Related to #1718 (closed)

This is a bot message 🤖 — /smurfit

Merge request reports

Loading
Loading