test: 低価値な重複・自明テストを削減しメンテコストを下げる#464
Conversation
backend/frontend のテストコードを調査し、重複カバレッジ・逐語 pin・過分割の 低価値テストを削除・parametrize 統合した。web は node:test 経由の payloadBuilders.test.cjs(vitest 版の完全な部分集合)を撤去し、 test:unit の脆いビルド段取りも合わせて廃止した。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 23 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR consolidates test tooling and suites: web test scripts now run vitest exclusively (removing node:test-based dual invocation and a legacy CJS test file), test policy docs are updated accordingly, unused .test-dist ignore entries are dropped, and several backend pytest test files are refactored to combine/parametrize previously separate test cases. ChangesWeb Test Tooling Consolidation
Backend Test Suite Consolidation
Estimated code review effort: 2 (Simple) | ~12 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
backend/tests/test_messages.py (1)
34-34: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winAdd a direct assertion for
validation.end_date_requiredThe schema tests cover the missing-end-date branch, but they only match the general “終了年月” text. Keep one message-level assertion soget_error("validation.end_date_required")stays pinned to the expected string.🤖 Prompt for 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. In `@backend/tests/test_messages.py` at line 34, The message test is only covering the generic end-date error text, so add a direct assertion in test_master_data_placeholder for validation.end_date_required using get_error("validation.end_date_required") to pin the exact expected string. Keep the existing schema coverage, but make sure this test explicitly checks the message-level key so the validation message contract stays stable.
🤖 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.
Outside diff comments:
In `@backend/tests/test_messages.py`:
- Line 34: The message test is only covering the generic end-date error text, so
add a direct assertion in test_master_data_placeholder for
validation.end_date_required using get_error("validation.end_date_required") to
pin the exact expected string. Keep the existing schema coverage, but make sure
this test explicitly checks the message-level key so the validation message
contract stays stable.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 6665145a-aa12-42af-b3e9-a7dc84ffe8f8
📒 Files selected for processing (9)
.claude/rules/web/test.md.gitignore.jscpd.jsonbackend/tests/auth/test_token_manager.pybackend/tests/test_database_libsql_binary.pybackend/tests/test_messages.pybackend/tests/test_schemas.pyweb/package.jsonweb/tests/payloadBuilders.test.cjs
💤 Files with no reviewable changes (3)
- .gitignore
- web/tests/payloadBuilders.test.cjs
- .jscpd.json
CodeRabbit 指摘: schemas/resume.py の model_validator から直接参照される キーの完全文言 pin が統合で失われていた。文言ベタ pin の統合方針は維持しつつ、 実際に参照されているこのキーだけは代表テストに明示 assert を追加する。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Summary
backend / frontend のテストコードを調査し、費用対効果の低いテストを削除・parametrize 統合した(テスト内容の質は高く、大規模な削除対象は無かった)。
web/tests/payloadBuilders.test.cjs(node:test)を削除。web/src/payloadBuilders.test.ts(vitest)の完全な部分集合で、Stryker(mutation テスト)にも寄与しないことを確認済み。test:unitの tsc 手動コンパイル →.test-dist生成 → node:test の脆いビルド段取りも撤去し、npm testをvitest runに単純化test_schemas.pyの完全重複テスト1件を削除。Experience/Project の期間バリデーション10テストを共通契約として parametrize 統合(12ケース実行、契約は維持)test_messages.pyの文言ベタ pin 3本を代表1本に集約(mutmut スコープ外・文言変更で壊れるだけで検出力ゼロ)auth/test_token_manager.pyの JWTクレーム過分割4本を1本に統合(セキュリティ契約テストは維持)test_database_libsql_binary.pyから SQLAlchemy 自体の挙動確認1件を削除調査で「疑わしい」と当初想定した
test_agent.py/test_llm_clients.py(境界モックのみで実ロジックを通す)、_extended系ペア、useCareerExperienceMutators.test.ts等は精査の結果高価値と判断し、変更していない。security/ ・auth/ ・test_error_code_sync.py等の契約テストも維持。Test plan
make ciが green(backend pytest 655 passed / web vitest 365 passed・53 files / build-web 成功)test:unit/.test-distの参照が他ファイル(CI/Makefile/docs)に残っていないことを grep で確認🤖 Generated with Claude Code
Summary by CodeRabbit