Skip to content

軌道修正C-7 反証(1)(2)(3)是正: TRIM校正素材の作り直しとB/Cのsubsequence DTW再実装 - #102

Merged
github-actions[bot] merged 5 commits into
mainfrom
claude/checkin-v9yb0x
Aug 12, 2026
Merged

github-actions[bot] merged 5 commits into
mainfrom
claude/checkin-v9yb0x

Conversation

@rahiseko-alt

@rahiseko-alt rahiseko-alt commented Aug 12, 2026 •

Copy link
Copy Markdown
Owner

概要

PR #101(軌道修正C-7 反証(8)(9)是正、マージ済み)に続く、残る反証(1)(2)(3)の是正です。着手前の調査で、G-EDIT-TRIM-B/C が凍結しているMFCC+DTW検証方法はこのリポジトリの全履歴に一度も実装されたことが無いと判明していました(criteria本文の数値はroadmap散文にしか存在せず、コード・fixture・evidenceのいずれにも無い)。今回、fixtureの作り直しと新規実装を行いました。

このPRでやったこと

反証(2)(3)是正: 校正素材の作り直し

video-shorts/tests/fixtures/trim-calibration/calibration.flac/calibration.json を作り直しました。

  • index6を「あのー」→「なんか」(0.923秒)、index7を「こんにちは」→「はい」(0.772秒)へ差し替え。
  • 語4つ(こんにちは/ありがとう/よろしく/はい)がすべて異なる語になり、旧素材の重複語(index1/7が同じ「こんにちは」)を検出できない欠陥(反証(2))を解消。
  • フィラー最長(なんか0.923秒)が語最短(はい0.772秒)を上回るため、「0.9秒未満を機械的に切るだけ」の単純な長さヒューリスティックでは分離できない構成にした(反証(3))。実際にplanTrimの出力と文字列比較する対照テストをtrim-plan-check.mjsに追加。
  • index0〜5は秒数設計値が旧素材と完全一致(変更なし)。espeak-ng 1.51 (Ubuntu 24.04 noble、ビット単位の再現性を確認済み)で合成。
  • G-EDIT-CAPTION-D(done済み)が依存する「こんにちは」(index1)はそのまま残しており、実際にfaster-whisperで文字起こしして依存が壊れていないことを実機確認済み(term-apply-check.py)。

反証(1)是正: G-EDIT-TRIM-B/Cの照合方法を全面作り直し

旧verifyが凍結していた「探す側(フィラー参照音声)と同じ長さの窓を10msホップでtargetに滑らせ、DTW距離の最小値を採る」方式は、フィラー音声の一部だけが残った半端カット(75〜90%残置)を検出できない構造上の欠陥がありました(窓の長さを固定するため、残置区間+隣接する別内容が窓に混ざり整合が乱れる)。

開始・終了位置自由の subsequence DTW(query全体を使い切ることを要求しつつtarget側の位置は固定しない)へ全面作り直しました。新規実装 video-shorts/tests/trim-filler-match-check.py(MFCC抽出・DTWともnumpyのみ。scipy/librosa等の追加依存なし)。判定対象の出力音声は video-shorts/tests/trim-filler-audio-helper.mjs が本物の buildTrimFilters(src/trim-plan.mjs)を呼んで作ります(判定ロジックの再実装はしていません)。

しきい値はcalibration.jsonのidentity_pairs_for_i(同一区間・AAC再エンコード対、実測上限10.770)とdifferent_word_pairs_for_ii(異なる語同士の対、実測下限24.209)の中点(17.489)として実測から算出しました。反証(1)が実測していた90%/75%残置のフィラーを、この新素材の2区間(index0/6)で再現する対照テストを追加し、いずれも「まだ含まれている」と正しく判定されることを実測で確認しています(25%/50%残置は検出できる場合とできない場合があったため、受入事実として断定する範囲を反証(1)が実測していた75%/90%に絞りました)。

ローカル実行で21/21 PASS。

G-EDIT-TRIM-A/D

fixture変更に伴うSHA・数値参照の追随更新のみです(判定ロジック・しきい値は変更していません)。

meta.basisChanges

G-EDIT-TRIM-A/B/C/D の4件を追記しました(いずれも凍結済み葉のcriteria変更のため必須)。

本人採点の禁止

G-EDIT-TRIM-B/C/A/D は今回いずれも done 化していません(status継続=doing)。criteriaの再凍結・実装・ローカル実行での確認までがこのPRの成果です。

テスト

pnpm -r --if-present typecheck   # OK
pnpm -r --if-present lint        # OK
pnpm -r test                     # 全件PASS(新テスト含む)
pnpm -r --if-present build       # OK
pnpm audit --audit-level moderate  # No known vulnerabilities
node scripts/verify-roadmap-evidence.mjs                        # OK
BASE_REF=origin/main node scripts/verify-criteria-freeze.mjs    # OK
BASE_REF=origin/main node scripts/verify-done-gate.mjs          # 対象外(新規doneなし)

Generated by Claude Code

Summary by CodeRabbit

  • Tests
    • Added automated validation for filler trimming, including partial, missing, and passthrough audio scenarios.
    • Added the new filler-matching validation to the standard test suite.
    • Expanded regression checks for trim plans, durations, segment classification, and seam handling.
  • Test Fixtures
    • Updated calibration audio and metadata with refreshed timings, hashes, and segment content.
    • Added documentation and reproducibility details for the shared calibration materials.

反証(2)(3)是正のためcalibration.flac/jsonを作り直した(index6をあのー→なんか、
index7をこんにちは→はいへ差し替え)。語4つがすべて異なる語になり、フィラー最長が
語最短を上回るため単純な長さヒューリスティックでは分離できない構成にした。

反証(1)(等長窓スライドDTWがフィラー音声の75〜90%残置を検出できない構造上の欠陥)
是正のため、G-EDIT-TRIM-B/Cの照合方法を開始・終了位置自由のsubsequence DTWへ
全面作り直した(video-shorts/tests/trim-filler-match-check.py、numpyのみで実装)。
判定対象の出力音声はvideo-shorts/tests/trim-filler-audio-helper.mjsが本物の
buildTrimFiltersを呼んで作る。

TRIM-A/DはSHA・数値参照の追随更新のみ。関連するmeta.basisChangesを4件追記。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MAUag1h71G7iuEjp4hz9Y
@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f2699aa6-642b-4434-a02e-a937b08f1db1

📥 Commits

Reviewing files that changed from the base of the PR and between 0e9b187 and e73758b.

⛔ Files ignored due to path filters (1)
  • video-shorts/tests/fixtures/trim-calibration/calibration.flac is excluded by !**/*.flac
📒 Files selected for processing (11)
  • docs/roadmap.html
  • video-shorts/package.json
  • video-shorts/tests/fixtures/trim-calibration/README.md
  • video-shorts/tests/fixtures/trim-calibration/calibration.json
  • video-shorts/tests/term-apply-check.py
  • video-shorts/tests/trim-caption-sync-check.mjs
  • video-shorts/tests/trim-duration-check.mjs
  • video-shorts/tests/trim-filler-audio-helper.mjs
  • video-shorts/tests/trim-filler-match-check.py
  • video-shorts/tests/trim-plan-check.mjs
  • video-shorts/tests/trim-seam-glitch-check.mjs

📝 Walkthrough

Walkthrough

Changes

The trim calibration fixture now uses refreshed audio and metadata. New helpers generate trimmed AAC output and validate filler matching with MFCC and subsequence DTW. Existing trim tests use updated hashes, durations, frame ranges, and word classifications.

Trim filler validation

Layer / File(s) Summary
Calibration materials and audio generation
video-shorts/tests/fixtures/trim-calibration/*, video-shorts/tests/trim-filler-audio-helper.mjs
The frozen fixture metadata and segment words are refreshed. The helper uses buildTrimFilters to generate concatenated AAC output with seam fades.
Filler audio matching
video-shorts/tests/trim-filler-match-check.py
The new validator extracts MFCC features, applies subsequence DTW, calibrates a threshold, and checks trimmed, partial, missing-word, and passthrough outputs.
Trim acceptance and regression checks
video-shorts/tests/term-apply-check.py, video-shorts/tests/trim-caption-sync-check.mjs, video-shorts/tests/trim-duration-check.mjs, video-shorts/tests/trim-plan-check.mjs, video-shorts/tests/trim-seam-glitch-check.mjs, video-shorts/package.json
Existing checks use refreshed fixture hashes, durations, frame ranges, filler classifications, and word data. The package test command includes the new validator.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Matcher as trim-filler-match-check.py
  participant Helper as trim-filler-audio-helper.mjs
  participant Filters as buildTrimFilters
  participant FFmpeg as FFmpeg/FFprobe
  Matcher->>Helper: Invoke the real trim helper
  Helper->>Filters: Compute KEEP spans
  Helper->>FFmpeg: Render trimmed AAC output
  Matcher->>FFmpeg: Decode audio and extract features
  Matcher->>Matcher: Calibrate threshold and validate DTW matches
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the C-7 corrective work, calibration fixture rebuild, and subsequence DTW reimplementation, which match the pull request objectives.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/checkin-v9yb0x

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

claude added 4 commits August 12, 2026 14:43
反証1(sufficient): TRIM-Bのcriteria.textが「75%以上の残置も含めて含まれていない」と無条件に
書いていたが、verifyが実測していたのは0%と75%/90%(2区間のみ)だけだった。フィラー4区間×
25〜70%を実測すると検出境界が50〜65%の間でフィラーごとに揺れ、非単調な区間もあると判明。
受入事実を「65%以上は必ず検出される(4区間×3水準で実測)。25〜64%は対象外」へ絞った。

反証2(probed): TRIM-Cに「語が丸ごと消えた壊れた実装」を実際に落とせることを示す実行記録が
無かった。trim-filler-match-check.pyへ語4区間それぞれを丸ごと欠落させる対照テストを追加。

反証3(sufficient): G-EDIT-CAPTION-Dのdetailが「index1/7はこんにちは」という、今回のfixture
変更で誤りになった記述のまま残っていた。index1のみに修正。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MAUag1h71G7iuEjp4hz9Y
G-EDIT-TRIM-E.criteria[0].verifyとG-EDITOR.detail(素材TV/素材Qの定義)が、
2026-08-12のcalibration.flac/json作り直し後もPR-1時点の実測長11.402812秒を
参照したままだった。実測値11.052517秒へ更新し、素材Qの連結式(5×11.052517=
55.262585秒)・末尾無音の長さ(4.737415秒)も追随して直した。日付つきの過去の
是正記録(2026-08-11 C-14等)はそのまま残し、旧値がいつの値だったか明記した。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MAUag1h71G7iuEjp4hz9Y
meta.next/meta.handoff.done[0]が、既に完了した(1)(2)(3)是正をまだこれからの
作業として案内し続けていた(3コミット分の更新漏れ)。本セッションの実施内容・
トラブル・次回申し送りへ更新した。trim-plan-check.mjs:47の旧尺コメント(11.403)
も新尺(11.053)へ修正した。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MAUag1h71G7iuEjp4hz9Y
meta.next/handoffの是正コミットが「C-7は全件[x]済み」と案内する一方、GOAL.detail
本体のC-7チェックリスト項目は[ ]未チェックのまま旧い「未処理5件」の記述が残って
いた。(8)(9)(PR #101)・(1)(2)(3)(PR #102)の反映を記録し[x]へ更新した。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MAUag1h71G7iuEjp4hz9Y
@rahiseko-alt
rahiseko-alt marked this pull request as ready for review August 12, 2026 15:20
@github-actions
github-actions Bot merged commit cf9a720 into main Aug 12, 2026
14 checks passed
@github-actions
github-actions Bot deleted the claude/checkin-v9yb0x branch August 12, 2026 15:24
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