Repository navigation
test(stream): 补视频号流式端点两格回归锁(#11 首窗建连失败、#13 suffix+wildcard) - #36
Merged
zj1123581321 merged 1 commit intoSep 23, 2026
Merged
Conversation
Required Gate v2 — 状态面板当前状态:pass · 可合并 当前裁决:
Gate 历史(v1;来源为持久化
|
| Run | Attempt | Head | 状态 | 收件人动作 |
|---|---|---|---|---|
| 35838239000 | 1 | 12076d8 |
pass |
可合并 |
历史行按 run_id + run_attempt 去重并只增不删;删除本评论后可由 gate_terminal 制品重建。
zj1123581321
deleted the
card/MediaResolverAPI-stream-lock-tests-260923
branch
September 23, 2026 08:44
This was referenced Sep 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
为什么
分诊复核 #11 / #13 时在主脑在
cb1e2b9上实测:#11、#13 描述的缺陷都已修复(#11-1 首窗建连失败已收拢成UpstreamDisconnected并重试后回 502 JSON;#11-2 重复构造的 client 已由ef9af01删除,全文件只剩一处构造;#13-P2-1 有test_mid_file_short_content_range_fails_before_streaming锁住)。缺的只是两格回归锁——这两格当初找不到锁,正是「缺陷还在不在」要重新实测的原因。本 PR 只补锁,不改生产代码。
改法
新增
tests/test_stream_boundary_locks.py(60 行,2 用例),桩打在真实生产者边界app.api.stream.open_cdn_stream,走真实端点 + 真实 lifespan 入口:test_first_window_connect_error_retries_and_returns_502_json502、!= 500、application/json、open_cdn_stream调用 ≥ 2(被收进可重试链路)test_suffix_range_wildcard_complete_length_fails_before_streamingContent-Range: bytes 0-0/*一律 502,不产出成功响应502、!= 200、!= 500、application/json、媒体流aiter_calls == 0、探针流已aclose实测与红验
ConnectError→ 502 且调用 3 次;grep -n "httpx.AsyncClient(" app/api/stream.py仅剩 89 行一处;既有test_mid_file_short_content_range_fails_before_streaming1 passed),确认「已修」不是读代码推断。_read_window的except _UPSTREAM_FAIL收窄成except UpstreamDisconnected→ 用例 1 转红assert 500 == 502,还原后绿;if total is None: raise ...→ 用例 2 转红assert 500 == 502(NoneType - int),还原后绿。uv run --extra dev python -m pytest tests/ -q→ 415 passed。影响范围
只新增一个测试文件;生产代码、既有测试文件零改动。
备注
Refs #11、Refs #13(关单由主脑在合入后带证据执行)。