Skip to content

feat(roadmap): measure plan defect rate after plan verification #3162

Open

Description

@devops-cli-service

Split from #3069.

The roadmap-pipeline dashboard needs a defect rate of plans. The plan verification pass exists (src/devops_cli/roadmap/stage/stage_verify.py, #3153), and the dashboard k8s/devops/dashboards/roadmap-pipeline.json exists (#3655). No metric counts the findings of the pass yet. Acceptance criteria: When plan verification records a finding, the Service SHALL emit devops_cli_roadmap_pipeline_plan_defects_total{repo,item_class,severity}. The dashboard SHALL show the defect rate of plans per day. A test SHALL assert that the metric is emitted and that the panel query returns the fixture value.

Proposed design

Problem statement

The roadmap-pipeline dashboard has no plan defect rate. The stage verification pass records findings, but no metric counts them. This change declares a counter for plan findings and adds a panel for plan defects per day.

Acceptance criteria

Requirement: Plan defect counter declaration

The Service SHALL declare the counter devops_cli_roadmap_pipeline_plan_defects_total with the labels repo, item_class and severity in INSTRUMENTS and send it through emit().

Scenario: A plan finding sends the counter

  • WHEN a test runs the stage verification pass with one plan finding for repo acme/widgets, item_class feat and severity major
  • THEN the emitted counter sample for devops_cli_roadmap_pipeline_plan_defects_total{repo="acme/widgets",item_class="feat",severity="major"} has value 1

Requirement: Plan defect counter counts each finding

The Service SHALL add one to the counter for each finding that plan verification records, with the repository, the item class and the finding severity.

Scenario: Two findings add two

  • WHEN a test runs the stage verification pass with two plan findings for the same repo, item_class and severity
  • THEN the emitted counter sample for those labels has value 2

Requirement: Plan defect rate panel

The roadmap-pipeline dashboard SHALL show a timeseries panel named Plan Defects per Day with a 1-day step and the query sum by (repo, item_class, severity) (increase(devops_cli_roadmap_pipeline_plan_defects_total[1d])).

Scenario: Dashboard manifest validates

  • WHEN uv run devops ci --check --only k8s validates the dashboard manifest
  • THEN the command exits 0 and reports no error for k8s/devops/dashboards/roadmap-pipeline.json

Requirement: Plan defect query fixture

A test SHALL assert that the Plan Defects per Day query returns the fixture value.

Scenario: Panel query returns the fixture value

  • WHEN uv run pytest tests/grafana/test_grafana_dashboards.py -q runs the dashboard query fixture
  • THEN the command exits 0 and the generated query returns 2 for a fixture with two plan defect samples in one day

Requirement: Telemetry documentation

The telemetry documentation SHALL list devops_cli_roadmap_pipeline_plan_defects_total with its labels and its meaning.

Scenario: Telemetry docs list the counter

  • WHEN uv run pytest tests/docs/test_docs.py -q runs the documentation checks
  • THEN the command exits 0 and the telemetry document names the counter and its labels

Existing Tool Considered

No alternatives check has run. Use the OpenTelemetry Python SDK for counter emission and Grafana for the dashboard panel. The OpenTelemetry SDK lacks plan finding classification; the stage verification pass supplies the finding, the item class and the severity. Grafana lacks the plan defect series; the Service sends it. The change writes no custom counter or panel renderer.

Key questions

  • Does the stage verification pass record findings with a severity?: Yes. Finding carries a severity of blocker, major, minor or nit, and verify() returns the findings. [sources: src/devops_cli/roadmap/stage/stage_verify.py]
  • Which metric instrument records a plan defect?: Declare an OpenTelemetry Counter in INSTRUMENTS and send it with emit(). (best practice) [sources: src/devops_cli/telemetry/instruments.py, tests/gate/tree_checks/telemetry_instruments.py]
    • Chosen: OpenTelemetry Counter in INSTRUMENTS. The project declares each metric in INSTRUMENTS and sends it through emit().
    • Rejected: Gauge. A gauge can decrease and does not model event totals.
    • Rejected: Histogram. The item needs a count, not a distribution of defect counts.
  • Which labels does the counter use?: Use repo, item_class and severity. (best practice) [sources: src/devops_cli/telemetry/instruments.py, src/devops_cli/roadmap/implement/implement_submit.py:500, src/devops_cli/roadmap/stage/stage_verify.py]
    • Chosen: repo, item_class, severity. The panel groups defects by repository, item class and severity.
    • Rejected: repo, severity. The panel cannot group defects by item class.
    • Rejected: repo, item_class. The panel cannot show defects by severity.
  • Which findings does the counter count?: Count each finding that the stage verification pass records, open or advice, with its severity. (best practice) [sources: src/devops_cli/roadmap/stage/stage_verify.py]
    • Chosen: Each recorded finding. The issue says each finding, and the severity label keeps the grade.
    • Rejected: Only open findings. This drops minor and nit findings from the defect rate.
    • Rejected: Only findings with verdict/fix-plan. This counts a later state, not the finding of the pass.
  • How should the dashboard compute plan defects per day?: Use sum by (repo, item_class, severity) (increase(devops_cli_roadmap_pipeline_plan_defects_total[1d])) with a 1-day step. (best practice) [sources: src/devops_cli/grafana/pipeline_dashboard.py, tests/fixtures/dashboard_queries/roadmap-pipeline.yaml, docs/TELEMETRY.md]
    • Chosen: increase over 1d. Returns the number of new defects in each day directly.
    • Rejected: rate over 5m multiplied by 86400. Adds arithmetic and is less direct for a daily count.
    • Rejected: raw counter value. Shows a cumulative total, not a daily defect count.
  • How is the dashboard panel validated offline?: Add the panel to the dashboard generator and validate the generated manifest with uv run devops ci --check --only k8s; test the query with uv run pytest tests/grafana/test_grafana_dashboards.py -q. (best practice) [sources: src/devops_cli/grafana/pipeline_dashboard.py, tests/grafana/test_grafana_dashboards.py, k8s/devops/dashboards/roadmap-pipeline.json]
    • Chosen: Generator plus k8s check. The generator owns the dashboard JSON, and the k8s check validates the manifest.
    • Rejected: Edit the JSON by hand. The generator would overwrite the panel on the next run.
    • Rejected: No dashboard test. The issue requires a test of the panel query.
  • Which open tool covers metric emission and the dashboard panel?: Use the OpenTelemetry Python SDK for counter emission and Grafana for the dashboard panel. (best practice) [sources: src/devops_cli/telemetry/instruments.py, src/devops_cli/grafana/service_dashboard.py]
    • Chosen: OpenTelemetry SDK and Grafana. Open, maintained tools that the project already uses.
    • Rejected: Custom Python counter and static HTML panel. Builds and keeps code that the tools provide.
    • Rejected: No dashboard panel. Fails the dashboard requirement of the issue.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/low
    on Nov 2, 2026
  2. devops-cli-service commented on Nov 2, 2026

    @devops-cli-service
    ContributorAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. It adds observability and depends on #3153, so it is useful but not blocking.
    • Value: Medium. It gives operators one number for plan quality but is one of many pipeline metrics.
    • Effort: Low. One metric emission, one dashboard panel query, and one test assertion.
    • Related: feat(roadmap): metrics for the pipeline outcomes #3069, which asks for a different change. Both target the roadmap-pipeline dashboard; #3069 covers all pipeline metrics and alerts while the candidate covers only the plan defect rate metric and its panel.
  3. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    ContributorAuthor

    Refine cannot set this item to Ready at b39dcba. A bot opened the item, so a review of the issue and of the proposal must approve it first. The review found the defects below. A person edits the body to answer them. The next refine round looks at the item again only after a body edit.

    • spec_delta_wrong at acceptance_criteria: Plan defect rate panel: PromQL increase extrapolates, so two samples in one day do not reliably give exactly 2. The scenario also gives no way to evaluate PromQL offline, so no test can assert it. Evidence: "the panel query returns 2 for that day"
  4. dan-petty commented on Nov 14, 2026

    @dan-petty
    Owner

    Cannot build as written: the acceptance criteria require the 'Plan Defects per Day' panel on the roadmap-pipeline dashboard, but that dashboard does not exist yet. It is created by #3655 (open, status/ready). The counter part can build, but the panel and its test cannot. Returning until #3655 lands; this item depends on it.

  5. dan-petty commented on Nov 20, 2026

    @dan-petty
    Owner

    Frozen on 2026-11-20. The stage, implement and fix-checks jobs grade under 60%, so the owner rule asks for a re-architecture before more fixes inside the current design (tracker #6519). This item is incremental work on those jobs, so its Dependencies section now names #6521 first. Stage and implement leave this item while #6521 is open. When the experiments of #6519 decide, a person closes #6521 (this item can then continue) or closes this item as not planned.

  6. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    ContributorAuthor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

  7. devops-cli-service commented on Nov 30, 2026

    @devops-cli-service
    ContributorAuthor

    Next step: the alternatives check records a verdict. See the section Proposed design of the body.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumscope/roadmapsource/agentstatus/newtype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions