OUT-4027 | Fix 500 when deleting a task whose label row is missing - #1397
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThe PR prevents task deletion from failing when its label registry row is already absent.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains within the eligible follow-up review scope. Important Files Changed
Reviews (2): Last reviewed commit: "OUT-4027 | Guard deleteLabel against an ..." | Re-trigger Greptile |
priosshrsth
force-pushed
the
anit/out-4027-debug-task-delete-issue
branch
from
August 6, 2026 12:09
558979a to
e797c97
Compare
Contributor
|
Deployment failed for project tasks-app with the following error: Learn More: https://vercel.link/multiple-function-regions |
Collaborator
Author
|
@greptileai the pr has changed a lot. Re review again. |
deleteLabel passed `id: currentLabel?.id` straight into label.delete, so when
findFirst matched nothing Prisma got `{ id: undefined }` and threw
PrismaClientValidationError, failing the whole delete transaction. Return early
instead.
Rows go missing because softDeleteAllSubtasks soft-deletes Labels rows by label
string, which is not unique across workspaces. Fixed separately in OUT-4029.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
priosshrsth
force-pushed
the
anit/out-4027-debug-task-delete-issue
branch
from
August 6, 2026 12:14
e797c97 to
65ba2e5
Compare
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.
Deleting a task 500'd with
PrismaClientValidationError … Argument where of type LabelWhereUniqueInput needs at least one of id. OUT-4027deleteLabelpassedid: currentLabel?.idstraight intolabel.delete, so when thefindFirstmatched nothing Prisma received{ id: undefined }and threw, failing the whole delete transaction. One guard, plus a test.What to look at
label-mapping.service.ts— the early return. The label row being absent is now a no-op;Labelsis a next-number registry, so a missing row costs nothing at delete time.Verified: new unit test covers both branches.
yarn tscandyarn lint:checkclean. Unit suite passes exceptwithErrorHandler/authenticate, which fail identically onmain.Not verified: no manual run of the delete endpoint.
Not fixed here — OUT-4029: rows go missing in the first place because
softDeleteAllSubtasksmatchesTasksandLabelsby label string with no workspace scope. Prod has 3,631 label strings shared across 2+ workspaces (THE10-001spans 121), 747 live tasks that hit this 500, and 2,390 tasks soft-deleted as collateral by the unscopedtask.deleteMany. This PR stops the 500; it does not stop the collateral deletes, so those counts keep climbing until OUT-4029 lands.🤖 Generated with Claude Code