Skip to content

fix: parse pre-evaluation rules from Kubernetes specs - #5

Open
ralph-bitgo[bot] wants to merge 1 commit into
mainfrom
fix-pre-evaluation-rule-test
Open

fix: parse pre-evaluation rules from Kubernetes specs#5
ralph-bitgo[bot] wants to merge 1 commit into
mainfrom
fix-pre-evaluation-rule-test

Conversation

@ralph-bitgo

@ralph-bitgo ralph-bitgo Bot commented Aug 27, 2026

Copy link
Copy Markdown

What

  • Correct the TestPreEvaluationRuleParse fixture to use the supported
    top-level spec.preEvaluationRules map shape.
  • Add the JSON/YAML serialization tags required for the Kubernetes decoder to
    map preEvaluationRules into PrometheusServiceLevelSpec.

Why

  • PR4's image replacement is independent of this code change, but its CI was
    blocked by the pre-existing TestPreEvaluationRuleParse failure. This
    minimal fix makes the test exercise the actual Kubernetes API shape and
    restores parsing of the pre-evaluation rule field, allowing PR4's image-only
    change to be validated without adding unrelated generated-artifact changes
    to either PR.

Test plan

  • go test ./internal/k8sprometheus -run TestPreEvaluationRuleParse -count=1
  • go test ./... -count=1
  • git diff --check

Relationship to PR#4

PR#4 remains the sole PR containing
Sloth image replacement changes. PR#5 contains only the minimal parser/test
fix needed to unblock PR#4's unit-test CI. Merge PR#5 first, then validate and
merge PR#4 independently.

Ticket: INF-2854

@ralph-bitgo
ralph-bitgo Bot force-pushed the fix-pre-evaluation-rule-test branch from a46e8ae to 9bf5d14 Compare August 27, 2026 04:59
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the fix-pre-evaluation-rule-test branch from 9bf5d14 to c2e4137 Compare August 27, 2026 04:59
@linear-code

linear-code Bot commented Aug 27, 2026

Copy link
Copy Markdown

INF-2854

@ralph-bitgo
ralph-bitgo Bot force-pushed the fix-pre-evaluation-rule-test branch 2 times, most recently from 24cb64b to f308c73 Compare August 27, 2026 06:35
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the fix-pre-evaluation-rule-test branch from f308c73 to 8c70d10 Compare August 27, 2026 06:35
@ralph-bitgo
ralph-bitgo Bot force-pushed the fix-pre-evaluation-rule-test branch from 8c70d10 to fb50275 Compare August 27, 2026 06:35
Add serialization tags and correct the parser regression fixture so
spec.preEvaluationRules is decoded into the internal SLO model. This
keeps the PR focused on the unit-test failure that blocks PR4 CI while
leaving image and generated-artifact changes out of this branch.

Ticket: INF-2854
Session-Id: ef40df3f-0ac9-4787-ae8b-6ecd266e0dc2
Task-Id: 76fd5b3c-13e2-4b4a-bd25-1e4a161bb329
@ralph-bitgo
ralph-bitgo Bot force-pushed the fix-pre-evaluation-rule-test branch from fb50275 to f43b0ff Compare August 27, 2026 08:06
@bitgo-ai-agent-dev
bitgo-ai-agent-dev Bot force-pushed the fix-pre-evaluation-rule-test branch from f43b0ff to f3a7c69 Compare August 27, 2026 08:06
@ralph-bitgo
ralph-bitgo Bot force-pushed the fix-pre-evaluation-rule-test branch from f3a7c69 to 3e9ba2d Compare August 27, 2026 08:06
@srvk2642
srvk2642 requested a lite review from Copilot August 27, 2026 08:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Kubernetes YAML decoding and the associated unit test so spec.preEvaluationRules is parsed into the internal Prometheus SLO model as intended.

Changes:

  • Added JSON/YAML serialization tags for PrometheusServiceLevelSpec.PreEvaluationRules.
  • Updated TestPreEvaluationRuleParse YAML fixture to use the supported top-level spec.preEvaluationRules shape.
  • Adjusted expected model strings/metadata to match the decoded YAML block-scalar formatting and defaulted alert meta maps.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pkg/kubernetes/api/sloth/v1/types.go Adds struct tags so Kubernetes decoding maps preEvaluationRules onto the API type field.
internal/k8sprometheus/spec_test.go Fixes the test fixture to the correct CRD shape and updates expectations to match decoded values.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@srvk2642
srvk2642 marked this pull request as ready for review August 27, 2026 09:32
@srvk2642
srvk2642 enabled auto-merge August 27, 2026 09:32
@srvk2642 srvk2642 self-assigned this Aug 27, 2026
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