Skip to content

3.x.x: keep every published alert rule UID within Grafana's 40-character limit (#757) - #793

Merged
kiwidream merged 1 commit into
3.x.xfrom
orca/757-alert-rule-uids
Oct 28, 2026
Merged

kiwidream merged 1 commit into
3.x.xfrom
orca/757-alert-rule-uids

Conversation

@kiwidream

@kiwidream kiwidream commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Fixes #757. Five alert-rule UIDs in docs/prism-native-alert-rules.json were longer than Grafana's 40-character limit, so a Grafana that provisions the published rule set refuses it. The downstream deployment had been working around this by renaming them at render time.

What changes

  • The five UIDs now use the issue's short forms. Titles, labels and expressions are unchanged.

    Old (length) New
    qbit-prism-pool-resubmission-reject-ratio (41) qbit-prism-pool-resubmit-reject-ratio
    qbit-prism-candidate-landing-failed-critical (44) qbit-prism-candidate-landing-failed-crit
    qbit-prism-block-offer-standby-unconfirmed (42) qbit-prism-offer-standby-unconfirmed
    qbit-prism-database-advisory-lock-failures-critical (51) qbit-prism-advisory-lock-failures-crit
    qbit-prism-revision-work-pending-critical (41) qbit-prism-revision-work-pending-crit
  • CI guard. New scripts/check_prism_alert_uids.py, run in CI, rejects any UID that is too long, has characters outside [A-Za-z0-9_-], or is duplicated across docs/*-alert-rules.json. Tests are in tests/test_check_prism_alert_uids.py. scripts/test_prism_alert_deployment.py now also asserts Grafana's UID pattern on every rendered rule.

  • Migration note (docs/prism-alert-migration.md). The new UIDs equal the targets of qbit-tools' five render-time aliases, so those aliases become no-ops and can be deleted, with no deleteRules needed (Grafana never stored the long UIDs). Grafana treats a new UID as a new rule, so state history and any silence keyed on __alert_rule_uid__ start over. Routing and label-based silences are unaffected.

  • Other updates: the observability inventory test that named an old UID, and docs/prism-alert-verification.md (the new check's command).

Tests

  • The UID check exits 1 on the base files (exactly these five) and 0 after (45 UIDs).
  • tests.test_check_prism_alert_uids 10/10, and tests.test_docs_lab_prism_references passes.
  • generate_prism_alerts.py --check passes, with and without --snapshot.
  • test_prism_alert_deployment.py --snapshot passes against the frozen qbit-tools templates (sha256 matches the manifest; 10 gate combinations).
  • The full promtool 3.14.0 scenario suite passes, and the observability tests pass 17/17.
  • fmt and clippy are clean.
  • An independent adversarial check made each rule break in turn (an over-long UID, a cross-file duplicate, removing the CI step) and confirmed each one is caught.

#758 (gating the revision-work warnings) builds on this branch and follows as a stacked PR.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

…ter limit (#757)

Grafana refuses a rule UID over 40 characters or outside [A-Za-z0-9_-],
and a provisioning file carrying one stops it from starting. Five native
UIDs broke this; they now use the short forms a downstream deployment
already renders, so its rules and alert state carry over:

  qbit-prism-pool-resubmission-reject-ratio           -> qbit-prism-pool-resubmit-reject-ratio
  qbit-prism-candidate-landing-failed-critical        -> qbit-prism-candidate-landing-failed-crit
  qbit-prism-block-offer-standby-unconfirmed          -> qbit-prism-offer-standby-unconfirmed
  qbit-prism-database-advisory-lock-failures-critical -> qbit-prism-advisory-lock-failures-crit
  qbit-prism-revision-work-pending-critical           -> qbit-prism-revision-work-pending-crit

Titles, labels and expressions are unchanged. scripts/check_prism_alert_uids.py
fails CI when any UID in docs/*-alert-rules.json is too long, uses other
characters or repeats across the files, and the provisioning test applies
the same pattern to the rendered rules. The qbit-tools patch is regenerated
from the frozen a007a142 snapshot.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T15:53:44.229705Z f065c4f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@qbit-reviewer qbit-reviewer Bot 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.

No findings.

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.

1 participant