Skip to content

Tests bound the CPU work of a scan by wall-clock time #889

Open

Description

@antonwolfy

The class of #882: a test that bounds a scan or a regex with time.monotonic() - start < N or time.perf_counter() - start < N fails on a stalled or busy runner (7 s against a bound of 5 in #882). tests/growth_timing.py (growth, GROWTH_LIMIT, the fix of #505) takes the CPU-time ratio from n to 4n instead.

Sites (from grep -nE '(monotonic|perf_counter)\(\) *- *\w+ *<' dokimi/tests):

  • test_catalog_command_checks.py:313, :322, :336
  • test_catalog_no_frontmatter.py:385
  • test_catalog_online.py:875
  • test_catalog_spec_checks.py:120
  • test_catalog_validate_scripts.py:727, :737
  • test_context_prefilter_shell.py:133
  • test_repo_events_bash.py:831
  • test_repo_l0.py:607
  • test_repo_l0_gitignore.py:161
  • test_repo_security_rules.py:79, :165, :171
  • test_task_format_detect.py:511

The process-wait and timeout bounds (test_process.py, test_benchflow_harness.py:884, test_example_runner_processes.py:78, test_repo_reach.py:645) wait for a child or a deadline and are another class; test_reference_checks.py:103 and :198, test_novelty_checks.py:236 and test_repo_useful.py:935 bound a regex timeout guard, not a scan, and stay. Convert each site above to growth(...) < GROWTH_LIMIT, and check that a quadratic mutant of the code under test still fails it (the mutant must fail by its ratio, not by the 60 s pytest timeout).

Found while fixing #882. The fix's PR is #890.

Activity

  1. self-assigned this
    on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions