Skip to content

feat: Web 検索から未収集の公式ページを情報源候補として検出する - #1118

Draft
owk-owk130 wants to merge 13 commits into
feat/hil-4-curated-correctionfrom
feat/hil-5-source-candidate
Draft

feat: Web 検索から未収集の公式ページを情報源候補として検出する#1118
owk-owk130 wants to merge 13 commits into
feat/hil-4-curated-correctionfrom
feat/hil-5-source-candidate

Conversation

@owk-owk130

@owk-owk130 owk-owk130 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

概要

ナレッジ HIL 基盤(計画: .brain/plans/knowledge-hil-foundation.md)の PR 5。Issue #1078 の入口。
Web 検索を「ナレッジ不足のセンサー」として使い、回答が参照した未収集の公式ページを候補化して村側の承認につなげる。

変更内容

  • 検出: web-researcher の調査メモ完了時(onFinish)に URL を抽出し、既知の公式ホスト(knowledge_sources.canonical_url の host 集合。www. 差は正規化)に属する未収集 URL を source_candidates へ upsert(出現回数を加算)。usage 記録とは失敗隔離した best-effort
  • 管理 API: GET /admin/source-candidates(出現回数順)/ PATCH /{id}/status(approve / reject)
  • 管理画面: 「情報源候補」タブ。URL・参照回数・状態を表示し、承認 / 却下
  • 全同期の skip 可視化: POST /admin/knowledge/sync のレスポンスに skippedCount を追加(backfill 前の同期でナレッジが 0 件になる事故を検知可能に)
  • normalizeUrl / hostOflib/url.ts に追加(normalizeSiteHost と同じ www. 除去方針)

制約・運用

  • 候補検出は既知ホストに限る: 判定の種は url frontmatter を持つ source(336 中 204 ファイル)の host 集合。新規ドメインの公式サイトは拾えない(v1 制約)
  • 承認 = 判断の記録まで: 収集は通常の scraper / 取り込み手順で行う(AI が Markdown を R2 に直接入れる経路は作らない、の帰結)。承認済み一覧が収集タスクのインプット
  • onFinish の event.text に調査メモ全文が入ることは型からの推定で、実機での突合は未検証(入らない場合は候補が検出されないだけで他への影響なし)
  • HIL 系タブ(回答レビュー・訂正・情報源候補)が 3 枚になったので、統合は運用を見て検討

🤖 Generated with Claude Code

https://claude.ai/code/session_018BjNFvQjDzMwF8HaZHnJjP

owk-owk130 and others added 8 commits September 1, 2026 22:43
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018BjNFvQjDzMwF8HaZHnJjP
@owk-owk130 owk-owk130 changed the title feat/hil 5 source candidate feat: Web 検索から未収集の公式ページを情報源候補として検出する Sep 1, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for server

Status Category Percentage Covered / Total
🟢 Lines 98.13% (🎯 97%) 3848 / 3921
🟢 Statements 97.58% (🎯 96%) 4036 / 4136
🟢 Functions 98.11% (🎯 97%) 730 / 744
🟢 Branches 89.62% (🎯 87%) 1581 / 1764
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
server/src/db/schema.ts 100% 100% 100% 100%
server/src/lib/url.ts 100% 100% 100% 100%
server/src/repository/knowledge-source-repository.ts 90.47% 100% 90% 90.47%
server/src/repository/source-candidate-repository.ts 100% 66.66% 100% 100%
server/src/routes/admin/source-candidates.ts 100% 100% 100% 100%
server/src/routes/admin/knowledge/sync.ts 100% 50% 100% 100%
server/src/services/knowledge/source-candidates.ts 93.54% 93.33% 87.5% 96.29%
Generated in workflow #2111 for commit e02c98f by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for web

Status Category Percentage Covered / Total
🟢 Lines 97.62% (🎯 96%) 1805 / 1849
🟢 Statements 96.47% (🎯 95%) 1917 / 1987
🟢 Functions 96.38% (🎯 95%) 774 / 803
🟢 Branches 89.43% (🎯 88%) 1245 / 1392
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
web/src/app/dashboard/components/SourceCandidatesPanel.tsx 100% 75% 100% 100%
web/src/app/dashboard/hooks/keys.ts 93.33% 100% 92.85% 93.33%
web/src/app/dashboard/hooks/useSourceCandidates.ts 100% 100% 100% 100%
web/src/lib/api/repository.ts 100% 100% 100% 100%
Generated in workflow #2111 for commit e02c98f by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for shared

Status Category Percentage Covered / Total
🟢 Lines 99.25% (🎯 98%) 265 / 267
🟢 Statements 80.68% (🎯 80%) 284 / 352
🟢 Functions 100% (🎯 98%) 91 / 91
🟢 Branches 63.02% (🎯 62%) 121 / 192
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
shared/src/api/types.ts 100% 100% 100% 100%
shared/src/api/repository/source-candidate-repository.ts 80% 50% 100% 100%
Generated in workflow #2111 for commit e02c98f by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for widget

Status Category Percentage Covered / Total
🟢 Lines 99.62% (🎯 98%) 265 / 266
🟢 Statements 97.94% (🎯 96%) 286 / 292
🟢 Functions 98.11% (🎯 98%) 52 / 53
🟢 Branches 93.28% (🎯 92%) 139 / 149
File CoverageNo changed files found.
Generated in workflow #2111 for commit e02c98f by the Vitest Coverage Report Action

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