Skip to content

test: stabilize devtools verify --all under xdist load - #1803

Merged
Sinity merged 1 commit into
masterfrom
feature/test/stabilize-verify-all-xdist
Jun 9, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/test/stabilize-verify-all-xdist

Conversation

@Sinity

@Sinity Sinity commented Jun 9, 2026 •

Copy link
Copy Markdown
Owner

Summary

devtools verify --all is now a reliable completion gate: a parallel bulk lane
plus an isolated single-process lane for wall-clock-bound tests, with the
Hypothesis profiles calibrated so per-example timing no longer flakes under
xdist worker contention.

Problem

devtools verify --all ran the whole non-integration suite in one -n 16
xdist pool. Load-sensitive tests failed intermittently while exact reruns of
the failed nodes passed (#1775). Two physical causes:

  • Hypothesis deadlines: property tests in test_schema_privacy,
    test_null_guard_properties, and test_machine_contract had no per-test
    deadline override, so they inherited Hypothesis's implicit 200ms deadline.
    Under 16-worker contention, per-example wall time is dominated by scheduling
    jitter, not algorithmic cost, and blows past 200ms.
  • Wall-clock budgets/timeouts: TestPerformanceBudget, the FTS-trigger
    amplification timing tests, the daemon web-reader loopback-socket diagnostic
    test, and the TUI render tests measure elapsed wall time that balloons under
    worker pressure.

Solution

  1. Hypothesis default/ci profiles set deadline=None and suppress
    HealthCheck.too_slow. Real perf regressions are caught by the dedicated
    TestPerformanceBudget / benchmark tests, not Hypothesis per-example
    timing. Global fix — future property tests can't regress into the same
    load-dependent deadline flake.

  2. load_sensitive marker on the wall-clock-bound classes. verify --all
    now runs two lanes:

    • bulk (-n 16): ... and not load_sensitive and not tui
    • isolated (-n 0 -p no:randomly): ... and (load_sensitive or tui),
      single-process with a stable order. Writes its own report artifacts so
      the bulk lane's _compare_against_last regression signal is preserved.

    Both lanes are correctness blockers; the split only removes scheduling
    jitter. Step names (pytest full (parallel) / pytest load-sensitive (isolated)) make the timing-sensitive lane explicit (AC5).

Verification

  • build_verify_steps(full_pytest=True) emits the two expected lanes with the
    correct -m expressions and worker counts.
  • Lane partition: 25 isolated-lane tests (load_sensitive + tui), named flaky
    perf/socket tests captured, zero overlap with the bulk lane, marker
    registered (no PytestUnknownMarkWarning).
  • Isolated lane single-process: 24 passed, 10532 deselected in 27.25s.
  • Previously-flaky property tests under the new profile: 3 passed in 2.15s.
  • mypy --strict devtools/verify.py: clean. devtools render-all --check: no
    committed-doc drift. Pre-push static gate: all green.

Closes #1775

Summary by CodeRabbit

  • Tests
    • Refined test execution strategy to isolate performance-sensitive tests in a dedicated single-process lane, preventing resource contention.
    • Enhanced Hypothesis testing configuration to improve test reliability and remove timing constraints.
    • Improved categorization of slow and resource-intensive tests for more efficient test runs.

## Problem

`devtools verify --all` ran the entire non-integration suite in one `-n 16`
xdist pool. Several wall-clock-bound and Hypothesis-deadline-bound tests failed
intermittently under worker contention while exact reruns of the failed nodes
passed (#1775), making `--all` an unreliable completion gate.

The flakes split into two physical causes:
- per-example wall time dominated by xdist scheduling jitter, not algorithmic
  cost, blowing past Hypothesis's implicit 200ms deadline (property tests in
  test_schema_privacy / test_null_guard_properties / test_machine_contract had
  no per-test deadline override);
- timing budgets, loopback-socket timeouts, and TUI render timing measuring
  elapsed wall time that balloons under 16-worker contention.

## Solution

Two-pronged, matching the issue's acceptance criteria:

1. Hypothesis `default`/`ci` profiles set `deadline=None` and suppress
   `HealthCheck.too_slow`. Real perf regressions are caught by the dedicated
   TestPerformanceBudget / benchmark tests, not Hypothesis per-example timing.
   This is a global fix — future property tests cannot regress into the same
   load-dependent deadline flake.

2. New `load_sensitive` marker on the wall-clock-bound classes
   (TestPerformanceBudget, the FTS-trigger amplification timing tests, the
   daemon web-reader diagnostic-socket class). `devtools verify --all` now
   runs two lanes: a parallel bulk lane (`-n 16`, deselecting
   `load_sensitive`/`tui`) and an isolated lane (`-n 0 -p no:randomly`) that
   reruns the timing-sensitive and TUI tests single-process with a stable
   order. Both lanes are correctness blockers; the split only removes the
   scheduling jitter. The isolated lane writes its own report artifacts so the
   bulk lane's regression-comparison signal is preserved.

## Verification

- `build_verify_steps(full_pytest=True)` emits the two expected lanes with the
  correct `-m` expressions and worker counts.
- Lane partition: 25 isolated-lane tests collected (load_sensitive + tui), the
  named flaky perf/socket tests captured, zero overlap with the bulk lane,
  marker registered (no PytestUnknownMarkWarning).
- Isolated lane single-process: `24 passed, 10532 deselected in 27.25s`.
- Previously-flaky property tests under the new profile: `3 passed`.
- `mypy --strict devtools/verify.py`: clean. `devtools render-all --check`: no
  committed-doc drift.

Closes #1775

Co-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Jun 9, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b9ace9d4-d779-498e-b7b2-2fe718f030ae

📥 Commits

Reviewing files that changed from the base of the PR and between 829e47a and da2143a.

📒 Files selected for processing (6)
  • devtools/verify.py
  • pyproject.toml
  • tests/benchmarks/test_fts_trigger_amplification.py
  • tests/conftest.py
  • tests/unit/daemon/test_web_reader.py
  • tests/unit/storage/test_scale.py

📝 Walkthrough

Walkthrough

This PR stabilizes devtools verify --all under xdist parallelization by introducing test isolation for timing-sensitive and database-sensitive tests. It defines a load_sensitive pytest marker, refactors the verification workflow to split full runs into parallel bulk and isolated single-process tiers, applies the marker to specific benchmark and diagnostic tests, and adjusts Hypothesis deadline settings to prevent flakiness under concurrent worker load.

Changes

Test Isolation and Xdist Load Stabilization

Layer / File(s) Summary
Marker definition and pytest configuration
pyproject.toml
The load_sensitive pytest marker is defined to categorize timing-budget and loopback-socket tests for isolated execution.
Verification workflow refactoring
devtools/verify.py
build_verify_steps() introduces a unified base_marker expression for skip-slow handling and splits --full/--all runs into two steps: a parallel bulk run that excludes load-sensitive and tui tests, and an isolated run targeting only those tests with single-worker execution (-n 0), disabled randomization, and separate junit/json outputs. The seed-testmon and default tiers are updated to use base_marker for consistent filtering.
Marker application to load-sensitive tests
tests/benchmarks/test_fts_trigger_amplification.py, tests/unit/daemon/test_web_reader.py, tests/unit/storage/test_scale.py
Four test classes and functions are marked with @pytest.mark.load_sensitive to route them into the isolated single-process lane: two FTS benchmark tests, the diagnostic query path test, and the performance budget test class.
Hypothesis deadline and health-check tuning
tests/conftest.py
Hypothesis profiles are updated to remove per-example deadline enforcement in CI and expand health-check suppression in the default profile to include differing-executors and too-slow warnings, reducing deadline flakiness under concurrent worker load.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Sinity/polylogue#1698: Main PR adds load_sensitive marker to the same two benchmark tests introduced in that PR.
  • Sinity/polylogue#1648: Main PR refactors devtools/verify.py pytest marker composition with base_marker in the testmon lane, which is covered by that PR's unit tests for marker filtering with --testmon.
  • Sinity/polylogue#1073: Both PRs modify devtools/verify.py's build_verify_steps() function to adjust tier construction and pytest invocation workflow.

Poem

🐰 A rabbit hops through xdist lanes,
Splitting slow tests from the main chains,
With load_sensitive markers bright,
Each test finds its perfect night—
Single-worker peace, no more pains! 🏃‍♂️✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/test/stabilize-verify-all-xdist

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@Sinity
Sinity merged commit 2c47c1c into master Jun 9, 2026
11 of 16 checks passed
@Sinity
Sinity deleted the feature/test/stabilize-verify-all-xdist branch June 9, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stabilize devtools verify --all under xdist load

1 participant