Repository navigation
tests: wall-clock bounds become load-independent assertions (Fixes #4477) - #4838
Merged
Merged
Conversation
) CPU-time (thread_time) best-of-N measurements and size-scaling ratios replace absolute wall-clock bounds; the ReDoS harness bounds child CPU time and keeps wall time only as a generous hang kill; tool_regex_redos uses CPU time, confirms slow samples, and avoids Windows' 15 ms thread clock. ci_digest FLAKY emptied. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TBJdDBRtJis5hzE244NQKV
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4477 (also the Windows-leg
test_no_new_offendersflake from #4836).Design
Wall-clock bounds measured the runner, not the code. New
tests/_timing.py: CPU time of the calling thread (time.thread_time, descheduled time not counted), minimum of N repeats, andassert_scales_linearly(ratio of a 4x input vs the small one, limit = 8x, linear ~4x / quadratic ~16x) orassert_cpu_below(fixed pathological payload, bound far above honest cost and far below the regressed cost).test_prism_suppression_regex_bomb,test_an_unterminated_declare_is_linear,test_many_move_statements_stay_linear,test_an_unterminated_exec_is_capped_and_linear.assert_redos_immunein_strict_harness.py/_extraction_harness.py,_measure_scaling_point; hundreds of callers): the child now reports its own CPU time, which is bounded bytimeout_sec; wall time is only the hang kill (max(10, 10*timeout_sec)).tests/tools/tool_regex_redos.py(sweep behindtest_no_new_offenders): CPU clock, slow verdict confirmed on best-of-5, quadratic confirmation best-of-5; where the thread clock is coarse (Windows, ~15 ms) it uses perf_counter + min-of-5.ci_digest.FLAKYis now empty (tests listed there are deterministic;test_regex_redoswas a stale name); the mechanism is still tested via monkeypatch.test_redos_poison.py(10 s hang kill + 120 s stall, a kill switch),test_chronometer_timeout(feature test of a timeout),test_a_class_miss_is_several_times_cheaper...(ratio of two regexes, 3x margin vs 25x+; only switched to thread_time),test_ada_strict(already a documented plain ceiling).cobol_graveyard_finder lines 112/115
Not genuinely quadratic: measured min-of-3 at 40k/80k/160k chars grows 4.0x for 4x input (
_TERMINAL_TAIL/_ALTERshapes); the Windows 10-12x came from 15 ms thread/wall-clock noise on 2-30 ms samples.Proof
test_redos_detonator_timeout_catch,test_catches_the_3205_pattern,test_catches_a_mild_quadratic_by_growthandtest_the_kill_switch_still_catches...still pass, so the harness and sweep still catch real ReDoS.pr_gates --fast5/5,--ratchets7/7 (with equivalence_env JDK 17).🤖 Generated with Claude Code
https://claude.ai/code/session_01TBJdDBRtJis5hzE244NQKV