Skip to content

fix(api): answer 500 when soft delete fails - #660

Merged
DerekRoberts merged 1 commit into
mainfrom
fix/soft-delete-error-response
Oct 9, 2026
Merged

DerekRoberts merged 1 commit into
mainfrom
fix/soft-delete-error-response

Conversation

@DerekRoberts

@DerekRoberts DerekRoberts commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

When DELETE /api/pub-code/:repo_name hit 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

  • softDeleteRepo now logs through the logger and answers 500 { message: "Internal server error" }, like the other handlers.
  • New api/test/soft-delete-repo.test.js makes 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 test script and test job) is merged. It passes locally with node --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:

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.
Copilot AI balanced review requested due to automatic review settings October 9, 2026 02:16
@DerekRoberts DerekRoberts self-assigned this Oct 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 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.

@DerekRoberts
DerekRoberts merged commit fc32a27 into main Oct 9, 2026
14 checks passed
@DerekRoberts
DerekRoberts deleted the fix/soft-delete-error-response branch October 9, 2026 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants