fix: HIL 基盤の実装レビューで見つかった不具合を修正する - #1119
Draft
owk-owk130 wants to merge 10 commits into
Draft
Conversation
embedding 失敗時に sourceHash だけ新しい値へ進むため、リトライが skipUnchanged で「変更なし」と誤認してベクトル欠損が恒久化していた。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018BjNFvQjDzMwF8HaZHnJjP
発行が失敗しても published のまま残り、管理画面が反映済みと表示していた。 draft で保存して発行成功時に published へ進め、未反映の訂正は画面から 再発行できるようにする。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018BjNFvQjDzMwF8HaZHnJjP
参照ナレッジが無いと訂正ボタンが消え、次に何をすべきか分からなかった。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018BjNFvQjDzMwF8HaZHnJjP
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018BjNFvQjDzMwF8HaZHnJjP
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018BjNFvQjDzMwF8HaZHnJjP
Contributor
Coverage Report for server
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Contributor
Coverage Report for shared
File Coverage
|
||||||||||||||||||||||||||||||||||||||
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014kkNoEdkn1kVK4La79XFpc
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014kkNoEdkn1kVK4La79XFpc
Contributor
Coverage Report for web
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||
Contributor
Coverage Report for widget
File CoverageNo changed files found. |
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.
概要
スタック #1115(PR #1111〜#1118)の実装を自己レビューして見つかった不具合 3 件の修正。
修正が PR 2(承認ゲート)と PR 4(訂正)の両方のコードに跨るため、独立した最上段の PR にしています。
1. index 成功後に sourceHash を確定する(Critical)
indexing.tsは内容変更を検知した時点で sourceHash を新しい値へ更新していたため、この順序で状態が壊れていました。markIndexedはスキップされるので indexedAt は古い値が残るskipUnchangedの 3 条件(approved / indexedAt あり / hash 一致)がすべて成立してスキップ結果、Vectorize からベクトルが消えたまま D1 は「index 済み」と主張し、リトライも永久に効きません。復旧は全削除 + 全同期しかなく、検索が無言で 0 件になる以外に兆候がありませんでした。
修正: メタデータ(hash・etag・chunkCount・indexedAt)の更新を index 成功後に一本化。失敗時は
markRemovedで「未 index」を明示し、次回のリトライが必ず再実行されるようにしました。2. 訂正の発行成功後に published へ更新する(High)
D1 に published を書いた後に R2 / index を実行していたため、発行が失敗しても DB は published のまま残り、管理画面が「公開中」と表示していました(実際は検索に反映されていない)。エラー文は「再発行してください」と案内するのに、その手段が画面にありませんでした。
修正:
draftで保存 → 発行成功後にpublishedへ更新(Resolver は published のみ注入するので draft が回答に混ざることはない)POST /admin/corrections/{id}/publishを追加し、未反映の訂正を単体で再発行できるようにした3. 検索 0 件の回答に訂正の代替導線を示す(詰み)
訂正対象の候補を検索ヒットから作っていたため、hits が 0 件だと選択肢ゼロで「訂正を作成する」ボタン自体が消え、職員から見ると行き止まりでした。要確認シグナル 3 種のうち「検索 0 件」が一番手当てしたいケースなのに導線がない状態でした。
修正: 0 件時は「参照したナレッジが無いため訂正は作成できません。情報自体が不足している場合は『情報源不足』を選んでください」と表示。設計上この場合は訂正ではなく情報源不足の判断が正しいため、それを明示します。
自己レビューで挙がった残りの指摘
このPRでは対応せず、後続の #1120 でまとめて対応した。
品質ゲート
lint + tsc + server 1551 / web 722 テスト green。#1 は「失敗 → リトライで復旧する」ケースをテストで固定しています。
🤖 Generated with Claude Code
https://claude.ai/code/session_018BjNFvQjDzMwF8HaZHnJjP