Skip to content

test(service): prove webhook wake latency after release #6279

Open

Description

@devops-cli-service

Split from #5555.

Problem: The issue asks for live proof that a status/ready label starts a stage round within one minute when the stage lane is idle, as shown by the time-to-round metric. Why deferred: This check needs the deployed release and live GitHub webhook deliveries, so it cannot run offline in the implementation pull request. Acceptance criteria: After the release, on a managed repository with an idle stage lane, add status/ready to an issue. Within 60 seconds, devops_cli_service_trigger_latency_seconds{event=issues, lane=stage} shows a new observation and devops_cli_service_triggers_total{event=issues, lane=stage} increments. Record the observed value in the issue.

Proposed design

Problem statement

A person must show on a live release that a status/ready label starts a stage round within 60 seconds on an idle stage lane. The named latency series devops_cli_service_trigger_latency_seconds{event=issues, lane=stage} does not exist. The check uses the existing stage start gauge and trigger counter. A person runs the check after the release of #5555 and records the values on issue #6279.

Acceptance criteria

Requirement: Stage start gauge is present

The live check MUST read the existing devops_cli_service_job_start_timestamp_seconds{repo, lane} gauge for the stage lane.

Scenario: The stage start gauge is present

  • WHEN A person runs uv run devops prometheus query 'devops_cli_service_job_start_timestamp_seconds{repo="dan-petty/devops-cli",lane="stage"}' after the release.
  • THEN The command prints at least one row with a numeric value.

Requirement: Trigger counter is present

The live check MUST read the existing devops_cli_service_triggers_total{repo, source} counter for the webhook and poll sources.

Scenario: Both trigger sources are present

  • WHEN A person runs uv run devops prometheus query 'devops_cli_service_triggers_total{repo="dan-petty/devops-cli"}' after the release.
  • THEN The command prints a row for source="webhook" and a row for source="poll".

Requirement: Stage lane is idle before the label

The stage lane MUST have started no round in the 60 seconds before the label event.

Scenario: Idle stage lane

  • WHEN A person runs uv run devops prometheus query 'time() - devops_cli_service_job_start_timestamp_seconds{repo="dan-petty/devops-cli",lane="stage"}' just before adding the label.
  • THEN The command prints a value greater than 60.

Requirement: Ready label starts the stage round

The Service SHALL start a stage round within 60 seconds of a status/ready label event on an idle stage lane.

Scenario: Ready label on an idle stage lane

  • WHEN A person records the UTC label time and runs uv run devops prometheus query 'devops_cli_service_job_start_timestamp_seconds{repo="dan-petty/devops-cli",lane="stage"}' after the stage round starts.
  • THEN The printed value minus the label time is no greater than 60 seconds.

Requirement: Webhook counted and poll unchanged

The Service SHALL count the label delivery in devops_cli_service_triggers_total{source="webhook"} and leave the poll count unchanged in the 60-second window.

Scenario: Webhook counted and poll unchanged

  • WHEN A person runs uv run devops prometheus query 'devops_cli_service_triggers_total{repo="dan-petty/devops-cli"}' just after a poll tick, adds the label, and runs the query again after the stage round starts.
  • THEN The source="webhook" value is greater than the first read, and the source="poll" value equals the first read.

Requirement: Pending a person after the merge

The person who runs the live check MUST record the observed values in a comment on issue #6279.

Scenario: The live check is recorded

  • WHEN A person runs uv run devops gh issue view 6279 --comments after the check.
  • THEN The output holds a comment with the UTC label time, the stage round start time, the latency in seconds, and the webhook and poll counter values before and after.

Existing Tool Considered

No alternatives check has run. Prometheus, the open and maintained metrics backend, covers the live read through its instant query API. The project already wraps it as uv run devops prometheus query '<promql>' in src/devops_cli/commands/prometheus.py. The client in src/devops_cli/prometheus/client.py adds the egress check and the retry. Prometheus lacks the devops_cli_service_trigger_latency_seconds series and the event and lane labels on the trigger counter. The check takes the round start from devops_cli_service_job_start_timestamp_seconds. It reads both sources of devops_cli_service_triggers_total. The person records the label event time, which no series holds.

Key questions

  • Does the Service expose devops_cli_service_trigger_latency_seconds with event and lane labels?: No. The Service exposes the gauge devops_cli_service_job_start_timestamp_seconds{repo, lane} and the counter devops_cli_service_triggers_total{repo, source}. The named latency series does not exist. The counter has no event or lane label. [sources: src/devops_cli/config/constants.py, k8s/devops/monitoring/prometheus-rules-values.yaml, tests/fixtures/prometheus_rules/roadmap_service_tests.yaml]
  • Which command does the live check use?: The check uses the maintained uv run devops prometheus query '<promql>' command. The command sends a Prometheus instant query and prints each series with its value. It reads prometheus.url through the egress-checked client. The client retries a transient failure. The check needs no new code. (best practice) [sources: src/devops_cli/commands/prometheus.py, src/devops_cli/prometheus/client.py, docs/CLUSTER.md]
    • Chosen: The existing devops prometheus query instant query. The project keeps this command and its client. It returns the exact series and value that the criteria assert.
    • Rejected: A raw curl to the Prometheus HTTP API. It duplicates the maintained client and skips its egress check and retry policy.
    • Rejected: Read a Grafana panel by eye. The panel shows a time window, not the exact sample, so it gives no value that a criterion can assert.
    • Rejected: Add a new devops command that queries the metrics. The command already exists, so this adds code that the project must keep and fix for nothing.
  • Which bound separates a webhook wake from the poll?: Use 60 seconds. The poll interval is longer than 60 seconds. A stage round inside 60 seconds of the label is no poll round. The check reads both sources of the trigger counter. It starts just after a poll tick. A poll that changes the counter then shows. (best practice) [sources: docs/adr/0017-each-subscribed-webhook-event-runs-the-update-scoped-to-it.md, docs/CLUSTER.md, CONTEXT.md]
    • Chosen: 60 seconds. It is below the poll interval. The poll counter read holds a poll wake apart from the webhook wake.
    • Rejected: The 5-minute sweep interval. A round that the sweep starts also passes, so the check proves nothing about the webhook.
    • Rejected: One scrape interval. The scrape interval is a property of the metrics backend, not of the wake. It varies with the deployment.
  • Does the item add a metric or use the existing series?: The item uses the existing series and adds no code. It records one live observation. The gauge devops_cli_service_job_start_timestamp_seconds gives the round start. The counter devops_cli_service_triggers_total gives both sources. A new latency metric would add an instrument, its priming and its tests to build, keep and fix for one observation. (best practice) [sources: AGENTS.md, src/devops_cli/config/constants.py, k8s/devops/monitoring/prometheus-rules-values.yaml]
    • Chosen: Record the observation only. The check needs the deployed release and live webhook deliveries. The existing gauge already records the round start. No offline test produces the value.
    • Rejected: Add a devops_cli_service_trigger_latency_seconds metric. It adds an instrument, its priming and its tests to build, keep and fix for one observation. The existing gauge and counter give the number.
    • Rejected: Add a live check command to devops. devops prometheus query already sends the instant query. A new command adds code that the project must keep and fix.
  • Which repository runs the live check?: Run the check on devops-cli itself. It is a managed project. Its stage row has a lane that the webhook wakes. (best practice) [sources: CONTEXT.md, docs/CLUSTER.md]
    • Chosen: devops-cli. It is a managed project. The stage row and its lane exist there.
    • Rejected: Another managed repository. It needs a person to choose it and to grant the check access. It proves no more than devops-cli.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#5555

Activity

  1. added
    type/test
    source/agent
    status/new
    value/medium
    on Nov 18, 2026
  2. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    ContributorAuthor
  3. added
    effort/low
    scope/service
    priority/p2-medium
    on Nov 18, 2026
  4. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    ContributorAuthor

    Refine cannot set this item to Ready at 29e3a03 while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.

    The next refine round also looks at the item again when a commit on the default branch changes one of these files: src/devops_cli/server/routes/webhooks.py, src/devops_cli/server/service.py, src/devops_cli/config/constants.py, src/devops_cli/roadmap/run.py.

  5. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    ContributorAuthor

    Refine cannot set this item to Ready at 3ecd647 while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.

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

    @devops-cli-service
    ContributorAuthor

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

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

    @devops-cli-service
    ContributorAuthor

    Owner question: See Suspected block and Watched files in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  8. devops-cli-service commented on Nov 29, 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/servicesource/agentstatus/newtype/testvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions