Skip to content

fix(nicojk): 録画オフセットによっては取得が始まらないのを修正 - #38

Merged
ci7lus merged 2 commits into
mainfrom
fix/fail-to-initial-load
Oct 3, 2026
Merged

ci7lus merged 2 commits into
mainfrom
fix/fail-to-initial-load

Conversation

@ci7lus

@ci7lus ci7lus commented Oct 3, 2026 •

Copy link
Copy Markdown
Owner

Sourceryによる概要

ソースのタイミングが変更された場合や、インターバルが一時的に利用できない場合に、取得処理の開始が妨げられるのではなく、録音済みコメントの取得を再試行するよう修正しました。

新機能:

  • 中断されたソースについて、すべてのコメントの取得を再開するためのソースごとの制御を追加。

バグ修正:

  • 録音のタイミングやソースのインターバルが利用可能になった、または変更された場合に、録音済みコメントの取得が再開されるように修正。
  • 取得前の新しいソースインターバルや空のソースインターバルが完了済みとしてマークされないように修正。
  • 初回の結果が空、または一時的に利用できない場合に、コメントの取得を再試行するように修正。

機能強化:

  • 完全なソース条件を使用してソースの取得状態を追跡し、それらの条件が変更された場合は、処理中の古い結果を破棄するように修正。

テスト:

  • 未解決のタイミング、拡張されるソースインターバル、追加されたソース、古い処理中リクエスト、コメントAPIに対して新しすぎる録音を対象としたテストカバレッジを追加。
Original summary in English

Summary by Sourcery

Fix recorded comment retrieval so source timing changes and temporarily unavailable intervals are retried instead of preventing acquisition from starting.

New Features:

  • Add a per-source control to resume fetching all comments for interrupted sources.

Bug Fixes:

  • Ensure recorded comment retrieval restarts when recording timing or source intervals become available or change.
  • Prevent recent or empty source intervals from being marked complete before they can be fetched.
  • Retry comment retrieval after initially empty or temporarily unavailable results.

Enhancements:

  • Track source fetch state using complete source conditions and discard stale in-flight results when those conditions change.

Tests:

  • Add coverage for unresolved timing, expanding source intervals, appended sources, stale in-flight requests, and recordings too recent for the comment API.

@ci7lus ci7lus added bug Something isn't working nicojk labels Oct 3, 2026
@sourcery-ai

sourcery-ai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

レビュアー向けガイド

タイミングが初期状態では利用できない、または区間が変更される録画について、ソース解決にタイミングを組み込むとともに、KakologManager に保留/再試行状態を保持し、遅延、空、追加、変更、早すぎるソースに対する回帰テストを追加することで、録画コメントの取得を修正します。

タイミング解決後に録画コメントの取得を再試行するシーケンス図

sequenceDiagram
    participant App
    participant KakologManager
    participant CommentAPI

    App->>App: getCommentSourceResolutionKey(playable, isRecorded, jkId)
    App->>KakologManager: setSources(replaySources)
    KakologManager->>KakologManager: hasPendingInitialSourceFetch()
    KakologManager->>CommentAPI: fetchMiyouSourceChunk(sourceStart, sourceEnd)
    alt source interval is not yet queryable
        CommentAPI-->>KakologManager: empty result
        KakologManager->>KakologManager: retain needsInitialFetch
    else source interval is queryable
        CommentAPI-->>KakologManager: comments
        KakologManager-->>App: recordedCommentsReady
    end
    App->>KakologManager: setSources(updated timing)
    KakologManager->>CommentAPI: retry pending source fetch
Loading

録画コメントソース解決のフロー図

flowchart TD
    A[Timing or source data changes] --> B[getCommentSourceResolutionKey]
    B --> C{Valid startAt, duration, and source interval?}
    C -- No --> D[Wait for updated timing]
    D --> A
    C -- Yes --> E[setSources]
    E --> F{Pending initial fetch?}
    F -- Yes --> G[Fetch source chunks]
    G --> H{Queryable interval exists?}
    H -- No --> I[Keep needsInitialFetch for retry]
    I --> A
    H -- Yes --> J[Store comments and update completion]
    F -- No --> J
Loading

ファイル単位の変更

変更内容 詳細 ファイル
録画のタイミングが利用可能になった、または変更された際に、コメントソースを再解決する。
  • duration および番組メタデータに加えて、ソース解決キーに基準開始時刻を含める。
  • 録画コメントの取得を初期化する前に、タイミングとプライマリソースの区間を検証する。
  • ネットワーク経由でタイミングが遅れて到着した場合に、JK コンテキストのタイミングを更新する。
src/plugins/nicojk/App.tsx
tests/nicojk-live-source-selection.test.ts
ソース取得を再試行可能にし、取得条件が変更された際に正しくリセットする。
  • 区間とソース属性を含むソース取得シグネチャを追跡する。
  • 新規または変更されたソースを初回取得待ちとしてマークし、追加のみの更新では変更されていないソースを保持する。
  • 空の区間や将来のみを対象とする区間を完了扱いにせず、ソースがクエリ可能になった時点でリクエストを再試行する。
  • ソース条件の変更後に、実行中の取得結果を破棄する。
src/plugins/nicojk/kakolog-manager.ts
tests/nicojk-kakolog-manager.test.ts
中断されたソースの復旧用コントロールのレイアウトを改善する。
  • 全件取得を再開するボタンを、一部取得のステータスバッジの隣に配置する。
src/plugins/nicojk/components/PanelPage.tsx

ヒントとコマンド

Sourcery とのやり取り

  • 新しいレビューを開始する: プルリクエストに @sourcery-ai review とコメントします。
  • ディスカッションを続ける: Sourcery のレビューコメントに直接返信します。
  • レビューコメントから GitHub Issue を作成する: レビューコメントに返信して、Sourcery にそのコメントから Issue を作成するよう依頼します。レビューコメントに @sourcery-ai issue と返信して、Issue を作成することもできます。
  • プルリクエストのタイトルを生成する: プルリクエストのタイトル内の任意の場所に @sourcery-ai と記述すると、いつでもタイトルを生成できます。プルリクエストに @sourcery-ai title とコメントして、タイトルをいつでも(再)生成することもできます。
  • プルリクエストの概要を生成する: プルリクエスト本文内の任意の場所に @sourcery-ai summary と記述すると、指定した場所に PR の概要をいつでも生成できます。プルリクエストに @sourcery-ai summary とコメントして、概要をいつでも(再)生成することもできます。
  • レビュアー向けガイドを生成する: プルリクエストに @sourcery-ai guide とコメントすると、レビュアー向けガイドをいつでも(再)生成できます。
  • Sourcery のコメントをすべて解決する: プルリクエストに @sourcery-ai resolve とコメントすると、Sourcery のコメントをすべて解決できます。すべてのコメントに対応済みで、これ以上表示したくない場合に便利です。
  • Sourcery のレビューをすべて却下する: プルリクエストに @sourcery-ai dismiss とコメントすると、既存の Sourcery のレビューをすべて却下できます。新しいレビューを最初からやり直したい場合に特に便利です。その場合は、@sourcery-ai review とコメントして新しいレビューを開始することを忘れないでください。

利用環境のカスタマイズ

ダッシュボードにアクセスして、次の操作を行えます。

  • Sourcery が生成するプルリクエスト概要、レビュアー向けガイドなどのレビュー機能を有効化または無効化する。
  • レビュー言語を変更する。
  • カスタムレビュー指示を追加、削除、編集する。
  • その他のレビュー設定を調整する。

ヘルプを得る

Original review guide in English

Reviewer's Guide

Fixes recorded comment acquisition for recordings whose timing is initially unavailable or whose interval changes, by incorporating timing into source resolution, retaining pending/retry state in KakologManager, and adding regression coverage for delayed, empty, appended, changed, and too-recent sources.

Sequence diagram for retrying recorded comment acquisition after timing resolution

sequenceDiagram
    participant App
    participant KakologManager
    participant CommentAPI

    App->>App: getCommentSourceResolutionKey(playable, isRecorded, jkId)
    App->>KakologManager: setSources(replaySources)
    KakologManager->>KakologManager: hasPendingInitialSourceFetch()
    KakologManager->>CommentAPI: fetchMiyouSourceChunk(sourceStart, sourceEnd)
    alt source interval is not yet queryable
        CommentAPI-->>KakologManager: empty result
        KakologManager->>KakologManager: retain needsInitialFetch
    else source interval is queryable
        CommentAPI-->>KakologManager: comments
        KakologManager-->>App: recordedCommentsReady
    end
    App->>KakologManager: setSources(updated timing)
    KakologManager->>CommentAPI: retry pending source fetch
Loading

Flow diagram for recorded comment source resolution

flowchart TD
    A[Timing or source data changes] --> B[getCommentSourceResolutionKey]
    B --> C{Valid startAt, duration, and source interval?}
    C -- No --> D[Wait for updated timing]
    D --> A
    C -- Yes --> E[setSources]
    E --> F{Pending initial fetch?}
    F -- Yes --> G[Fetch source chunks]
    G --> H{Queryable interval exists?}
    H -- No --> I[Keep needsInitialFetch for retry]
    I --> A
    H -- Yes --> J[Store comments and update completion]
    F -- No --> J
Loading

File-Level Changes

Change Details Files
Re-resolve comment sources when recording timing becomes available or changes.
  • Include base start time in the source-resolution key alongside duration and program metadata.
  • Validate timing and primary-source intervals before initializing recorded-comment fetching.
  • Update JK context timing when late network timing arrives.
src/plugins/nicojk/App.tsx
tests/nicojk-live-source-selection.test.ts
Make source fetching retryable and correctly reset when fetch conditions change.
  • Track source fetch signatures including interval and source attributes.
  • Mark new or changed sources as pending initial fetches while preserving unchanged sources during append-only updates.
  • Avoid completing empty or future-only intervals, and retry requests once the source becomes queryable.
  • Discard in-flight results after source conditions change.
src/plugins/nicojk/kakolog-manager.ts
tests/nicojk-kakolog-manager.test.ts
Improve the interrupted-source recovery control layout.
  • Place the full-fetch resume button next to the partial-fetch status badge.
src/plugins/nicojk/components/PanelPage.tsx

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

こんにちは。変更内容を確認しましたが、とても素晴らしいです!

Sourcery による評価

承認しました。


Sourcery はオープンソース向けに無料です。レビューを気に入っていただけましたら、ぜひ共有をご検討ください ✨
Original comment in English

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@ci7lus
ci7lus merged commit 29702d8 into main Oct 3, 2026
3 checks passed
@ci7lus
ci7lus deleted the fix/fail-to-initial-load branch October 3, 2026 04:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working nicojk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant