Skip to content

🌱 Add CI test guarding cluster-objects manifests against metrics drift - #6804

Open
kubestellar-hive[bot] wants to merge 1 commit into
mainfrom
telemetry/cluster-objects-metrics-consistency-test
Open

🌱 Add CI test guarding cluster-objects manifests against metrics drift#6804
kubestellar-hive[bot] wants to merge 1 commit into
mainfrom
telemetry/cluster-objects-metrics-consistency-test

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Fixes #6803

What

Adds src/__tests__/cluster-objects-metrics-consistency.test.ts, which parses cluster-objects/servicemonitor.yaml, prometheusrule.yaml, and deployment.yaml with the existing js-yaml dependency and:

  • Fails on plain YAML syntax errors in these manifests — previously nothing parsed them before a kubectl apply would.
  • Cross-checks that prometheusrule.yaml's alert expressions only reference metric/label names that actually exist in src/lib/metrics.ts (docs_api_requests_total{route,method,status_class}, docs_api_request_duration_seconds), so a future rename there can't silently leave DocsApiHighErrorRate / DocsApiHighRequestLatency permanently non-firing with no signal.
  • Checks that servicemonitor.yaml and deployment.yaml agree on namespace.

Verified the drift check actually fires: temporarily renaming a label in prometheusrule.yaml makes the new test fail, then reverted before committing.

Why this shape

Verification

  • npx vitest run src/__tests__/cluster-objects-metrics-consistency.test.ts — 4/4 pass
  • npx vitest run — full suite, 790/790 pass
  • npx eslint src/__tests__/cluster-objects-metrics-consistency.test.ts — clean
  • npx tsc --noEmit — no new errors

— hive: agent=telemetry backend=copilot model=claude-sonnet-4-6

Fixes #6803

Adds src/__tests__/cluster-objects-metrics-consistency.test.ts, which
parses cluster-objects/servicemonitor.yaml, prometheusrule.yaml, and
deployment.yaml with the existing js-yaml dependency and:

- fails on plain YAML syntax errors in these manifests (previously
  nothing parsed them in CI before a kubectl apply would)
- cross-checks that prometheusrule.yaml's alert expressions only
  reference metric/label names that actually exist in
  src/lib/metrics.ts, so a future rename there can't silently leave
  DocsApiHighErrorRate / DocsApiHighRequestLatency permanently
  non-firing
- checks servicemonitor.yaml and deployment.yaml agree on namespace

Runs under the existing vitest.yml workflow (triggered on src/**
changes) with no changes to .github/workflows/*. No exporter, backend,
or external data flow added — this only validates manifests that
already describe a pull-only, in-cluster-only scrape/alert setup.

Signed-off-by: kubestellar-hive[bot] <223556219+Copilot@users.noreply.github.com>
@kubestellar-hive

Copy link
Copy Markdown
Contributor Author

Important

Held for human sign-off on the direction, not on the code.

This PR's only tracked rationale is #6803, which the hive filed itself — issue #6803 was filed by kubestellar-hive[bot] and no human has acknowledged it. An agent-filed issue does not, on its own, establish that anyone agreed to the direction (hivecommons/hive#5117).

The change may well be right; nothing here is a review of it. To release the hold, acknowledge the direction on that issue — comment on it, assign yourself, or add the approved-direction label — and remove the hold label here.

@kubestellar-hive kubestellar-hive Bot added the hold label Sep 8, 2026
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Sep 8, 2026
@netlify

netlify Bot commented Sep 8, 2026

Copy link
Copy Markdown

Deploy Preview for kubestellar-docs ready!

Name Link
🔨 Latest commit 581f662
🔍 Latest deploy log https://app.netlify.com/projects/kubestellar-docs/deploys/6a9fc7ab09d5720008b8d9f7
😎 Deploy Preview https://deploy-preview-6804--kubestellar-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@kubestellar-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 8, 2026
@kubestellar-prow

Copy link
Copy Markdown

Hi @kubestellar-hive[bot]. Thanks for your PR.

I'm waiting for a kubestellar member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

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

Labels

copilot dco-signoff: yes Indicates the PR's author has signed the DCO. frontend hold needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[telemetry] cluster-objects/*.yaml (ServiceMonitor/PrometheusRule) has no CI validation and can silently drift from src/lib/metrics.ts

1 participant