Repository navigation
Description
Split from #5477.
Problem: SRE8 requires a hold on work for a service when its SLO has spent its 28-day budget. The hold permits only a fix of that SLO, a P0 item and a security fix. No job applies this hold. An item is for a service when its scope label or its changed paths name the service in the catalog of the environment tree (k8s/catalog.toml). Why deferred: The error-budget hold is a separate result of the supervise job. The approved pipeline split uses #5477 as the incident job. The hold waits on the supervise job and on the owner confirmation of the policy before mode on. Acceptance criteria: - A source test proves that a spent 28-day budget holds an item for its service that is not a fix of the SLO, a P0 item or a security fix. - A source test proves that the hold lets a fix of the SLO, a P0 item and a security fix through. - A source test proves that the hold matches a service by its scope label or by its changed paths against the catalog of the environment tree. - The policy starts in mode plan. The owner confirms the policy before mode on.
Proposed design
Problem statement
SRE8 holds work for a service whose 28-day SLO error budget is spent. The hold permits only a fix of that SLO, a P0 item and a security fix. No job applies this hold today. This item adds the hold policy. The policy matches an item to a service by its scope label or its changed paths, and it exempts the three classes. The policy stays in mode plan until a person confirms it.
Acceptance criteria
Requirement: Hold on a spent budget
The error-budget policy SHALL hold an item of a service whose 28-day budget is spent, unless the item is exempt.
Scenario: A spent budget holds a plain item
- WHEN The policy runs on an item of service
webwith no exemption, and the budget record forwebgivesbudget_left0.0. - THEN The result is
hold, with serviceweband reasonbudget-spent.
Requirement: Exempt classes pass
The policy SHALL pass a fix of the held SLO, an item with priority/p0-critical and an item with type/security when the budget of the service is spent.
Scenario: Each exempt class passes the hold
- WHEN The policy runs on an item that names the SLO
web/requests-availabilityas the SLO it fixes, on an item withpriority/p0-criticaland on an item withtype/security, all of servicewebwith a spent budget. - THEN Each result is
pass, and each result names its exemption class.
Requirement: Service match by label or path
The policy SHALL match an item to a service by the scope/<service> label of the item or by a segment of its changed paths that equals the service name or an application name in the catalog.
Scenario: A label and a path each match
- WHEN The policy runs on an item with the label
scope/web, and on an item with no scope label whose changed path isk8s/web/deployment.yamland whose catalog entry forwebnames the applicationweb. - THEN Both results name service
webas the matched service.
Requirement: Catalog from the environment tree
The policy MUST read the service catalog from the environment tree that --k8s-dir or the profile fact kubernetes.dir names.
Scenario: The catalog comes from the given tree
- WHEN The policy runs with
--k8s-dirthat names a tree with a catalog, and again with no option where the project profile giveskubernetes.dir. - THEN Both runs read the catalog of that tree, and a missing catalog returns a typed error.
Requirement: Mode plan changes nothing
The policy SHALL record its decision and apply nothing while the mode is plan.
Scenario: The default mode is plan
- WHEN The policy runs with no
roadmap.error_budget.modesetting on an item of a service with a spent budget. - THEN The result carries mode
planand applyfalse.
Requirement: Pending a person after the merge
A person MUST confirm the error-budget policy before the mode is set to on.
Scenario: The mode stays plan after the merge
- WHEN The pull request merges.
- THEN The mode stays
planuntil a person confirms the policy and setsroadmap.error_budget.modetoonin the deployment settings.
Existing Tool Considered
No alternatives check has run. Sloth (https://sloth.dev/) generates Prometheus SLO recording and alert rules. Pyrra (https://github.com/prometheus-community/pyrra) tracks error budgets and generates burn-rate alerts. Both are open and maintained. Neither reads a roadmap item, matches it to a service, or applies an exemption, so neither maps a spent budget to a roadmap hold. The change builds that mapping itself: about 45k tokens to build, about 10k tokens for each later fix, and about 2 days elapsed.
Key questions
- Does devops-cli hold an environment tree with
k8s/catalog.toml?: No. devops-cli ships no environment tree. The project profile declares nokubernetes.dir. The environment tree of the homelab cluster lives in the infra repo. The policy reads the catalog of the tree that--k8s-diror the profile factkubernetes.dirnames. [sources: .devops/project.toml:2, src/devops_cli/k8s/environment.py:4, src/devops_cli/k8s/catalog.py:33] - How does the policy get the spent state of a service's 28-day budget?: The policy takes one budget record for each service as an input. The record gives the service, the SLO, the 28-day window and
budget_left. The policy reads no metrics. The supervise job builds the records from the monitoring stack. (best practice) [sources: src/devops_cli/roadmap/project_review/data.py:148, src/devops_cli/roadmap/project_review/data.py:165, docs/adr/0007-tests-double-only-process-edges.md:10]- Chosen: Budget records as input. The supervise job already reads the monitoring stack, and a pure policy needs no process edge in its test.
- Rejected: Query Prometheus from the policy. The policy would need a Prometheus client and a fake, and the supervise job already reads the metrics.
- How does the policy find the service catalog?: It resolves the environment tree as the other commands do:
--k8s-dirfirst, then the profile factkubernetes.dir. It readscatalog.tomlat the root of that tree. (best practice) [sources: src/devops_cli/k8s/environment.py:6, src/devops_cli/k8s/catalog.py:33, src/devops_cli/k8s/catalog.py:1020]- Chosen: Resolve the environment tree. The catalog belongs to the environment tree, and the command resolves it as the other commands do.
- Rejected: Read
k8s/catalog.tomlof devops-cli. devops-cli ships no environment tree and holds nok8s/catalog.toml.
- How does an item match a service?: First by the scope label of the item:
scope/<service>where<service>is a name in the catalog. If the item has no matching scope label, by its changed paths: a path segment equal to the service name or an application name of the catalog entry. A scope label wins over a path. (best practice) [sources: docs/guidelines/sre.md:247, src/devops_cli/k8s/catalog.py:66, src/devops_cli/k8s/catalog.py:67]- Chosen: Scope label first, then changed path segments. The SRE rule names both sources, and a label is explicit.
- Rejected: Changed paths only. An item with no code change cannot match its service.
- Rejected: Scope label only. An item with no scope label cannot match its service.
- Which item classes pass the hold?: Three classes pass: a fix of the SLO whose budget is spent, an item with
priority/p0-critical, and an item withtype/security. (best practice) [sources: docs/guidelines/sre.md:247, src/devops_cli/roadmap/workflow_labels.py:63, src/devops_cli/roadmap/workflow_labels.py:99, https://sre.google/workbook/error-budget-policy/]- Chosen: Exempt the SLO fix, P0 and the security fix. The SRE rule names these three classes, and the labels are
priority/p0-criticalandtype/security. - Rejected: Exempt P0 items only. The SRE rule names a fix of the SLO and a security fix too.
- Chosen: Exempt the SLO fix, P0 and the security fix. The SRE rule names these three classes, and the labels are
- Where does the mode live and what is its default?: The mode is the setting
roadmap.error_budget.mode, typedRowModewith the valuesoff,planandon. The default isplan. A person setsonafter they confirm the policy. (best practice) [sources: src/devops_cli/config/defaults.py:1274, src/devops_cli/config/defaults.py:1287, src/devops_cli/config/settings.py:2142]- Chosen: A setting typed
RowModewith the defaultplan. The project types each row mode asRowModeand defaults the plan-first rows toplan. - Rejected: Mode
onby default. The issue requires the confirmation of the policy before modeon. - Rejected: A constant with no setting. A person cannot turn the hold on without a code change.
- Chosen: A setting typed
- Which job applies the hold, and what does it change?: The supervise job applies it. It reads the decision of the policy, and it starts no held item. This item delivers the policy only. A separate issue wires it into the supervise job. (best practice) [sources: docs/guidelines/production-readiness.md:49, docs/guidelines/sre.md:247]
- Chosen: The supervise job applies the hold. The issue body names the supervise job as the owner of the hold.
- Rejected: The implement job applies the hold. The hold must stop an item before the implement job starts.
- Rejected: The Service claim applies the hold. The claim reads no supervise result.
- Which open tool covers the mapping from a spent error budget to a roadmap hold?: No open tool maps a spent error budget to a roadmap hold. Sloth generates Prometheus SLO rules and burn alerts. Pyrra tracks error budgets and generates burn-rate alerts. Both are open and maintained. Neither reads a roadmap item or applies an exemption. The change builds the mapping itself: about 45k tokens to build, about 10k tokens for each later fix, and about 2 days elapsed. (best practice) [sources: https://sloth.dev/introduction/architecture/, https://github.com/prometheus-community/pyrra]
- Chosen: Build the mapping. No open tool writes a roadmap hold from a spent budget, and the policy is a small deterministic rule.
- Rejected: Sloth. It generates Prometheus SLO rules and burn alerts. It reads no roadmap item.
- Rejected: Pyrra. It tracks error budgets and burn alerts. It reads no roadmap item.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
devops-cli-service commentedon Nov 29, 2026
Both work on the supervise job of #5477 and deal with SLO budgets, but the candidate adds the hold mechanism while #5511 adds extra resources for P0 items.devops-cli-service commentedon Nov 29, 2026
Next step: the alternatives check records a verdict. See the section Proposed design of the body.