fix(test): feed read_bounded_json's stream contract in the slot-close race stub - #8534
fix(test): feed read_bounded_json's stream contract in the slot-close race stub#8534CrysisDeu wants to merge 1 commit into
Conversation
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Minimal test-only unblocker that fits the stub to [DESIGN-REVIEWED] 8f91264 |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 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: |
Opus 4.8 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: |
|
Heads-up so you do not spend a rebase on this: the same fix landed in #8536 twelve minutes ago (merged 20:47:24Z), which is why this PR just went
Context on why it mattered to more people than you: that fixture gap was reddening |
|
🤖 Kiro Crew Auto-Pipeline [operator: CrysisDeu#0c98c3a2] Review-ready. All owned checks green: the three verification targets this fix exists for — The only red is Merging this unblocks the |
|
🤖 Kiro Crew Auto-Pipeline [operator: CrysisDeu#0c98c3a2] Closing as superseded: #8536 (merged, Thanks to the #8536 author for landing the fix. This branch's verification run remains useful evidence: the same stub-contract change turned |
Summary
Unblocker for #8518:
test/test_slot_close_recreation_race.pyfails on every PR merge commit — worker crashes on the Windows shard,AttributeError: '_Req' object has no attribute 'can_read_body'plus timeouts on Linux — reddeningBackend Tests (Windows) (4),Backend Tests (3.12, 4)and the Coverage Gate on every open PR's merge ref.Closes #8518
Root cause
Two independently-green PRs crossed on main: the race-test module landed with a
_Reqstub that mocksjson(), and the tranche-3read_bounded_jsonsweep (#7308, commit9d3d279ac) convertedapi_chat_slot_delete/api_chat_slots_cleanup— the handlers this module drives — to read their body throughread_bounded_json(request, allow_absent=True), which touchesrequest.can_read_body(_shared.py:142) before ever callingjson(). Each PR's own merge ref predated the other, so neither CI run could see the collision.Fix
read_bounded_json's own docstring names the stand-in contract: "must feedcontent/content_lengthrather than mockingjson". The stub now carries exactly the surface the helper touches —can_read_body,content_length,charset, and acontentstream whoseiter_chunkedserves the serialized body — so it satisfies both theallow_absentshort-circuit (bodiless request →{}) and the capped stream-read path (explicitbody=→ served in chunks).json()is kept for direct callers.Test-file-only change; no runtime code touched.
What was tested
flake8,isort --check-only, diff-scoped black gate: pass. Test execution is delegated to CI per host policy (the failing jobs themselves are the verification: this module is the only red).Pattern harvest
Rule candidate: an aiohttp request stand-in that mocks
json()without implementingcan_read_body/contentbreaks silently when its handler is later swept ontoread_bounded_json._shared.py's docstring already states the contract; a sharedtest/fixture (one canonicalFakeRequest) would make the next sweep collision impossible instead of documented.Why no screenshot: backend test-stub change only; nothing renders.