Deadline and time budget: #[Property(timeoutMs:, budgetMs:)]#17
Merged
Conversation
- timeoutMs: wall-clock deadline for a single run (random or example); overrun fails with DeadlineExceededException naming the pathological input (reported unshrunk - timed shrinking is non-deterministic). Measured post-run; an assertion failure in the same run wins. - budgetMs: wall-clock budget for the whole random phase; running out before the requested checks complete fails with TimeBudgetExceededException exposing completed/required counts.
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.
Deadline + time budget (roadmap 2.6.0, «Идея 4»): pathological inputs (catastrophic regex, deep recursion, unbounded backoff, slow stateful sequences) show up as time, not as assertion failures. Two opt-in wall-clock caps turn them into reported failures.
What changed
timeoutMs— deadline for a single run (random or explicit example). A body that takes longer fails the property with a new@api DeadlineExceededException(fields:propertyName,argumentsincl.draw#N,elapsedMs,timeoutMs):budgetMs— budget for the whole random phase. Running out beforerunssuccessful checks complete fails with a new@api TimeBudgetExceededException(budgetMs,elapsedMs,successfulRuns,requiredRuns) — a slow property cannot silently check less than it claims.Semantics (deliberate)
hrtimearound the body): a body that never returns cannot be interrupted in synchronous PHP — this catches bounded-but-slow inputs, not true hangs (cf. the time-limiter non-viability analysis).timeoutMstoo; positional example arguments are reported under their parameter names.null(disabled); values must be >= 1 ms (attribute validation).hrtimedomain); ms floats are computed only for reporting.Verification
composer build: green — 645 tests / 270407 assertionscomposer rector(dry-run): cleanmake mutation: MSI 90.5% ≥ minMsi 90 (exit 0); +6 escaped vs previous run are timing-boundary equivalents (>vs>=on ns values — a 1 ns exact tie is unreachable deterministically)usleepdeltas (5/20 ms) far above scheduler noise, with wide assertion bands (>= 19 ms,< 60 s) that also kill unit-conversion mutants## 2.6.0 — Unreleased) updatedCloses the 2.6.0 feature set: generics (#15) + shrink diagnostics (#16) + deadline (this PR). After merge, 2.6.0 release = CHANGELOG date + tag on post-merge HEAD.