Skip to content

feat(moqt,relay): Malformed Track検出時に上流subscriptionをUNSUBSCRIBEし、進行中のfetchをFETCH_CANCELする - #327

Merged
yuki-uchida merged 8 commits into
masterfrom
claude/malformed-track-upstream-cleanup
Sep 3, 2026
Merged

feat(moqt,relay): Malformed Track検出時に上流subscriptionをUNSUBSCRIBEし、進行中のfetchをFETCH_CANCELする#327
yuki-uchida merged 8 commits into
masterfrom
claude/malformed-track-upstream-cleanup

Conversation

@yuki-uchida

@yuki-uchida yuki-uchida commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

概要

PR#323はMalformed Track(draft-14 §2.5)の検出と下流隔離のみで、仕様がMUSTとする上流側クリーンアップが未実装だった。検出したトラックの上流subscriptionをUNSUBSCRIBEし、進行中のfetchをFETCH_CANCELし、ingestを停止する。

関連タスク

#323 のフォローアップ

やったこと

  • moqt: FETCH_CANCEL送信API Subscriber::fetch_cancel(request_id) を追加
  • relay: malformedを検出したappend実行側(stream/datagram reader・fetch fill)が検出をEventHandlerに通知。workerがテーブル削除→上流UNSUBSCRIBE→IngressCommand::StopTrack を実行(重複通知は冪等。ラッチはappend内でしか立たないため常駐監視タスクは持たない)
  • relay: FetchIngestが受信待ち中もラッチを監視して即時中断し、malformed起因の失敗時に上流へFETCH_CANCELを送信
sequenceDiagram
    participant P as 上流Publisher
    participant I as Ingress(Reader / FetchIngest)
    participant C as TrackCache
    participant E as EventHandler
    I->>C: append(内容違いの重複受信)
    C-->>I: malformedラッチ(sticky)
    I->>E: MalformedTrackDetected
    E->>E: 上流subscriptionをテーブルから削除
    E->>P: UNSUBSCRIBE
    E->>I: StopTrack
    C-->>I: fetch fill中断
    I->>P: FETCH_CANCEL
Loading

やらないこと

subscriber側のPUBLISH_DONE受信処理、§2.5条件1〜7の検出、malformed以外の失敗(fetch fillタイムアウト等)でのFETCH_CANCEL送信

影響範囲

moqt・relay(いずれもAPI追加のみ)。wasm/examplesは変更不要:ブラウザpublisherはFETCHを受理しないためFETCH_CANCEL受信は発生せず、UNSUBSCRIBE受信は既存処理(wasmのalias削除+JSのエンコーダ停止)で送信が止まる

テスト

  • cargo test(moqt/relay 147件)、clippy、fmt すべてパス
  • object-dedup E2Eをローカルrelayで実行しパス。malformed検出直後に上流publisherセッションがUNSUBSCRIBEを受信することをログで確認

🤖 Generated with Claude Code

@yuki-uchida
yuki-uchida force-pushed the claude/malformed-track-detection branch from d260f9b to 577074b Compare August 26, 2026 06:54
Base automatically changed from claude/malformed-track-detection to master August 26, 2026 07:12
@yuki-uchida
yuki-uchida force-pushed the claude/malformed-track-upstream-cleanup branch from bea0fc5 to 3dad3d7 Compare August 26, 2026 07:14
@yuki-uchida
yuki-uchida changed the base branch from master to claude/session-event-kind-refactor August 26, 2026 08:03
@yuki-uchida
yuki-uchida force-pushed the claude/malformed-track-upstream-cleanup branch from 579ffe2 to f459e00 Compare August 26, 2026 08:07
Base automatically changed from claude/session-event-kind-refactor to master August 26, 2026 08:23
yuki-uchida and others added 6 commits August 26, 2026 17:24
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ormed track

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…s detected

A per-track watch task reports the sticky malformed latch into the relay
event pipeline, where the upstream subscription is unregistered,
UNSUBSCRIBE is forwarded upstream (draft-14 2.5 MUST), and ingress is
stopped.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Replaces the mock Session/Subscriber pairs duplicated across the
unsubscribe, malformed-track, and fetch-ingest tests with a single
recording mock in core::mocks, per the shared-Arrange testing rule.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@yuki-uchida
yuki-uchida force-pushed the claude/malformed-track-upstream-cleanup branch from f459e00 to 9427337 Compare August 26, 2026 08:25
yuki-uchida and others added 2 commits August 26, 2026 17:32
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The latch is only ever set inside an append, so the reader or fetch fill
that performed the latching append reports the detection itself; the
standing per-track watch task and its lifecycle bookkeeping are removed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@yuki-uchida
yuki-uchida merged commit eaff8dd into master Sep 3, 2026
15 checks passed
@yuki-uchida
yuki-uchida deleted the claude/malformed-track-upstream-cleanup branch September 3, 2026 08:21
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.

1 participant