← Back to Pull requests

test(iast): disable the hypothesis deadline in IAST property tests DD_7U8JJD #22023

Closed
unknown closed this pull request without merging on Nov 23, 2026 15:52 UTC
View on GitHub
unknown unknown commented on Nov 23, 2026 13:50 UTC
Author

Description

Related to https://datadoghq.atlassian.net/browse/APPSEC-71951

test_aspect_patched_result_hypothesis[py3.10] flaked once in the merge queue, out of about 61.5k runs in 90 days. Hypothesis reported produces unreliable results: Falsified on the first call but did not on a subsequent one for text_input='', and the automatic retry passed.

'' is the first example Hypothesis tries, and the test ran on a cold xdist worker, where the first call into every aspect also pays for lazy initialization. The failing run took 625 ms in total for about a dozen calls, while a passing py3.10 run takes about 1.6 ms per example. So the first call took roughly 600 ms, well over the 250 ms limit Hypothesis applies while generating (the 200 ms default deadline × 1.25). Hypothesis prints which case it hit, "Unreliable test timings" or "Failed to reproduce exception", only in the failure report. That report was never printed because the retry passed, so a slow first call that raised another error can't be fully ruled out.

No IAST property test checks timing, so iast_hypothesis_test now sets deadline=None. This applies to the 8 tests that use it: test_add_aspect, test_add_inplace_aspect, test_aspect_patched_result_hypothesis, test_fstring, test_strip_aspect, test_rstrip_aspect, test_lstrip_aspect and test_taint_pyobject_all. The six property tests that set @settings(max_examples=1000) themselves (five in test_fstrings.py, plus test_taint_pyobject) keep the default deadline, since none of them has flaked.

Customer impact

None, test-only change.

Testing

  • appsec_iast_default (Python 3.10), every test matching hypothesis: 39 passed, 3 skipped.

  • scripts/lint checks passes.
  • Risks

    None. A hanging test is still stopped by the suite's 30-minute job timeout. The deadline no longer doubles as an incidental speed check on aspects; the IAST benchmarks cover performance.

    Additional Notes

    No release note: test-only change.

    DD_7U8JJD

    🤖 Generated with Claude Code

    Diff: 258 lines (+193 / -65) across 3 files Reviewer: avara1986 Review duration: 122m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 258 lines diff across 3 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.332
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #22023"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 39.2% (MEDIUM) · Higher = larger blast radius
    39.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.5% · Safe to merge
    15.5%