Extract deep equality utility and refactor hooks to use shared implementation#273
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughConsolidates deep-equality into ChangesCareer form hooks refactoring and polling infrastructure improvements
Backend dependency update
Possibly related PRs
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.claude/rules/frontend/architecture.md:
- Line 74: The doc's status list is narrower than the implementation: update the
rule text so it matches frontend/src/hooks/useAsyncTaskPage.ts by either adding
"pending" to the enumerated statuses (dead_letter / processing / completed /
pending) or explicitly mark the list as "example statuses" to avoid mismatch;
reference useAsyncTaskPage and TaskProgressStepper in the sentence so readers
know the canonical source of statuses and ensure the documentation and
implementation remain aligned.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: a6122172-e615-40da-9d66-9f5b7718d302
📒 Files selected for processing (7)
.claude/rules/frontend/architecture.mdfrontend/src/hooks/career/useCareerDirty.tsfrontend/src/hooks/career/useCareerExperienceMutators.test.tsfrontend/src/hooks/career/useProjectFormDirty.tsfrontend/src/hooks/useAsyncTaskPage.tsfrontend/src/hooks/useTaskPolling.test.tsfrontend/src/utils/deepEqual.ts
💤 Files with no reviewable changes (1)
- frontend/src/hooks/useAsyncTaskPage.ts
Summary
isDeepEqualをutils/deepEqual.tsに集約し、useCareerDirty/useProjectFormDirtyの byte 一致コピペを解消(等価判定の乖離リスクを除去)。useAsyncTaskPageの未参照デッドコードgetNextIntervalを削除(バックオフはuseTaskPollingが実装済み)。useCareerExperienceMutatorsに単体テストを新規追加し、フォーム state を書き換える仕様分岐(is_current↔end_date / has_client↔name / 最後の1件削除ガード / onProjectSave 追加・置換)を固定。useTaskPolling.testのフレーキーな実時間待ち(setTimeout)を fake timers ベースへ置換し、unmount でポーリングが止まる仕様を決定論的に検証。Applied Changes
High
Medium
isDeepEqualを移設(Findings Medium / Duplication High「isDeepEqual の byte 一致コピペ」)。../../utils/deepEqualから import。挙動不変。diffProject/ team・technology_stacks・phases 比較はそのまま共通関数を利用。Low
getNextIntervalの定義・export・「将来の拡張用」コメントを削除(Findings Low「デッドコード export」)。rg getNextInterval src/で参照ゼロを確認済み。blog/+career/)へ更新。存在しないuseBlogSummaryPolling/useCareerAnalysisPage/useAsyncAnalysisPage/analysis/記載を削除し、未記載だったuseAsyncTaskPage/useAuthSessionを追記。pages/から削除済みCareerAnalysisPage.tsx、components/career-analysis/ディレクトリ記載を削除。api/モジュール一覧から削除済みcareer-analysis/intelligenceを除き、実在のgithubLinkを追記。utils/に新規deepEqual.tsと既存未記載のpdfjs.ts/taskStatus.tsを追記。useAsyncAnalysisPage→useAsyncTaskPageに修正。Test Changes
Removed
Added
Changed
await new Promise((r)=>setTimeout(r, FAST_INTERVAL*3))の実時間待ちをvi.useFakeTimers()+vi.advanceTimersByTimeAsyncに変更。マウント中は反復(呼び出し ≥2)→ unmount → 仮想時間を進めても呼び出しが増えないことを決定論的に検証。守る仕様(unmount でポーリング停止)は維持。Duplication Resolved
useCareerDirty.ts:72-96↔useProjectFormDirty.ts:30-54のisDeepEqual(27L clone)」を統合。抽出先は duplication.md「Frontend → 純粋関数は src/utils/」に準拠。両 hook は import 1 行に置換し、再帰等価判定の正本を 1 か所に集約。useCareerExperienceMutatorsの nested setForm パターン、テストの arrange-act-assert 群)は偶発的重複として抽出せず維持(Skipped 参照)。Structure Changes
utils/deepEqual.tsを新設したのみ。ディレクトリ移動・hook 切り出しなし(レポートの Oversized 3 件は全て「現状維持推奨」)。Skipped
useCareerExperienceMutatorsの experience/client/project 別 nested updater、jscpd 検出のテスト arrange-act-assert 13 件)は duplication.md「許容される類似」に該当するため抽出しない。Validation
make lint-frontend: pass(eslint src/ エラーなし)make lint-frontend-messages: pass(grep ベース検知ゼロ)make test-frontend: pass(node:test 4 / vitest 22 ファイル 160 tests 全 green。新規 useCareerExperienceMutators.test.ts 含む)make build-frontend: pass(tsc -b + vite build、220 modules、型エラーなし)npm run test:e2e): 未実行。理由: 新規ページ/ルート追加・認証/ナビゲーション/レイアウト/サイドバー変更・UI フローに影響する API 変更のいずれにも該当しない(util 抽出は挙動不変、デッドコード削除、テストのみの変更)。Follow-ups
Summary by CodeRabbit
Tests
Refactor
Chores