Repository navigation
fix(api): answer 500 when soft delete fails - #660
Merged
Merged
Conversation
The catch block only logged the error and never sent a response, so a database failure left the DELETE request hanging until the client timed out. It now logs through the logger and returns 500 like the other handlers.
There was a problem hiding this comment.
🟢 Approval recommended
The focused error-handling fix is correct and covered by an appropriate regression test.
0 open findings
What changed in this PR
Fixes the API soft-delete endpoint so database failures return promptly instead of hanging.
Changes:
- Returns HTTP 500 and logs database errors.
- Adds a regression test for the failure response.
| File | Description |
|---|---|
api/src/services/pub-code-service.js |
Handles soft-delete failures with logging and a 500 response. |
api/test/soft-delete-repo.test.js |
Verifies the 500 status and response body. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
DELETE /api/pub-code/:repo_namehit a database error, its catch block logged the error and never sent a response. The request then hung until the caller timed out. The caller is the scheduled soft-delete utility.Changes
softDeleteReponow logs through the logger and answers500 { message: "Internal server error" }, like the other handlers.api/test/soft-delete-repo.test.jsmakes the lookup fail and expects the 500. The test fails without the fix: the response status is never set.The new test needs no database. CI will run it once #658 (which adds the API
npm testscript and test job) is merged. It passes locally withnode --test.Thanks for the PR!
Deployments, as required, will be available below:
Please create PRs in draft mode. Mark as ready to enable:
After merge, new images are deployed in: