Skip to content

Authenticate xdist StatusDB connections - #358

Merged
icemac merged 6 commits into
pytest-dev:masterfrom
janmrow:authenticate-statusdb
Sep 1, 2026
Merged

Authenticate xdist StatusDB connections#358
icemac merged 6 commits into
pytest-dev:masterfrom
janmrow:authenticate-statusdb

Conversation

@janmrow

@janmrow janmrow commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Generate a per-session token on the xdist controller and pass it to workers through workerinput.

StatusDB now requires a successful handshake before processing commands and rejects clients with an invalid token.

Tests cover the authentication check and passing the connection details to workers.

@janmrow
janmrow marked this pull request as ready for review August 27, 2026 15:33

@icemac icemac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the handshake against the branch (suite also run under xdist: 175 passed). The change itself is sound — the token is assigned before run_server starts, the with conn, suppress(...) nesting order is right, failures_db is always a ServerStatusDB where .token is read, the token survives execnet serialization, and both new tests fail before the change and pass after.

Three things on the error paths, though; the first two chain into a session hang under xdist.

Comment created by Claude

Comment thread src/pytest_rerunfailures.py Outdated
Comment thread src/pytest_rerunfailures.py
Comment thread src/pytest_rerunfailures.py
@icemac
icemac merged commit 69ac0a7 into pytest-dev:master Sep 1, 2026
44 checks passed
lukasmasuch pushed a commit to streamlit/streamlit that referenced this pull request Sep 7, 2026
…roup (#16852)

Bumps the python-testing group with 1 update:
[pytest-rerunfailures](https://github.com/pytest-dev/pytest-rerunfailures).

Updates `pytest-rerunfailures` from 16.6 to 16.6.1
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/pytest-dev/pytest-rerunfailures/blob/master/CHANGES.rst">pytest-rerunfailures's
changelog</a>.</em></p>
<blockquote>
<h2>16.6.1 (2026-09-03)</h2>
<p>Bug Fixes
+++++++++</p>
<ul>
<li>Ensure teardown reports are passed to
<code>pytest_runtest_logreport</code> for rerun
attempts.
(<code>[#237](pytest-dev/pytest-rerunfailures#237)
&lt;https://github.com/pytest-dev/pytest-rerunfailures/issues/237&gt;</code>_)</li>
<li>Prevent superseded built-in subtest failures from remaining in the
final test
result when rerunning tests with pytest-xdist.
(<code>[#350](pytest-dev/pytest-rerunfailures#350)
&lt;https://github.com/pytest-dev/pytest-rerunfailures/issues/350&gt;</code>_)</li>
<li>Restore module, class, and session scoped fixture teardown when a
<code>flaky</code>
marker condition is falsy.
(<code>[#351](pytest-dev/pytest-rerunfailures#351)
&lt;https://github.com/pytest-dev/pytest-rerunfailures/issues/351&gt;</code>_)</li>
<li>Restore module, class, and session scoped fixture teardown when an
error
raised during teardown rules out a re-run.
(<code>[#356](pytest-dev/pytest-rerunfailures#356)
&lt;https://github.com/pytest-dev/pytest-rerunfailures/issues/356&gt;</code>_)</li>
<li>Keep module, class, and session scoped fixtures alive across re-runs
of a
test whose call phase failed through subtests only.
(<code>[#357](pytest-dev/pytest-rerunfailures#357)
&lt;https://github.com/pytest-dev/pytest-rerunfailures/issues/357&gt;</code>_)</li>
<li>Authenticate xdist StatusDB connections with a per-session token.
(<code>[#358](pytest-dev/pytest-rerunfailures#358)
&lt;https://github.com/pytest-dev/pytest-rerunfailures/issues/358&gt;</code>_)</li>
<li>Ensure negative rerun counts do not skip the initial test execution.
(<code>[#359](pytest-dev/pytest-rerunfailures#359)
&lt;https://github.com/pytest-dev/pytest-rerunfailures/issues/359&gt;</code>_)</li>
</ul>
<p>Misc
++++</p>
<ul>
<li>Replace deprecated <code>Config.getvalue()</code> calls with
<code>Config.getoption()</code>.

(<code>[#345](pytest-dev/pytest-rerunfailures#345)
&lt;https://github.com/pytest-dev/pytest-rerunfailures/issues/345&gt;</code>_)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/pytest-dev/pytest-rerunfailures/commit/dad07a7f360e96c0cbbc4301e36cdc439eb9a36b"><code>dad07a7</code></a>
Preparing release 16.6.1</li>
<li><a
href="https://github.com/pytest-dev/pytest-rerunfailures/commit/968fb6c1d3982ea35f041ecb62024e79016324bb"><code>968fb6c</code></a>
Prevent negative reruns from skipping initial execution (<a
href="https://redirect.github.com/pytest-dev/pytest-rerunfailures/issues/360">#360</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-rerunfailures/commit/367df9044cbcf3bbf153269bdab995e1f9eb113c"><code>367df90</code></a>
Keep higher-scoped fixtures alive across re-runs of failed subtests (<a
href="https://redirect.github.com/pytest-dev/pytest-rerunfailures/issues/357">#357</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-rerunfailures/commit/69ac0a7e66f1f55c1e94a2f237e2659250795ef7"><code>69ac0a7</code></a>
Authenticate xdist StatusDB connections (<a
href="https://redirect.github.com/pytest-dev/pytest-rerunfailures/issues/358">#358</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-rerunfailures/commit/20decd37b22736b1a92ecb7a6ed598e7fd70cff1"><code>20decd3</code></a>
Restore higher-scoped teardown when a teardown error rules out a re-run
(<a
href="https://redirect.github.com/pytest-dev/pytest-rerunfailures/issues/356">#356</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-rerunfailures/commit/84af73d63c1ac3eeeeba73a5e3ac91a44078c7bb"><code>84af73d</code></a>
Fix subtest rerun reporting with xdist (<a
href="https://redirect.github.com/pytest-dev/pytest-rerunfailures/issues/352">#352</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-rerunfailures/commit/d784cdda0b946c8788939255b6b72df67da82a19"><code>d784cdd</code></a>
Test with pytest-xdist on CI (<a
href="https://redirect.github.com/pytest-dev/pytest-rerunfailures/issues/354">#354</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-rerunfailures/commit/9f85e063dac5387cb0b17ffcb8aadeca545292a8"><code>9f85e06</code></a>
Restore higher-scoped teardown when a flaky condition is falsy (<a
href="https://redirect.github.com/pytest-dev/pytest-rerunfailures/issues/351">#351</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-rerunfailures/commit/eab650fb2a2665d61539aafda81ae549440c2834"><code>eab650f</code></a>
Test rerun-except for setup errors (<a
href="https://redirect.github.com/pytest-dev/pytest-rerunfailures/issues/349">#349</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-rerunfailures/commit/0b0843a83fb7e79c37e626092a77c5f7cd49f4df"><code>0b0843a</code></a>
Fix only_rerun marker precedence test (<a
href="https://redirect.github.com/pytest-dev/pytest-rerunfailures/issues/348">#348</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/pytest-dev/pytest-rerunfailures/compare/16.6...16.6.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pytest-rerunfailures&package-manager=uv&previous-version=16.6&new-version=16.6.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions


</details>

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Lockfile-only test dependency patch with bug fixes; low impact outside
pytest rerun/xdist paths.
> 
> **Overview**
> Updates the locked **`pytest-rerunfailures`** dependency from **16.6**
to **16.6.1** in `uv.lock` (sdist/wheel URLs and hashes only). No
`pyproject.toml` or application code changes.
> 
> The new patch release mainly fixes rerun/teardown behavior
(higher-scoped fixtures, subtests, xdist reporting) and adds a
per-session token for xdist StatusDB connections. CI that uses
`--reruns` or the `flaky` marker should see more reliable fixture
lifecycle and reporting.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
4ad93d6. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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.

2 participants