[CORE-372] Fix Highlight Clear Not-Found Handling#187
Conversation
e8f92c4 to
98fda1c
Compare
| return internal.ErrFormNotFound | ||
| } | ||
|
|
||
| _, err = s.queries.GetByFormID(traceCtx, formID) |
There was a problem hiding this comment.
Suggest delegating the existence check to the delete operation itself — consider changing DeleteByFormID to :execrows so the service can inspect rowsAffected directly and remove the GetByFormID pre-check entirely. This simplifies the flow from two queries down to one, and also avoids the case where a concurrent delete causes the pre-check to pass but the delete to silently no-op.
There was a problem hiding this comment.
Suggest delegating the existence check to the delete operation itself — consider changing
DeleteByFormIDto:execrowsso the service can inspect rowsAffected directly and remove theGetByFormIDpre-check entirely.
Addressed: DeleteByFormID is now :execrows and Clear checks rowsAffected == 0 for ErrHighlightNotFound, removing the extra GetByFormID round-trip.
…just related tests
Type of changes
Purpose
ErrHighlightNotFoundwhen clearing a highlight that does not existhighlight.Service.Clearwith mock dependenciesAdditional Information