🧹 [Consolidated] PaperEdit refactor + error handling test coverage#180
🧹 [Consolidated] PaperEdit refactor + error handling test coverage#180
Conversation
Adds unit tests to verify the UI displays the correct error messages when fetching paper metadata fails due to unexpected errors. Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
Moves the form logic, state, and JSX out of the `PaperEditPage` component into a new `PaperEditForm` component. The page now only handles data fetching, authentication, and loading/error states, improving separation of concerns and maintainability. Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! このプルリクエストは、 Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (12)
📝 WalkthroughWalkthrough編集ページコンポーネントが、フォームの状態管理とサブミット処理ロジックを新しい Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/web/src/components/papers/edit-form.tsx`:
- Around line 73-84: The current parsing of initialData.tags runs on every
render; change to useState's lazy initializer so parsing only runs once by
moving the JSON.parse/Array.isArray/try-catch logic into the function passed to
useState for tagsStr (keep handling of undefined/null and fallback to
String(initialData.tags)); update references to initialTags to use the lazy
initializer and keep setTagsStr unchanged.
- Around line 90-93: Add client-side max-length enforcement for the title and
abstract: define or import the same constants (MAX_TITLE_LENGTH = 300,
MAX_ABSTRACT_LENGTH = 5000) and apply them to the corresponding input/textarea
components (the title state/field and the abstract field in edit-form.tsx) via
their maxLength props, and also add length checks in the submit/validation logic
(where title.trim() is validated) to setError with a clear message when
title.length or abstract.length exceeds the respective limits; this ensures
immediate feedback before the server rejects the request.
In `@vitest.setup.ts`:
- Line 1: Rename the file from vitest.setup.ts to vitest-setup.ts to follow
kebab-case conventions, then update all import/require references and any
configuration entries (e.g., Vitest or tsconfig/test setup paths) that point to
"vitest.setup.ts" to use "vitest-setup.ts"; ensure the exported/used symbol
(here the test setup importing vi from 'vitest') remains unchanged and run the
test suite to verify no broken imports remain.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 28f16b3c-e600-4982-90d5-da0bf51c75e3
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (3)
apps/web/src/app/papers/[id]/edit/page.tsxapps/web/src/components/papers/edit-form.tsxvitest.setup.ts
Address PR review feedback. 1. Removed the unused `beforeEach` import from `apps/web/src/app/papers/[id]/edit/__tests__/page.test.tsx` 2. Restored `package-lock.json` back to HEAD state to eliminate unrelated diffs caused by local `npm install`. Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
- Update tags initialization to use lazy initialization - Fallback to stringifying valid JSON that is not an array for tags - Add maxLength constraints (300 for title, 5000 for abstract) - Add validation error message for title and abstract max length - Remove unused root vitest.setup.ts Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
This PR has been merged into #180. No further code changes required here. Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Adds tests for: - MaxLength validation on titles (> 300) - MaxLength validation on abstracts (> 5000) - Tags parsing fallback mechanisms These satisfy Codecov requirements which failed due to untested new validation code in the edit form. Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
|
メンテナ確認済みです。Botコメント(Codecov / CodeRabbit / Gemini / Jules / Greptile / Vercel)を確認し、現時点で追加対応が必要な指摘はありません。必要な追対応が出た場合はこのPRで反映します。 |
承知いたしました。メンテナ様による確認およびテストの通過をこちらでも認識しております。これにて本PRは完了とさせていただきます。 |
- No further action required - Acknowledged maintainer response Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
|
追加のBotコメントも確認しました。現時点で追加修正が必要な指摘はありません。引き続き新規コメントがあればこのスレッドで対応します。 |
了解いたしました。これにて本タスクは完了といたします。ありがとうございました。 |
- No further action required - Tests passing and coverage satisfied Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
…orm-4887655538433450222
… cases - Moves form validation tests from `paper-edit-page.test.tsx` to `edit-form.test.tsx` - Adds tests for failed `apiFetch` calls (500 errors) - Adds test for handling invalid year inputs (NaN fallback) This will improve mapping of code coverage correctly against the new PaperEditForm component and satisfy Codecov requirements. Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
|
Deployment failed with the following error: Learn More: https://vercel.com/hirokis-projects-afd618c7?upgradeToPro=build-rate-limit |
Adds test cases triggering change handlers on remaining form inputs (venue, category, external URL, doi, showViewCount, language) to ensure comprehensive code coverage metric updates on Codecov. Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
Resolved conflict in .github/issue-pr-review-loop-runbook.md by keeping it deleted (per PR #180 consolidation intent).
Summary
papers/[id]/editareaConsolidation
This PR consolidates related PRs:
Notes: