feat(resume): 職務経歴書に連絡先(email / github)を追加し PDF/Markdown でリンク表示#319
Conversation
- resume schema に email(必須)/ github_url(任意・https://github.com/ 始まり検証)を追加 - migration 0043 で resumes テーブルに contact カラムを追加 - フォーム(CareerBasicInfoSection)/ payloadBuilders / dirty 判定 / 差分プレビューに email・github を反映 - PDF / Markdown 生成の連絡先ラベルを email / github に統一し、github URL を ハイパーリンク表示にする(PDF: <a class="meta-link"> 青・下線、Markdown: [URL](URL) 記法) - 差分確認モーダルの変更サマリを全件スクロール可能にし、変更が多くても ロールバック/操作ボタンが clip されないよう修正 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 6 minutes and 4 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR adds email and GitHub URL contact fields to resumes across the entire stack. Users can now enter their email and GitHub profile URL in the resume form; the fields are validated (email format, github.com prefix), persisted to the database, and rendered in PDF and Markdown outputs. ChangesResume Contact Fields Feature
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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.
Actionable comments posted: 1
🧹 Nitpick comments (3)
frontend/src/utils/careerDiff.test.ts (1)
17-18: ⚡ Quick winAdd direct diff assertions for the new contact fields.
Line 17 and Line 18 update fixtures, but this suite still doesn’t explicitly assert
github_urldiff detection and rollback paths.Suggested test additions
describe("buildCareerChanges", () => { + it("email の修正を modified として検出する", () => { + const baseline = buildForm(); + const form = buildForm(); + form.email = "sato@example.com"; + + const changes = buildCareerChanges(form, baseline); + const emailChange = changes.find((c) => JSON.stringify(c.path) === JSON.stringify(["email"])); + expect(emailChange).toMatchObject({ + kind: "modified", + oldValue: "yamada@example.com", + newValue: "sato@example.com", + }); + }); + + it("github_url の修正を modified として検出し、ロールバックできる", () => { + const baseline = buildForm(); + const form = buildForm(); + form.github_url = "https://github.com/example"; + + const changes = buildCareerChanges(form, baseline); + const ghChange = changes.find((c) => JSON.stringify(c.path) === JSON.stringify(["github_url"])); + expect(ghChange?.kind).toBe("modified"); + + const rolled = ghChange!.rollback(form); + expect(rolled.github_url).toBe(""); + }); +});🤖 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 `@frontend/src/utils/careerDiff.test.ts` around lines 17 - 18, Update the careerDiff.test.ts suite to explicitly assert that changes to the new contact fields are detected and rolled back: add assertions that a diff produced for the fixture with email and github_url changes contains entries for "email" and "github_url" and that invoking the same rollback helper used in this test file (the test's diff detection and rollback functions, e.g., computeCareerDiff / applyRollback or the local helpers already used in the file) restores the original email and github_url values; place these checks alongside the existing diff detection/rollback tests in careerDiff.test.ts so both detection and rollback paths for email and github_url are covered.backend/tests/test_markdown_generator.py (1)
57-71: ⚡ Quick winNarrow the omission assertion to the rendered field token.
Line 70 uses
assert "github" not in md, which is broader than the behavior under test. Checking the exact rendered token is more stable.Proposed test tightening
- assert "github" not in md + assert "**github:**" not in md + assert "[https://github.com/" not in md🤖 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_markdown_generator.py` around lines 57 - 71, The test test_contact_fields_omitted_when_empty calls build_resume_markdown but asserts broadly with assert "github" not in md; tighten this to assert the exact rendered field token is absent (e.g., the label or markdown token your renderer emits such as "GitHub:" or the specific link label) so it only checks that the rendered contact field is omitted; update the assertion in test_contact_fields_omitted_when_empty to look for that exact token instead of the substring "github".backend/tests/test_endpoints.py (1)
67-126: ⚡ Quick winExtract a shared payload builder in the new contact validation tests.
test_resume_contact_round_trips,test_resume_rejects_invalid_email_via_api, andtest_resume_rejects_invalid_github_url_via_apirepeat nearly identical resume JSON. Reusingmake_resume_payload(...)fromconftest.pywill reduce drift when required fields change again.♻️ Proposed refactor
-from conftest import auth_header +from conftest import auth_header, make_resume_payload ... - resp = client.post( - "/api/resumes", - json={ - "full_name": "連絡先 太郎", - "email": "contact@example.com", - "github_url": "https://github.com/contact-taro", - "career_summary": "要約", - "self_pr": "自己PR", - "experiences": [], - "qualifications": [], - }, - headers=headers, - ) + resp = client.post( + "/api/resumes", + json=make_resume_payload( + full_name="連絡先 太郎", + email="contact@example.com", + github_url="https://github.com/contact-taro", + career_summary="要約", + self_pr="自己PR", + experiences=[], + qualifications=[], + ), + headers=headers, + )As per coding guidelines,
backend/**/*.pychanges should “apply DRY principles and code duplication policies defined in.claude/rules/common/duplication.md.”🤖 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_endpoints.py` around lines 67 - 126, The three tests test_resume_contact_round_trips, test_resume_rejects_invalid_email_via_api, and test_resume_rejects_invalid_github_url_via_api duplicate the same resume JSON; replace the inline JSON in each with calls to the shared helper make_resume_payload(...) from conftest.py (override specific fields like email or github_url per-test as needed), update usages in those tests to pass the returned dict to client.post(..., json=...), and remove the duplicated literal payloads so tests DRYly reuse the single payload builder.Source: Coding guidelines
🤖 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 `@backend/app/schemas/resume.py`:
- Around line 245-260: The validators validate_email and validate_github_url
currently call strip() for checks but return the original untrimmed value,
leaving surrounding whitespace in stored/contact fields; update both methods to
return the trimmed string (use the already-created stripped variable for github
and use a trimmed value for email before matching) so normalized values (no
leading/trailing spaces) are returned after validation.
---
Nitpick comments:
In `@backend/tests/test_endpoints.py`:
- Around line 67-126: The three tests test_resume_contact_round_trips,
test_resume_rejects_invalid_email_via_api, and
test_resume_rejects_invalid_github_url_via_api duplicate the same resume JSON;
replace the inline JSON in each with calls to the shared helper
make_resume_payload(...) from conftest.py (override specific fields like email
or github_url per-test as needed), update usages in those tests to pass the
returned dict to client.post(..., json=...), and remove the duplicated literal
payloads so tests DRYly reuse the single payload builder.
In `@backend/tests/test_markdown_generator.py`:
- Around line 57-71: The test test_contact_fields_omitted_when_empty calls
build_resume_markdown but asserts broadly with assert "github" not in md;
tighten this to assert the exact rendered field token is absent (e.g., the label
or markdown token your renderer emits such as "GitHub:" or the specific link
label) so it only checks that the rendered contact field is omitted; update the
assertion in test_contact_fields_omitted_when_empty to look for that exact token
instead of the substring "github".
In `@frontend/src/utils/careerDiff.test.ts`:
- Around line 17-18: Update the careerDiff.test.ts suite to explicitly assert
that changes to the new contact fields are detected and rolled back: add
assertions that a diff produced for the fixture with email and github_url
changes contains entries for "email" and "github_url" and that invoking the same
rollback helper used in this test file (the test's diff detection and rollback
functions, e.g., computeCareerDiff / applyRollback or the local helpers already
used in the file) restores the original email and github_url values; place these
checks alongside the existing diff detection/rollback tests in
careerDiff.test.ts so both detection and rollback paths for email and github_url
are covered.
🪄 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: f4f70d59-5ebb-4360-9c86-f87167c64bd1
📒 Files selected for processing (36)
backend/alembic_migrations/versions/0043_add_contact_to_resumes.pybackend/app/messages.jsonbackend/app/models/resume.pybackend/app/repositories/resume.pybackend/app/routers/resumes.pybackend/app/schemas/resume.pybackend/app/services/markdown/generators/resume_generator.pybackend/app/services/pdf/generators/resume_generator.pybackend/app/services/pdf/templates/resume.cssbackend/tests/auth/test_endpoints.pybackend/tests/conftest.pybackend/tests/security/_helpers.pybackend/tests/test_endpoints.pybackend/tests/test_markdown_generator.pybackend/tests/test_pdf_generator.pybackend/tests/test_schemas.pyfrontend/e2e/auth.spec.tsfrontend/e2e/career-dirty-indicator.spec.tsfrontend/e2e/career-field-modal.spec.tsfrontend/src/api/generated.tsfrontend/src/components/forms/CareerDiffModal.module.cssfrontend/src/components/forms/CareerResumeForm.tsxfrontend/src/components/forms/sections/CareerBasicInfoSection.tsxfrontend/src/constants/messages.tsfrontend/src/formMappers.tsfrontend/src/formTypes.tsfrontend/src/hooks/career/useCareerDirty.test.tsfrontend/src/hooks/career/useCareerDirty.tsfrontend/src/hooks/career/useCareerExperienceMutators.test.tsfrontend/src/hooks/career/useResumeDiffPreview.test.tsfrontend/src/payloadBuilders.test.tsfrontend/src/payloadBuilders.tsfrontend/src/utils/careerDiff.test.tsfrontend/src/utils/careerDiff.tsfrontend/src/utils/careerDraft.tsfrontend/tests/payloadBuilders.test.cjs
- careerDiff.test: email / github_url の変更検出と項目別ロールバック復元を明示テスト - test_endpoints: 連絡先系 3 テストの重複 payload を conftest.make_resume_payload に集約 - test_markdown_generator: 空 github の省略確認を厳密なラベルトークン "**github:**" で判定 - schemas/resume: email / github_url validator が前後空白を除去した正規化値を返すよう修正 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
概要
職務経歴書(Resume)に連絡先フィールド(email / github)を追加し、PDF・Markdown 出力でリンク表示できるようにします。あわせて、保存前の差分確認モーダルの表示崩れを修正します。
変更内容
連絡先フィールドの追加(contact / email / github)
schemas/resume.py:email(必須)/github_url(任意・https://github.com/始まりを検証)を追加resumesテーブルに contact カラムを追加CareerBasicInfoSection)/payloadBuilders/ dirty 判定 / 差分プレビューに email・github を反映frontend/src/api/generated.ts)PDF / Markdown のラベル・リンク表示
email/githubに統一<a class="meta-link">(青#0066cc・下線)[URL](URL)記法data-fp="github_url"は<a>に付与(差分ハイライトは[data-fp]全要素対象のため維持)差分確認モーダルの表示修正
CareerDiffModalの変更サマリが多いとき、行が暗黙のautoで伸びてモーダル(overflow:hidden)から clip され、ロールバック/操作ボタンが見えなくなる不具合を修正.bodyのgrid-template-rows: minmax(0, 1fr)で行高を固定し、サマリ列のoverflow-y:autoを有効化(全件スクロール可能に)テスト
make ci全 pass(backend lint/test、frontend lint/test 303 件、build)🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Database