Skip to content

fix(ci): bound the three hanging mutants-tree tests #6475

Done

Description

@devops-cli-service

Split from #6448.

Problem: Three tests do not end in 70 minutes in a mutants tree of all of src/devops_cli. They read the 475 MB generated tree: tests/server/test_service_memory.py::test_the_heap_at_round_50_is_within_the_byte_budget_of_the_heap_at_round_10, tests/telemetry/test_telemetry_instruments.py::test_no_gauge_reaches_prometheus_through_two_paths, and tests/invariants/test_source_tree.py::test_no_unreachable_calls_in_src. Why deferred: The repository-metadata change in #6448 does not change how these tests walk the generated tree. Each test needs its own bound, skip condition or smaller input. Acceptance criteria: Each named test ends within a stated time bound in a prepared mutants tree. A test that cannot meet the bound is skipped with a reason that names the generated tree. The stats run of devops ci mutate reports no hang from these tests.

Proposed design

Problem statement

Three tests do not end in 70 minutes in a mutants tree of all of src/devops_cli. They walk or measure the 475 MB generated tree. This change gives each test a bound, and skips a test that cannot meet the bound with a reason that names the generated tree.

Acceptance criteria

Requirement: The tree guard skips on a generated tree

The tree guard of tests/support/trees.py SHALL skip with a reason that names the generated tree when the parsed source passes 128 MiB.

Scenario: A parsed tree over the limit

  • WHEN A test gives the tree guard a map of parsed trees larger than 128 MiB
  • THEN The guard raises Skipped with a reason that holds the words generated tree and the size in MiB, and gives no skip for a map under the limit.

Requirement: The two tree-walking tests use the guard

Each of the two tests that walks src/devops_cli SHALL take its parsed tree through the guard.

Scenario: The two modules are read

  • WHEN A test parses tests/telemetry/test_telemetry_instruments.py and tests/invariants/test_source_tree.py
  • THEN Each module holds a call of the guard of tests/support/trees.py, and the test reports no module that walks src/devops_cli with no guard.

Requirement: The memory test skips past its bound

test_the_heap_at_round_50_is_within_the_byte_budget_of_the_heap_at_round_10 SHALL skip with a reason that names the generated tree when its rounds pass 60 seconds.

Scenario: A clock past the bound

  • WHEN A test gives the round loop a clock that reads 61 seconds
  • THEN The test ends as skipped with a reason that holds generated tree and 61, and the fake GitHub holds no request after the skip.

Requirement: The mutation stats report no hang

The stats run of devops ci mutate MUST report no hang for the three named tests.

Scenario: The stats run on a prepared mutators tree

  • WHEN A person runs the stats run of uv run devops ci mutate on a prepared mutators tree
  • THEN The output gives each of the three tests as passed or skipped with its seconds, and gives no test as hung.

Existing Tool Considered

No alternatives check has run for this item. The need is a per-test time bound whose expiry skips the test with a reason that names the generated tree. pytest-timeout, an open and maintained pytest plugin, gives the per-test bound and covers that part. It lacks the skip: it fails a test whose bound expires, and its failure text cannot name the tree. The proposal keeps the bound in the test support of the repository (tests/support/trees.py and tests/support/waits.py), about 40 lines: a size guard for the parsed tree and a deadline check for the round loop. The written cost to build and keep that code is about 20k tokens and about 1 hour. Refine confirms the release and the marker of pytest-timeout before the plan names it.

Key questions

  • What does each of the three named tests read, and why does the generated tree make it slow?: The telemetry test takes the fixture parsed_source_trees, which parses each file of src/devops_cli. The name of the invariants test states that it walks src. The memory test reads no tree: it runs 50 rounds of a 1 MiB diff over RepoWorker. A mutators tree of all of src/devops_cli is 475 MB, as the issue states. [sources: tests/server/test_service_memory.py, tests/telemetry/test_telemetry_instruments.py, tests/invariants/test_source_tree.py, tests/support/trees.py]
  • Which bound does the repository hold for a slow test now?: No bound covers the full duration of a test. tests/support/waits.py holds THREAD_HANDOFF_BOUND_SECONDS for a thread handoff, and the memory test uses it for the start and the stop of its worker. No fixture bounds the size of the parsed tree. [sources: tests/support/waits.py, tests/server/test_service_memory.py]
  • How do the two tree-walking tests end fast in a generated tree?: A size guard in tests/support/trees.py stops the walk before it starts. A tree over 128 MiB skips the test with a reason that names the generated tree and its size. (best practice) [sources: tests/support/trees.py, tests/telemetry/test_telemetry_instruments.py, tests/invariants/test_source_tree.py]
    • Chosen: A size guard in the tree support that skips over the limit. It stops the walk before it starts, so the test ends in seconds. It gives the skip with a reason that names the generated tree, which the body asks for.
    • Rejected: A per-test timeout marker from a pytest plugin. The plugin fails a test whose bound expires, so the test cannot skip with a reason. It also adds a dependency to the pinned test tools.
    • Rejected: A smaller input tree for the two tests. It changes what the test checks: a sample tree, not all of src/devops_cli. The two tests would then miss a defect in a file outside the sample.
  • How does the memory test end within its bound?: The round loop checks the elapsed time at each round. Past 60 seconds it skips with a reason that names the generated tree and the elapsed seconds. The test keeps its 50 rounds when the bound holds. (best practice) [sources: tests/server/test_service_memory.py, tests/support/waits.py]
    • Chosen: A deadline check in the round loop that skips. The loop already runs one round at a time, so a check at each round is cheap. It skips with a reason, and it keeps the 50 rounds when the bound holds.
    • Rejected: A per-test timeout marker from a pytest plugin. It fails the test when the bound expires, and it cannot name the generated tree.
    • Rejected: Fever rounds in a generated tree. The growth measurement needs the 40 rounds between round 10 and round 50. Fewer rounds would make the measurement weak.
  • Which time bound and which size limit?: 60 seconds for each test, and 128 MiB for the parsed tree of src/devops_cli. The generated tree is 475 MB, so the guard skips it. A parsed tree of src/devops_cli at the head is far under 128 MiB, so the two tests keep their full walk. The two constants live in tests/support/waits.py with the bound that it holds now. (best practice) [sources: tests/support/waits.py, tests/server/test_service_memory.py]
    • Chosen: 60 seconds and 128 MiB. It holds a wide gap between the normal tree and the generated tree, and it stops a hang well under the 70 minutes of the issue.
    • Rejected: 30 seconds and 64 MiB. A slow runner can pass 30 seconds on the full walk, and the skip would hide a real defect.
    • Rejected: A bound only, with no size limit. The two tree-walking tests would still walk 475 MB before the bound, and the run would still cost minutes.
  • Do we adopt a pytest timeout plugin for the bound, or keep the bound in the test support?: Keep the bound in the test support. The plugin bounds the duration but fails the test when the bound expires, so it cannot skip with a reason that names the generated tree. Refine confirms the release and the marker of pytest-timeout before the plan names it. (best practice) [sources: tests/support/waits.py]
    • Chosen: Keep the bound in the test support. It skips with a reason that names the generated tree, which the body asks for. It adds no dependency to the pinned test tools.
    • Rejected: Adopt pytest-timeout for the bound. It fails a test whose bound expires, so the test cannot skip with a reason. It also adds a dependency to the pinned test tools.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    scope/ci
    source/agent
    status/new
    effort/medium
    value/high
    on Nov 19, 2026
  2. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    ContributorAuthor
    • Priority: P0-Critical. Three tests hang for 70 minutes, causing the devops ci mutate stats run to be very slow or fail.
    • Related: fix(ci): the stats run fails in the mutants tree #6448, which asks for a different change. Both work in the mutants tree of devops ci mutate, but #6448 fixes the stats run path-guard failure while this candidate bounds three hanging tests.
  3. added
    priority/p0-critical
    on Nov 19, 2026
  4. changed the title [-]fix(ci): bound the three mutants-tree tests that hang on the generated tree[/-] [+]fix(ci): bound the three hanging mutants-tree tests[/+] on Nov 19, 2026
  5. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    ContributorAuthor

    The job shortened the title of this item. The summary had 66 characters, and the limit is 60. The type and the scope stay.

    • Before: fix(ci): bound the three mutants-tree tests that hang on the generated tree
    • After: fix(ci): bound the three hanging mutants-tree tests
    • Source of the summary: the background model
  6. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    ContributorAuthor

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

  7. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 23, 2026
  8. removed
    status/in-review
    owner/agent
    on Nov 23, 2026
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/p0-criticalscope/cisource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions