Repository navigation
Description
Problem
docs/TESTING.md says that no test asserts on elapsed wall-clock time. No check enforces this rule, and 12 sites break it. A busy machine fails a bound of this kind with correct code. Three pre-push gates failed this way on 2026-10-22, and each failure cost a rerun of about 10 minutes.
Evidence
Issues #1825 and #1888 fix three of the tests that failed. These sites remain (found on 2026-10-22 at release tip b2b67df5):
tests/test_url_credential_masking.py:388:elapsed < 1.0for each of four 100 KB inputs.tests/test_rag_investigator.py:218:elapsed < 1.0for 20 concurrent lookups.tests/test_pydantic_ai_exceptions.py:152:elapsed < 0.5.tests/test_ui_reactive.py:1460:elapsed < 1.0for a refresh key press.tests/test_treesitter_engine.py:258:elapsed_ms < 1000.0.tests/test_context_packer.py:296:duration < 2.0.tests/test_fastmcp_in_process.py:130:elapsed_ms < 10000.0.tests/test_devcontainer.py:1927:time.monotonic() - start < 3.tests/test_github_session.py:513:time.monotonic() - started < 5.0.tests/test_process.py:433andtests/test_process.py:459: a realshchild gets a timeout ofHUNG_RUN_TIMEOUT_SECONDS(1.0 s) from the spawn, and the test waits for its pids inside it. These two can race like the test of fix(test): the process-group timeout test waits for its grandchild to start, not for 0.6 seconds #1888. The spawn wrapper of fix(test): the process-group timeout test waits for its grandchild to start, not for 0.6 seconds #1888 can serve them.- Three more sites assert a lower bound (
tests/test_ai_review_pool.py:44and:102,tests/core/test_clock_contract.py:48). Load only lengthens the time, so these do not fail under load.
Remedy
Fix each upper-bound site so that the test proves the behaviour without a clock. Use the fake clock or the shared bounds in tests/support/waits.py. Then add a check, so the rule has an enforcer: a rule for the ast-grep scan that the repository already runs, or another open tool that finds a clock read in an assertion. Show that the check fails on a new violation. If no check is possible, delete the sentence from docs/TESTING.md, because a rule with no check is pruned. Do not build a custom scanner (see the rule "Open Tools Before Internal Code").
regression of #1825, shipped in v0.2.39
Proposed design
Problem statement
Tests assert on elapsed wall-clock time. This causes test failures on busy machines. The rule in docs/TESTING.md is not enforced.
Acceptance criteria
- Criterion 1: Each of the twelve listed tests no longer asserts on elapsed wall-clock time.
Verification: Run the twelve tests and confirm they do not use time assertions. - Criterion 2: A check enforces the rule that no test asserts on elapsed wall-clock time.
Verification: Run an ast-grep scan or another tool to verify no clock assertion exists in test files.
Key questions
- How should the upper-bound time assertions be fixed?: Fix each upper-bound site so that the test proves the behaviour without a clock. Use the fake clock or the shared bounds in tests/support/waits.py. (proposed) [sources: docs/TESTING.md]
- What check enforces the rule against asserting elapsed wall-clock time?: Add a rule for the ast-grep scan that the repository already runs, or another open tool that finds a clock read in an assertion. (proposed) [sources: docs/TESTING.md]
Open questions
- What are the twelve tests that still assert on elapsed wall-clock time? (missing verified source)
Fit
Needs splitting into 2 items:
- Fix twelve tests to remove wall-clock time assertions.
- Add check to enforce rule against wall-clock time assertions.
Suspected block
None.
Dependencies
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 22, 2026
Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.
The candidate is about fixing tests that assert elapsed wall-clock time, which is a test-related issue.The issue affects CI reliability and causes reruns, impacting development speed and resource usage.Fixing flaky tests under load improves project stability and developer experience.Requires fixing multiple test locations and adding an enforcement check, which is substantial but not overly complex.dan-petty commentedon Oct 23, 2026
Proposal needs splitting into 2 items at 72b8a3c (see proposed design in issue body).
fix(tests): twelve tests still assert elapsed wall-clock time, and no…