Skip to content

fix(sre): generate error_rate SLO entry instead of empty slos: []#48

Merged
chefgs merged 6 commits intomainfrom
copilot/bug-2-fix-empty-slos-manifest
Mar 19, 2026
Merged

fix(sre): generate error_rate SLO entry instead of empty slos: []#48
chefgs merged 6 commits intomainfrom
copilot/bug-2-fix-empty-slos-manifest

Conversation

Copy link
Contributor

Copilot AI commented Mar 18, 2026

generate_slo_manifest() had no branch for slo_type="error_rate", so the generated slo.yaml always contained slos: [] — Sloth/OpenSLO tooling received zero objectives for this type.

Changes

  • cli/scaffold_sre.py — Added error_rate branch in generate_slo_manifest() producing a named SLO entry with HTTP 5xx-based SLI queries and alerting config (mirrors the availability entry, distinct name/description/runbook). The condition includes "all" so that --slo-type all also generates the error_rate entry alongside availability and latency:
if args.slo_type in ("error_rate", "all"):
    slos.append({
        "name": "error_rate",
        "description": f"{name} error rate SLO — error rate stays below {round(100 - args.slo_target, 4)}%",
        "objective": args.slo_target,
        "sli": { "events": { "error_query": ..., "total_query": ... } },
        "alerting": { "name": f"{name.title()}ErrorRateSLO", ... },
    })
  • tests/test_comprehensive.py — Removed @pytest.mark.xfail(strict=True) from test_slo_manifest_error_rate_bug; test now asserts specifically that an entry with name == "error_rate" is present. Updated test_slo_manifest_all_type_has_both_slos to also assert "error_rate" is included when slo_type="all".
  • cli/__version__.py — Bumped package version to 0.4.2.
  • CHANGELOG.md — Added [0.4.2] entry documenting the fix.
Original prompt

This section details on the original issue you should resolve

<issue_title>BUG-2: SRE error_rate SLO type produces empty slos: [] in manifest</issue_title>
<issue_description>BUG-2: SRE error_rate SLO type produces empty slos: [] in manifest

File: cli/scaffold_sre.py, generate_slo_manifest()
Impact: slo.yaml has slos: [] — Sloth/OpenSLO tooling receives no SLO objectives
Root cause: error_rate is a valid enum option but has no generator branch in generate_slo_manifest()</issue_description>

<agent_instructions>Analyse the code base and bug information. Find root cause and create plan.
After planning fix the issue. Finally update documentation, and hugo docs</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

…ifest

Co-authored-by: chefgs <7605658+chefgs@users.noreply.github.com>
Copilot AI changed the title [WIP] [BUG-2] Fix empty SLOs in manifest generation fix(sre): generate error_rate SLO entry instead of empty slos: [] Mar 18, 2026
Copilot AI requested a review from chefgs March 18, 2026 17:43
@chefgs chefgs marked this pull request as ready for review March 19, 2026 05:16
@chefgs chefgs requested a review from Copilot March 19, 2026 12:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes BUG-2 in the SRE scaffolder so --slo-type error_rate produces a non-empty Sloth/OpenSLO slo.yaml manifest, and updates regression coverage + changelog accordingly.

Changes:

  • Add an error_rate SLO entry generator branch in generate_slo_manifest().
  • Un-xfail the comprehensive regression test covering the error_rate SLO manifest case.
  • Add a 0.4.2 changelog entry describing the fix.

Reviewed changes

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

File Description
cli/scaffold_sre.py Adds generation of an error_rate SLO manifest entry (events-based SLI + alerting stanza).
tests/test_comprehensive.py Removes the strict xfail marker for the BUG-2 regression test.
CHANGELOG.md Documents the fix under a new 0.4.2 release section.
Comments suppressed due to low confidence (1)

tests/test_comprehensive.py:862

  • This test docstring still claims the function "currently returns an empty slos list" even though the xfail was removed and the bug is being fixed. Please update the docstring to describe the expected behavior (or remove the BUG-2 wording) so the test remains accurate going forward.
        """
        BUG-2: When slo_type='error_rate', generate_slo_manifest() should
        return at least one SLO entry capturing the error rate objective,
        but currently returns an empty slos list.
        """

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

chefgs and others added 3 commits March 19, 2026 17:56
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
CLI version bump
Co-authored-by: chefgs <7605658+chefgs@users.noreply.github.com>
Copilot AI requested a review from chefgs March 19, 2026 12:33
@chefgs chefgs merged commit 5930f2a into main Mar 19, 2026
8 checks passed
@chefgs chefgs deleted the copilot/bug-2-fix-empty-slos-manifest branch March 19, 2026 12:57
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.

BUG-2: SRE error_rate SLO type produces empty slos: [] in manifest

3 participants