Skip to content

🧹 [Consolidated] PaperEdit refactor + error handling test coverage#180

Merged
is0692vs merged 14 commits intomainfrom
refactor/paper-edit-form-4887655538433450222
Mar 22, 2026
Merged

🧹 [Consolidated] PaperEdit refactor + error handling test coverage#180
is0692vs merged 14 commits intomainfrom
refactor/paper-edit-form-4887655538433450222

Conversation

@is0692vs
Copy link
Copy Markdown
Contributor

@is0692vs is0692vs commented Mar 22, 2026

Summary

  • consolidate paper edit page refactor and nearby error-handling tests
  • keep scope coherent to papers/[id]/edit area

Consolidation

This PR consolidates related PRs:

Notes:

  • Main-merge is intentionally deferred until consolidated review and CI complete.

google-labs-jules Bot and others added 2 commits March 22, 2026 02:43
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>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
open-shelf Ignored Ignored Mar 22, 2026 10:43am

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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!

このプルリクエストは、PaperEditPageコンポーネントのリファクタリングを通じて、アプリケーションのコードベースの健全性を大幅に向上させることを目的としています。以前は単一のコンポーネントに集約されていたページレベルの機能とフォームレベルの機能を明確に分離することで、各コンポーネントの責任範囲が明確になり、コードの可読性と保守性が向上しました。この変更により、将来的な機能拡張やテストがより容易になります。

Highlights

  • コンポーネントの分離: 既存のPaperEditPageコンポーネントからフォーム関連のロジックとUIをPaperEditFormコンポーネントに分離しました。
  • 役割の明確化: PaperEditPageは認証、データフェッチ、ローディング状態、APIエラー処理といったページレベルの関心事に特化し、PaperEditFormはフォームの状態管理、UIレンダリング、イベント処理をカプセル化するようになりました。
  • 保守性と再利用性の向上: この分離により、コードの可読性、保守性、およびフォームコンポーネントの再利用性が大幅に向上しました。
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

このプルリクエストは、PaperEditPageからフォーム関連のロジックをPaperEditFormコンポーネントに分離することで、コードの健全性を大幅に向上させていますね。関心の分離が明確になり、各コンポーネントの責務が単一になったことで、可読性と保守性が向上しています。素晴らしいリファクタリングです。
1点だけ、新しく作成されたフォームコンポーネント内のタグの初期化ロジックについて、より堅牢にするための改善提案をさせていただきました。

Comment thread apps/web/src/components/papers/edit-form.tsx
Comment thread vitest.setup.ts Outdated
Comment thread apps/web/src/components/papers/edit-form.tsx Outdated
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 22, 2026

Warning

Rate limit exceeded

@is0692vs has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 16 minutes and 48 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: f0eefa0c-94d0-4e62-b2a5-896810fcfc5f

📥 Commits

Reviewing files that changed from the base of the PR and between ab58faf and 7a5e3ce.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (12)
  • apps/web/src/app/__tests__/paper-edit-page.test.tsx
  • apps/web/src/components/papers/__tests__/edit-form.test.tsx
  • apps/web/src/components/papers/edit-form.tsx
  • fix.py
  • fix_page_tests.py
  • fix_test.py
  • fix_year.py
  • fix_year2.py
  • get_lines.py
  • patch_script.py
  • test-year.py
  • test-year2.py
📝 Walkthrough

Walkthrough

編集ページコンポーネントが、フォームの状態管理とサブミット処理ロジックを新しい PaperEditForm コンポーネントに委譲する形へ リファクタリングされました。取得したペーパーデータが initialData として渡され、インラインのフォーム状態と検証ロジックが削除されました。

Changes

Cohort / File(s) Summary
編集ページのリファクタリング
apps/web/src/app/papers/[id]/edit/page.tsx
フォームの状態管理、バリデーション、PATCH処理を削除し、全てのロジックを PaperEditForm コンポーネントに委譲。ペーパーデータを initialData として渡すシンプルな構造に簡潔化。
新規フォームコンポーネント
apps/web/src/components/papers/edit-form.tsx
抽出されたフォームロジックを実装する新しいクライアントコンポーネント。タイトル、要約、可視性、カテゴリなどのメタデータ編集機能を含み、API呼び出し、エラーハンドリング、フォーム検証を管理。
テスト設定
vitest.setup.ts
Vitestの初期化設定ファイル。認証プロバイダーのモック化を定義し、テスト実行時の認証状態を制御。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰✨ フォームよ移りて、コンポーネント新しく
ロジック整いし、ペーパー編集すらり
状態管理も分かれて、コード清くなり
委譲の美学、リファクタの喜び!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title refers to a paper edit refactor and mentions error handling test coverage, which aligns with the main change of extracting form logic into PaperEditForm component.
Description check ✅ Passed The description explains the consolidation of related PRs and scope coherence to the papers/[id]/edit area, which is directly related to the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/paper-edit-form-4887655538433450222

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between f5be279 and ab58faf.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • apps/web/src/app/papers/[id]/edit/page.tsx
  • apps/web/src/components/papers/edit-form.tsx
  • vitest.setup.ts

Comment thread apps/web/src/components/papers/edit-form.tsx Outdated
Comment thread apps/web/src/components/papers/edit-form.tsx Outdated
Comment thread vitest.setup.ts Outdated
is0692vs and others added 3 commits March 22, 2026 12:40
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>
google-labs-jules Bot and others added 2 commits March 22, 2026 03:45
- 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>
@is0692vs is0692vs changed the title 🧹 コードの健全性向上: PaperEditPageからPaperEditFormを分離 🧹 [Consolidated] PaperEdit refactor + error handling test coverage Mar 22, 2026
is0692vs added a commit that referenced this pull request Mar 22, 2026
This PR has been merged into #180. No further code changes required here.

Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 22, 2026

Codecov Report

❌ Patch coverage is 92.70833% with 7 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
apps/web/src/components/papers/edit-form.tsx 92.13% 2 Missing and 5 partials ⚠️

📢 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>
@is0692vs
Copy link
Copy Markdown
Contributor Author

メンテナ確認済みです。Botコメント(Codecov / CodeRabbit / Gemini / Jules / Greptile / Vercel)を確認し、現時点で追加対応が必要な指摘はありません。必要な追対応が出た場合はこのPRで反映します。

@google-labs-jules
Copy link
Copy Markdown
Contributor

メンテナ確認済みです。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>
@is0692vs
Copy link
Copy Markdown
Contributor Author

追加のBotコメントも確認しました。現時点で追加修正が必要な指摘はありません。引き続き新規コメントがあればこのスレッドで対応します。

@google-labs-jules
Copy link
Copy Markdown
Contributor

追加のBotコメントも確認しました。現時点で追加修正が必要な指摘はありません。引き続き新規コメントがあればこのスレッドで対応します。

了解いたしました。これにて本タスクは完了といたします。ありがとうございました。

google-labs-jules Bot and others added 2 commits March 22, 2026 04:33
- No further action required
- Tests passing and coverage satisfied

Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
… 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>
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 22, 2026

Deployment failed with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/hirokis-projects-afd618c7?upgradeToPro=build-rate-limit

google-labs-jules Bot and others added 2 commits March 22, 2026 05:06
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).
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Mar 22, 2026

Merging this PR will not alter performance

✅ 12 untouched benchmarks


Comparing refactor/paper-edit-form-4887655538433450222 (7a5e3ce) with main (5f4b8e4)

Open in CodSpeed

@is0692vs is0692vs merged commit 42fce6e into main Mar 22, 2026
20 of 21 checks passed
@is0692vs is0692vs deleted the refactor/paper-edit-form-4887655538433450222 branch March 22, 2026 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant