Skip to content

test(roadmap): verify refine writes across three live rollouts #3793

Open

Description

@devops-cli-service

Split from #3631.

Problem Refine must write each item when that item is done, so a Service stop loses at most the item in progress. The unit tests prove the code path. They do not prove the behaviour during a real rollout of the Service. ### Why it is deferred The check needs the deployed Service and three rollouts in 2 hours. A release rolls the Service, and the time of a release is outside this item. This item cannot pass until that period happens. ### Acceptance criteria - Run refine for 2 hours across three rollouts of the Service. - Each rollout stops the Service during a refine round. - The log of each round holds one start line and one end line with the counts of items taken, written and failed. - Every item that a round wrote before a stop is Ready after the rollout, and its comment is on the issue. - The next round takes the items that the stopped round did not write.

Proposed design

Problem statement

Build one live check that verifies a refine rollout window, and run it after the merge. The unit tests prove the write path of refine. They do not prove the behaviour during a real Service rollout, when a stop can lose the item in progress. The new check reads the round lines from Loki and the item state from GitHub. It fails with the name of the rollout, the round or the item that breaks a rule. A person merges three release pull requests inside two hours and then runs the check.

Acceptance criteria

Requirement: Rollout window report

The new live check MUST read the refine round lines of a time window from Loki and MUST report the number of rollouts, the number of rounds and the span of the window.

Scenario: Three rollouts in a two-hour window

  • WHEN uv run pytest tests/roadmap/test_roadmap_refine_rollouts_check.py -k covers_window runs with a Loki fake that returns three Service rollout stops inside a window of 7200 seconds.
  • THEN the check exits 0 and prints one report line with rollouts=3 and span=7200.

Requirement: A stop outside a round fails the check

The check MUST exit 1 and MUST name the rollout when a Service rollout stop falls outside every refine round.

Scenario: Stop with no round

  • WHEN uv run pytest tests/roadmap/test_roadmap_refine_rollouts_check.py -k stop_outside_round runs with a Loki fake whose rollout stop falls after the end line of the last round.
  • THEN the check exits 1 and prints a line that names that rollout.

Requirement: One start line and one end line per round

The check MUST require exactly one start line and one end line in each refine round, and the end line MUST hold the integer counts taken, written and failed.

Scenario: Round with no end line

  • WHEN uv run pytest tests/roadmap/test_roadmap_refine_rollouts_check.py -k round_lines runs with a Loki fake whose round holds a start line and no end line.
  • THEN the check exits 1 and prints a line that names that round.

Requirement: A written item is Ready with its comment

The check SHALL read each issue that carries the comment of a round and SHALL exit 1 when one of those issues is not Ready.

Scenario: Written item is in progress

  • WHEN uv run pytest tests/roadmap/test_roadmap_refine_rollouts_check.py -k written_items_ready runs with a GitHub fake that returns one issue with the round comment and Status In Progress.
  • THEN the check exits 1 and prints a line that names that issue number.

Requirement: The next round takes the items left

The check SHALL exit 1 when an item that a stopped round did not write gets no comment from the next round.

Scenario: Item left by the stopped round

  • WHEN uv run pytest tests/roadmap/test_roadmap_refine_rollouts_check.py -k next_round_takes_rest runs with a GitHub fake whose New item carries no comment from the next round.
  • THEN the check exits 1 and prints a line that names that issue number.

Requirement: Each round names its Loki query and window

The report of each round MUST hold the Loki query and the start and end time that produced its lines.

Scenario: Round names its query

  • WHEN uv run pytest tests/roadmap/test_roadmap_refine_rollouts_check.py -k source_query runs.
  • THEN the report of each round holds a non-empty query field and a start and an end time that bound its lines.

Requirement: Pending a person after the merge

A person MUST merge three release pull requests inside one two-hour window and MUST run the live check over that window.

Scenario: Live two-hour run over three rollouts

  • WHEN a person merges three release pull requests inside two hours and runs uv run devops roadmap refine-rollouts-check --start <start> --end <end>.
  • THEN the command prints one report line for each round and exits 0.

Existing Tool Considered

No alternatives check has run. Loki (grafana/loki, AGPL-3.0) is open and maintained, and it covers the log query of a rollout window. The cluster runs it as the logging service (k8s/README.md:17), and the repository already queries it with its LogQL tool (src/devops_cli/k8s/logql.py). The lines outlive the pod that a rollout replaces. Loki lacks the release schedule, the issue state and the invariant checks. The project already selects and parses the Service result lines with RESULT_LINES (src/devops_cli/roadmap/job_grade_report.py:151). The change adds one devops roadmap live check and its unit tests. It costs about 3k tokens to write, about 500 tokens a month to keep, and about 1k tokens for a fix. It takes under one day.

Key questions

  • Which event stops the Service during a refine round?: A Service rollout. The Service closes its request budget in drain_and_stop at src/devops_cli/server/service.py:1182, so the next request of a running refine round fails and the round ends. [sources: src/devops_cli/server/service.py:1182, tests/server/test_server_service.py]
  • Which source holds the log of a round that a rollout stopped?: Loki, read with the LogQL tool of the repository. The lines outlive the pod that the rollout replaces, so the check reads them after the rollout. (best practice) [sources: src/devops_cli/k8s/logql.py, tests/ai/mcp/test_k8s_logql.py]
    • Chosen: Loki query. The lines outlive the pod, and the repository already wraps Loki in its LogQL tool.
    • Rejected: kubectl logs --previous. It shows the previous run of a container in the current pod, not the deleted pod.
    • Rejected: Live kubectl logs -f for two hours. The stream ends at each rollout, and a dropped stream loses the round.
  • Which artifact does the pull request deliver?: A live check command that verifies a rollout window, with its unit tests. The check is product code, so its unit tests assert its behaviour with fakes. (best practice) [sources: AGENTS.md]
    • Chosen: Live check command and its unit tests. The command encodes each rule of the item, and a person runs it on a real window.
    • Rejected: Recorded fixture and a shape test. A shape test asserts no behaviour of the Service, and AGENTS.md rule 2 forbids compensating code.
    • Rejected: A document that records the run. It asserts nothing that a check can show.
  • How does the two-hour live run gate the pull request?: It does not gate the merge. The pull request delivers the check. A person runs the check after the merge, and the criterion Pending a person after the merge records that step. (best practice) [sources: AGENTS.md, .github/workflows/release-merge.yml]
    • Chosen: Run the check after the merge. The check is the deliverable, and the live proof does not hold the merge.
    • Rejected: Run the live window before the pull request. It holds the item on a person's release window and delays the check itself.
  • How often does the scheduled release merge run, and how many release pull requests does one run merge?: The cron 0 */6 * * * starts the release merge every 6 hours. One run merges at most one release pull request. --match-head-commit fails the merge when release-please pushed after the pick. [sources: .github/workflows/release-merge.yml, CONTEXT.md]
  • How can three Service rollouts fall inside a two-hour window?: A person merges three release pull requests inside the window. A merge into main between two release merges makes release-please open the next release pull request. (best practice) [sources: .github/workflows/release-merge.yml, CONTEXT.md]
    • Chosen: Merge three release pull requests in the window. It follows the release path and gives three real Service rollouts.
    • Rejected: Wait for the scheduled merges only. The schedule merges at most one release pull request every 6 hours, so it cannot give three rollouts in two hours.
    • Rejected: Restart the deployment by hand. It proves nothing about the release path.
  • How does a command find the Loki address?: The setting loki.url gives the address. With no setting, the repository falls back to kubectl logs and sends no HTTP request, so the live check needs the setting. [sources: tests/ai/mcp/test_k8s_logql.py, src/devops_cli/k8s/logql.py]
  • Which record ties an item to the refine round that wrote it?: No record holds a round id. The round start line and the round end line bound the round in time. Each written item logs one result line with job=refine and item=#<n> at its write, and Loki gives that line a timestamp. The check places the item in the round by that time. The write also sets the mark refine.read_at in the issue record and posts one comment with the marker &lt;!-- devops roadmap refine: next step -->. [sources: src/devops_cli/roadmap/refine/refine.py:5402, src/devops_cli/roadmap/refine/refine.py:5456, src/devops_cli/roadmap/refine/refine.py:5362, src/devops_cli/roadmap/job_result.py:384, src/devops_cli/roadmap/refine/refine.py:5206, src/devops_cli/config/constants.py:3805, src/devops_cli/k8s/logql.py:386]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/test
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 6, 2026
  2. devops-cli-service commented on Nov 6, 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/test. The test prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. It verifies a shipped fix in production but does not block the fix itself.
    • Value: Medium. It gives confidence that the incremental-write fix survives real Service stops.
    • Effort: Medium. It needs a 2-hour live run across three rollouts with log and state checks.
    • Related: fix(roadmap): refine writes each item when that item is done #3631, which asks for a different change. Both concern refine writing items incrementally, but #3631 delivers the code fix and the candidate delivers a test that proves the fix across three live rollouts.
  3. devops-cli-service commented on Nov 7, 2026

    @devops-cli-service
    ContributorAuthor

    Refine cannot set this item to Ready at dc276b0 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.

    • How do three Service rollouts fall inside a 2-hour window when the scheduled release merge runs every 6 hours? (a person decides)

    The next refine round also looks at the item again when a commit on the default branch changes one of these files: .github/workflows/release-merge.yml.

  4. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    ContributorAuthor

    Refine cannot set this item to Ready at ffce5d9 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.

    • How can three Service rollouts fall inside a 2-hour window? (a person decides)
  5. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    ContributorAuthor

    Owner question: See the first point of Open questions 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

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

    @devops-cli-service
    ContributorAuthor

    Owner question: See the first point of Open questions 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

  7. devops-cli-service commented on Nov 26, 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 Dec 1, 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/mediumpriority/p2-mediumscope/roadmapsource/agentstatus/newtype/testvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions