Skip to content

perf(tests): remove fixed waste in six slow tests #4706

Closed
0 of 1 issue completed
Closed

Description

@dan-petty

Problem or Motivation

Six tests do work that they do not need (all times measured; the local times have no coverage):

  • tests/docs/test_docs_inventory.py:172-173 collects the document references two times (3.73 s).
  • tests/docs/test_docs.py:206-236 builds the CLI reference about 4 times (5.51 s).
  • tests/commands/test_ai_rag_ingest_analyze_dry_run.py:112 runs forage on the real repository with 40 git log calls (6.78 s).
  • tests/support/sandbox.py:171-173 closes the listener, but accept() does not wake, so the teardown waits 2.0 s.
  • tests/server/test_service_memory.py:33-41 runs 200 rounds (13.97 s in CI).
  • tests/ai/rag/test_polyglot_chunking.py:344 sets deadline=800, which fails correct code on a loaded host.

Saving: 20-25 s of CI worker time (estimated), and one less source of flaky failures.

Found by the CI and test audit of 2026-11-11. The account runs at most 20 hosted jobs at one time (measured), so each job that does no work makes the queue of each pull request longer.

Proposed Solution & Architectural Design

  • Collect the document references one time.
  • Share the JSON output of the CLI reference, and keep the check and --check paths.
  • Use a small tmp git repository with --repo for forage.
  • Call shutdown(SHUT_RDWR) before close().
  • Use 50 rounds with the same budget. First prove with a fail-to-pass run that the test fails on an unbounded cache. Rename the test and its docstring.
  • Remove deadline=800.

Risk: Low. A leak of less than about 0.3 MiB per round can pass the 50-round test.

Target Subsystem

SDLC, Git & PR Governance (tests/docs/, tests/commands/, tests/support/sandbox.py, tests/server/, tests/ai/rag/).

Existing Tool Considered

The standard library (socket.shutdown) and the Hypothesis deadline setting. No new tool. Cost: about 30,000 tokens and 2 hours.

Acceptance Criteria

  • Each named test takes less time than the time given above.
  • The memory test fails on an unbounded cache.
  • The sandbox teardown takes 0.1 s or less.

Dependencies

None.

Sub-issues

Sub-issues

0 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. added
    source/agent
    type/infra
    scope/tests
    status/new
    value/medium
    effort/low
    on Nov 11, 2026
  2. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

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

    • Type: type/infra. The perf prefix of the title gives the type.
    • Scope: scope/tests. The (tests) scope of the title gives the scope.
    • Priority: P2-Medium. Saves 20-25 s of CI time and removes one flaky source, but does not block a release.
    • Value: Medium. Reduces CI queue time and flaky failures for all contributors.
    • Effort: Low. Six small, localised edits in test files, estimated at 2 hours.
    • Related: chore(ci): measure the local check on an idle host and rank the fixes #4427, which asks for a different change. Both target CI test performance, but #4427 asks to measure and rank fixes while this candidate asks to apply six specific fixes.
  3. added
    priority/p2-medium
    owner/agent
    on Nov 11, 2026
  4. added
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 12, 2026
  5. removed
    status/in-review
    owner/agent
    on Nov 12, 2026
  6. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor
  7. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-12 12:40 UTC

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/testssource/agenttype/infravalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions