Merge pull request #592 from otomatty/main#650
Conversation
…, exact-dup severity PR #646 のレビュー対応。 - conflict.ts: `NUMBER_PATTERN` に `(?: \d{3})*` を追加し、空白区切りの thousand grouping (`1 000 円` / `1 000 000 円`) を取りこぼさない。 3 桁ずつのみ許容することで `100 3人` のような偽マッチは回避する。 (coderabbitai #3107605897) - conflict.ts: `normalizeNumberValue` を単位分離 + `parseFloat` ベースに 書き換え、末尾の小数ゼロ (`1000` vs `1000.0`, `3.776` vs `3.7760`) を canonical 形式に畳む。 (gemini-code-assist #3107607604) - titleSimilar.ts: 完全一致 (`distance=0`) は重複ページ由来のリンク曖昧 さを生むため `severity: "warn"` に上げ、近似一致 (`distance>0`) は 従来どおり `info` のまま。finding 内の suggestion 文言も分岐させる。 (gemini-code-assist #3107607603) - conflict.test.ts: 空白区切り、百万単位、末尾 `.0`、小数末尾ゼロを 同値として正規化するテストを追加 (vitest 29/29 passing)。 https://claude.ai/code/session_012J9gqETyditCqdU6xA6z87
|
Caution Review failedFailed to post review comments 📝 WalkthroughWalkthroughThis PR introduces a comprehensive wiki intelligence and management system with five major components: an LLM-driven ingest planner for article integration, a multi-rule lint engine for wiki quality checks, an append-only activity log for audit trails, auto-generated index pages for wiki structure, and user-defined schema pages. It also adds client-side YouTube extraction with AI summaries, OCR and image description capabilities, MCP token revocation and rate limiting, a "promote to wiki" feature converting chat conversations to pages, and substantial layout refactoring (sidebar removal, mobile bottom navigation, responsive header). Changes
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related PRs
Suggested labels
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
|
💡 Codex Reviewzedi/server/api/src/routes/clip.ts Line 188 in 8bde254 This handler trims zedi/server/api/src/routes/wikiSchema.ts Lines 110 to 112 in 8bde254 When two first-time ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
There was a problem hiding this comment.
Code Review
This pull request implements the 'LLM Wiki' pattern, adding immutable sources, an ingest pipeline with YouTube support, a wiki schema system, and a lint engine. It also refactors the layout into a consolidated navigation menu and mobile bottom nav, introduces client-side OCR and AI image description, and adds rate limiting for MCP endpoints. Feedback identifies bugs where ydocState is incorrectly initialized as empty for special pages and suggests reordering image uploads to prevent orphan S3 objects. Improvements are recommended for handling database conflicts, optimizing the title similarity lint rule, and restoring a missing AI history link in the navigation menu.
I am having trouble creating individual review comments. Click here to see my feedback.
server/api/src/services/indexBuilder.ts (329-334)
ydocState に空の Buffer をセットしているため、生成された __index__ ページをエディタで開くと内容が空に見えてしまいます。document.markdown を Tiptap JSON に変換し、prosemirrorJSONToYDoc を使用して有効な ydocState を生成して保存するように修正してください。
server/api/src/routes/wikiSchema.ts (128-133)
indexBuilder と同様に、ydocState が空のまま保存されています。これにより、スキーマページをエディタで開いた際に内容が表示されません。プレーンテキストから ydocState を生成して保存するように改善してください。
src/components/layout/ImageCreateDialog.tsx (300-303)
画像のアップロード(uploadImage)が OCR や画像解析の前に行われています。もし解析処理でエラーが発生したり、ユーザーが途中でキャンセルしたりした場合、アップロード済みの画像が S3 上で孤児(Orphan)になってしまいます。解析処理を先に実行し、成功した場合のみ最後にアップロードを行う順序に変更することを推奨します。
server/api/src/routes/ingest.ts (371-384)
sources テーブルへの挿入時に一意制約(uq_sources_owner_url_hash)による衝突が発生する可能性があります。onConflictDoUpdate を使用して、衝突時に既存のレコードを更新しつつその ID を取得するように変更することを検討してください。これにより、並行リクエスト時の 500 エラーを回避できます。
server/api/src/routes/ingest.ts (232-233)
トークン使用量の計算が文字数ベースの概算になっています。IngestLlmDriver が callProvider から返される実際の usage を返すようにリファクタリングし、正確なトークン数を recordUsage に渡すように改善することを検討してください。
src/components/layout/Header/NavigationMenu.tsx (31-34)
デスクトップ版のナビゲーションメニューから AI へのリンクが消えています。サイドバーが廃止されたため、このメニューに AI(/ai)を追加しないと、デスクトップユーザーが過去の会話履歴一覧にアクセスする手段が失われてしまいます。
const NAV_ENTRIES: readonly NavEntry[] = [
{ path: "/home", icon: Home, i18nKey: "nav.home", exact: true },
{ path: "/notes", icon: FileText, i18nKey: "nav.notes" },
{ path: "/ai", icon: Sparkles, i18nKey: "nav.ai" },
] as const;
server/api/src/services/lintEngine/rules/titleSimilar.ts (61-64)
全ページ(N件)に対して二重ループで Levenshtein 距離を計算しているため、計算量が O(N^2) となっています。ページ数が多いユーザー(数千件以上)の場合、この処理がイベントループを長時間ブロックし、API の応答性に悪影響を与える可能性があります。頭文字によるバケツ分けや、類似度の高い候補を絞り込むためのインデックス活用など、最適化を検討してください。
…, surface exact-title dups (#646) * fix(lint-engine): normalize fact values, count distinct ghost sources, surface exact-title dups PR #636 review コメントへの対応 (lint engine の偽陽性・偽陰性修正)。 - rules/conflict.ts: 抽出時に値を正規化する。日付は YYYY-M-D に、数値はカンマ・ 空白を除去してから格納。これで `2026-04-19` と `2026/4/19`、`1,000円` と `1000円` のような format-only の差分が誤って conflict として通知されなくなる - rules/ghostMany.ts: count(*) と array_agg を `DISTINCT source_page_id` に変更。 同一ページ内で同じ link_text が複数回現れるケースを別ソースとして二重計上して しまい閾値を超えていた偽陽性を解消。HAVING も distinct count で判定 - rules/titleSimilar.ts: 完全一致タイトルを「他で処理する」というコメントだけで 握り潰していたが、実際にはどこも見ておらず exact-dup が黙って素通りしていた。 distance=0 を最も強い title_similar finding として正規に通知するよう修正 - rules/conflict.test.ts に正規化ケースのテストを追加 Made-with: Cursor * fix(lint-engine): support space-grouped thousands, canonical decimals, exact-dup severity (#650) PR #646 のレビュー対応。 - conflict.ts: `NUMBER_PATTERN` に `(?: \d{3})*` を追加し、空白区切りの thousand grouping (`1 000 円` / `1 000 000 円`) を取りこぼさない。 3 桁ずつのみ許容することで `100 3人` のような偽マッチは回避する。 (coderabbitai #3107605897) - conflict.ts: `normalizeNumberValue` を単位分離 + `parseFloat` ベースに 書き換え、末尾の小数ゼロ (`1000` vs `1000.0`, `3.776` vs `3.7760`) を canonical 形式に畳む。 (gemini-code-assist #3107607604) - titleSimilar.ts: 完全一致 (`distance=0`) は重複ページ由来のリンク曖昧 さを生むため `severity: "warn"` に上げ、近似一致 (`distance>0`) は 従来どおり `info` のまま。finding 内の suggestion 文言も分岐させる。 (gemini-code-assist #3107607603) - conflict.test.ts: 空白区切り、百万単位、末尾 `.0`、小数末尾ゼロを 同値として正規化するテストを追加 (vitest 29/29 passing)。 https://claude.ai/code/session_012J9gqETyditCqdU6xA6z87 Co-authored-by: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
chore: sync main to develop
Summary by CodeRabbit
Release Notes
New Features
Improvements