Repository navigation
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Missing-row return and test packages/drizzle/src/deleteOne.ts, packages/drizzle/src/deleteOne.spec.ts |
When the distinct query result has no row with an id, deleteOne returns null before the fallback lookup. The test verifies that findFirst and deleteWhere are not called. |
Priority:
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested reviewers: alessiogr
Merge Risk: 
Minimal · up to 0f68b
-
Deleting a missing preference can now return null rather than failing in the fallback lookup. No issue requiring a fix before merge was found.
Pre-merge checks: 
5
-
Full details: Title check
-
Explanation
The title names the change (deleteOne returns null when the joined select finds no row) and the scope (drizzle), which matches the diff: a new early return in packages/drizzle/src/deleteOne.ts plus a unit spec. It is specific and conveys the primary change.
Full details: Description check
-
Explanation
The description states the symptom (DELETE of a missing key returns 500 on Postgres), the cause (fallback findFirst reuses a where that references the unjoined user table), the fix (return null when the joined select finds nothing), and the added unit spec. It matches the raw summary and the PR objectives.
Full details: Linked Issues check
-
Explanation
Issue
#19044requires missing-key deletion to avoid the Postgres 500 and return a no-op result such as 404 or 200. Inpackages/drizzle/src/deleteOne.ts, the code now returnsnullwhenselectDistinctreturns no row, so it does not execute the fallback query with the joinedwhere. The newdeleteOne.spec.tsverifies that the result isnulland that neitherfindFirstnordeleteWhereruns. The existing fallback remains for an absentselectDistinctResult, which preserves the no-join path.
Full details: Out of Scope Changes check
-
Explanation
The pull request changes only
packages/drizzle/src/deleteOne.tsand its focused unit spec. The code change directly addresses issue#19044. The test verifies the affected missing-row behavior. No unrelated implementation or test changes are present in the reviewed diff.
Full details: Docstring Coverage
-
Explanation
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
The tanstack-start E2E failure isn't from this change. That job runs on MongoDB, the same test passes on the next build, and this PR only touches the Drizzle adapter. |
|
Hey @jacobsfletch, please take a look when you have time~ |
What?
DELETE /api/payload-preferences/<missing-key>returns a 500 on Postgres instead of a 404.Why?
When the joined select in
deleteOnefinds no row, the fallbackfindFirstreuses the samewhere, which references the joinedusertable that the fallback query doesn't join, so Postgres throwsmissing FROM-clause entry.How?
Return
nullright away when the joined select ran and found nothing. The fallback still runs when there are no joins. Added a unit spec for it.Fixes #19044