Repository navigation
test: 0.13 backport, share each collected item's fixture bookkeeping to cut group 7 worker memory (#37814) - #37884
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. This is a straight cherry-pick of main's memory fix plus one guard step. That step is needed because a test in the pick asserts no other item holds a request, which fails once a neighbour's timeout escapes. What this change shipsInventory (6 items) — 5 justifiedIntent: make Backend Tests (3.12, 7) pass on
[FIRST-PRINCIPLES-REVIEWED] eb5cafe Description read[DESCRIPTION-READ] 9a08e9aa3ee3f7e3fd59003d931544be2d3032e7ba79a9aec69e06572223a27a That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: a test-infrastructure backport of main's fix, plus a guard step that does the same cleanup pytest's own protocol does at its end. Notes
[DESIGN-REVIEWED] eb5cafe Description read[DESCRIPTION-READ] d77327914599a835051dd0a59c845ba7792dbe569be1c017aa234b87369a036a That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
2837764 to
2fae50a
Compare
(cherry picked from commit 433f545)
8f1ec2f to
50a0b64
Compare
When pytest-timeout's pytest.fail escapes pytest_runtest_protocol, the rootdir conftest's escape guard synthesizes the missing reports and runs teardown, but runtestprotocol's last step never ran: the item keeps its rebuilt TopRequest and funcargs. On the same xdist worker, test_no_collected_item_waits_with_a_request_built then fails beside the timed-out neighbour and blames collection. The guard now takes that step itself (item._request = False, item.funcargs = None), as runtestprotocol does, and a parametrized test drives each of its three branches with an item holding a request.
Problem / Motivation
Goal: Backend Tests (3.12, 7) passes on
release/0.13.0again, so 0.13 backport PRs are not red for a reason they did not cause.On #37598 (head
302590dbfe), Backend Tests (3.12, 7) failed three runs in a row with the same two reds. In run 43811874378 the shard ends2 failed, 31696 passed:test/test_transcribe.py::TestPcmFromWav::test_truncated_header_returns_none_rather_than_raising[4]:worker 'gw5' crashed, thenxdist: worker gw5 crashed and worker restarting disabledtest/test_testing_determinism_helpers.py::test_the_helper_modules_import_without_pytest:subprocess.TimeoutExpiredon its pytest-free import childNeither test is touched by #37598. Both come from per-worker memory pressure that main already cut.
Why it matters
Backend Tests is a blocking job. While this shard dies on the release branch, every 0.13 backport PR that lands in group 7 is red, and a real regression there cannot be told apart from this one.
Not a goal
src/change and no product behaviour change.What changed (motivation -> approach -> change)
Symptom: an xdist worker is killed and a subprocess times out in group 7. Root cause: per-worker memory during collection is high on the branch. Change: cherry-pick main's fix unchanged (
git cherry-pick -x, no conflicts).433f545103), "perf(test): share each collected item's fixture bookkeeping":conftest.pyshares fixture bookkeeping across collected items (main measured the collection peak per worker at 5,295 -> 2,957 MiB), withtest/test_worker_memory_retention.py, adocs/system-specs/common/testing-conventions.mdsection and a writing-tests skill note.The second commit closes a gap the Opus review found in the pick. When pytest-timeout's
pytest.failescapespytest_runtest_protocol, the rootdir conftest's escape guard writes the missing reports and runs teardown, butruntestprotocol's last step (item._request = False; item.funcargs = None) never runs. That item keeps its rebuilt request, sotest_no_collected_item_waits_with_a_request_builtwould fail on any worker where a neighbour timed out, and blame collection. The guard now takes that step itself, andtest/test_xdist_escaped_failure_guard.pygains a test that drives each of the guard's three branches with an item holding a request (it fails 3 of 3 without the conftest change). main has the same gap; this fix is not on main yet.The first version of this PR also picked #36575 (stop
kiro_crew.testingimporting its submodules at package import).release/0.13.0now carries that commit itself, so the rebase onto2fae50aae7dropped it as already upstream.Backwards compatibility
Compatible: test infrastructure, a test file and docs only; no
src/change, so nothing that works today stops working.Removes nothing: the change shares identical per-item fixture bookkeeping, and after an escaped timeout it clears the same two fields pytest clears after every test; no fixture, test or product behaviour is taken away.
Tests
Proof: not provable -- test-only change
Local, Python 3.12,
-n 2, on the rebased tree:test/test_worker_memory_retention.py,test/test_testing_determinism_helpers.py,test/test_transcribe.py: 283 passed, 1 skippedtest/test_harness.py,test/test_real_kiro_smoke_gating.py: 129 passed, 1 skippedtest/test_xdist_escaped_failure_guard.py,test/test_worker_memory_retention.py,test/test_testing_determinism_helpers.py,test/test_transcribe.py,test/test_conftest_parts_reach.py: 340 passed, 1 skipped; the new test alone fails 3 of 3 with the conftest change revertedconftest.pyandtest/test_xdist_escaped_failure_guard.py./scripts/docs-lint.sh: All documentation checks passedManual verification
N/A -- the CI shard this PR fixes is the check.
Related Issues
Unblocks Backend Tests (3.12, 7) on #37598. Backports #37814.
Sibling sweep
Swept: the short test summary of Backend Tests (3.12, 7) on #37598 (run 43811874378), the only red shard of that run
Sibling: test/test_transcribe.py -- not changed (crash victim, fixed by the memory pick)
Sibling: conftest.py pytest_runtest_protocol escape guard -- changed here (left a request on an item whose timeout escaped)
Sibling: test/test_testing_determinism_helpers.py -- not changed (its import-cost fix, #36575, is already on the branch)
Pattern harvest
Not generalizable: release branches miss main's test-infrastructure fixes until they are picked; the shard failure on a backport PR is how this one was found.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.