Repository navigation
fix: 接通 youtube-api 分支的转录时限预算时长(预算值不变,纯可见性) - #178
Merged
Merged
Conversation
youtube-api 分支的音轨准入早就在跑 ffprobe 并解析出 format.duration, 但返回值被丢弃,Transcriber.transcribe 只拿两参调用,于是该路径恒走 SDK 自动预算,本仓日志里始终是 duration=unknown fallback=sdk_auto。 把 _ensure_audio_track 的返回值接住,传给既有的 media_duration 实参: 不新增探测(仍是准入那一次 ffprobe),不改预算公式,不碰通用分支, 不动 FunASR 路径(它不经过 deadline_total,接时长无意义)。 预算值不变:传参走本仓 duration*4.0+120.0,不传走 SDK 492fe191 的 _auto_budget 同为 duration*4+120,两边数值相同,本卡只换来可见性与 「SDK 再改公式时本仓显式值仍优先」的解耦。 probed_media_duration 为 None 时保持两参调用形状,不无条件传 None。 Agent-Executor: ocgo-bunny-pi Agent-Model: space-bunny-free Agent-Effort: high Dispatch-Id: dlg-20261005-130606-63736f Task-Id: VideoTranscriptAPI-20261005-06
Required Gate v2 — 状态面板当前状态:pass · 可合并 当前裁决:
Gate 历史(v1;来源为持久化
|
| Run | Attempt | Head | 状态 | 收件人动作 |
|---|---|---|---|---|
| 37318638699 | 1 | e2c4bda |
pass |
可合并 |
历史行按 run_id + run_attempt 去重并只增不删;删除本评论后可由 gate_terminal 制品重建。
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.
背景
#173 把「准入探测出的时长」接到了通用分支,但 youtube-api 分支(
transcription.py:2056准入 +2105转录调用)当时按卡面锁定刻意没接,所以那条路径至今仍是duration=unknown fallback=sdk_auto,本仓日志看不到它的时长与预算。当时不敢接的理由是「会改变非 generic 路径的预算行为」。这个理由现在不成立了——主干 SDK pin 已是
492fe191,上游 PR #71 把 SDK 自动预算也改成了 4 倍:b0818dc492fe191max(120, duration+60)duration*4+120media_duration的实际预算传与不传算出来的预算值完全相同,本 PR 只换来可见性与解耦,不改变任何任务的预算值。
执行前的前置核实(卡面「不成立就停手」那条)
核实前发现该 worktree 无
.venv,而主仓.venv正是本仓历史上的错位版本(858c6b9),因此先
uv sync重建本 worktree 自己的环境再核实 pin:SDK 自动预算公式原文(
capswriter_asr/client.py:430-441):本仓公式(
capswriter_client.py:122-123, 260):media_duration=d_transcription_deadlined * 4.0 + 120.0None)_auto_budgetd * 4 + 120改动
全部落在 youtube-api 分支,行 2056–2116,共 +12/-2:
通用分支所在的 2440–2540 区间零 hunk(#173 的成果原样保留)。
新增
tests/unit/test_youtube_api_duration.py(269 行 / 18 用例),走真实入口process_transcription,复用test_transcription_audio_admission.py的wiredfixture 与替身类,不依赖
/tmpfixture、不依赖 PATH 上的 ffmpeg。锁定决策
None时不传:保持既有两参调用、kwargs == {},不得无条件传None(既有调用形状有外部 mock 锁着)。
_ensure_audio_track的返回值,不新增第二次探测、不新增缓存字段。use_speaker_recognition=True):它走FunASRSpeakerClient,不经过 CapsWriter 的
deadline_total。一处诚实说明:时长口径
SDK
_auto_budget的d来自解码后的 samples 数(samples_total / _RAW_SAMPLE_RATE),本仓的
d来自 ffprobe 的format.duration。公式系数与量级相同,但两者不会逐位相等(转码重采样/截断带来小数级差异)。这是 #173 起就存在的既有口径,本 PR 只是把同一口径
扩展到 youtube-api 分支——换句话说,这轮改动是让两条 CapsWriter 路径收敛到同一口径,
而不是引入第三种。若日后要求严格一致,需单开一卡统一,不宜夹带。
验收证据
make test→ 3677 passed / 3 skipped / 0 failed,exit=0(3 个 skip 是test_capswriter_samples_total_contract.py的既有 skip,需真实录音样本,与本 PR 无关)。(
test_youtube_api_duration_reaches_transcriber、test_probe_duration_is_the_real_parsed_value);恢复后 18 passed,工作树干净。
media_duration=None)→ 该参数化 9 条全红,证明「不得无条件传
None」有独立判据锁着,不是靠通读代码。SingleProbeRunner对第二次子进程调用当场AssertionError(不新增探测);每个用例先断言
rec.methods == ["fetch_for_transcription"],杜绝「改动落在通用分支、测试假绿」。本 PR 没做什么
capswriter_client.py一字未动)。_ensure_audio_track本身。transcriber/**、downloaders/**、config/**、api/routes/**、CI 配置。见
zlxlabs/CapsWriter-ASR-Server#76),本 PR 完全没碰。