Skip to content

Handle duplicate package submissions gracefully - #2014

Open
Seldaek wants to merge 3 commits into
mainfrom
handle-duplicate-package-submit
Open

Seldaek wants to merge 3 commits into
mainfrom
handle-duplicate-package-submit

Conversation

@Seldaek

@Seldaek Seldaek commented Dec 4, 2026

Copy link
Copy Markdown
Member

Submitting the same repository twice in quick succession (typically a double click on the final Submit button) could make both requests pass the "package already exists" validation. The second one then failed on the database's unique name index: the web form showed a generic "could not be saved" error, and /api/create-package returned a 500.

  • The submit form now ignores repeat clicks on the final Submit, as the Check step already did.
  • If two submissions still race (two tabs, scripts, API clients), the loser now gets "A package with the name … already exists." On the web form it shows on the repository field, and the API returns a 406 with the same error shape as other validation failures.
  • Fixes the exception context on critical logs in PackageController, which was passed as a list item instead of under the exception key.

Package creation moved into PackageManager::create(), which is covered by tests for both the normal and the duplicate case. The controller paths themselves need a real VCS repository to resolve the package name, so they aren't covered by tests that avoid the network.

The exception was passed as a list item rather than under the exception key, so logs lost the structured exception data.
…ling

Two submissions of the same repository arriving together (e.g. a double click) both passed the uniqueness validation, and the second one then failed on the database unique index. The web form showed a generic "could not be saved" error and the create-package API returned a 500. Both now report that the package already exists.
The Check step already ignored repeat clicks, but the final Submit was a plain form post with no guard.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant