Skip to content

Fix crash when creating an existing patchinfo package#19374

Open
Sahitya0805 wants to merge 1 commit intoopenSUSE:masterfrom
Sahitya0805:fix/issue-18711-patchinfo-crash
Open

Fix crash when creating an existing patchinfo package#19374
Sahitya0805 wants to merge 1 commit intoopenSUSE:masterfrom
Sahitya0805:fix/issue-18711-patchinfo-crash

Conversation

@Sahitya0805
Copy link
Copy Markdown
Contributor

@Sahitya0805 Sahitya0805 commented Mar 2, 2026

Hey Friends,

this PR resolves a crash in the Patchinfo creation flow when a package with the name "patchinfo" already exists in the project. Instead of throwing an ActiveRecord::RecordInvalid exception, the controller now catches it and shows a user-friendly error message.

Expected Behavior:

  • If a "patchinfo" package already exists, the system should not crash.
  • The user should be redirected back gracefully.
  • A clear flash error message should be displayed indicating that the package already exists.

To verify this change:

  • Go to a project where you have permissions (e.g., your home project).
  • Create a package named patchinfo manually if it doesn't exist.
  • Click on "Create patchinfo" in the project actions.
  • You should be redirected back to the project page with a flash error: "Validation failed: Project ... already has a package with the name patchinfo".

Automated tests:

Run the regression test to ensure the fix works as expected:

bundle exec rspec spec/controllers/webui/patchinfo_controller_spec.rb:114

Detailed Changes:

  • Modified PatchinfoController#create to rescue ActiveRecord::RecordInvalid.
  • Added a regression test in patchinfo_controller_spec.rb to cover the validation failure scenario.

Fixes #18711

@github-actions github-actions bot added Frontend Things related to the OBS RoR app Backend Things regarding the OBS backend labels Mar 2, 2026
@Sahitya0805 Sahitya0805 force-pushed the fix/issue-18711-patchinfo-crash branch from 2949ffe to 29f898e Compare March 2, 2026 05:37
@Sahitya0805 Sahitya0805 marked this pull request as draft March 9, 2026 04:51
@Sahitya0805 Sahitya0805 force-pushed the fix/issue-18711-patchinfo-crash branch 2 times, most recently from d5fa82e to 2921913 Compare March 9, 2026 05:46
@Sahitya0805 Sahitya0805 force-pushed the fix/issue-18711-patchinfo-crash branch 2 times, most recently from 633a82f to 8d7927d Compare March 17, 2026 05:47
@Sahitya0805 Sahitya0805 force-pushed the fix/issue-18711-patchinfo-crash branch from d659181 to b4e1299 Compare March 22, 2026 10:12
@Sahitya0805 Sahitya0805 marked this pull request as ready for review March 31, 2026 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend Things regarding the OBS backend Frontend Things related to the OBS RoR app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[production][patchinfo#create] Validation failed: Project home:$USERNAME already has a package with the name patchinfo

1 participant