Name the reaper's hard delete in the event body comments (closes #455) #461
@@ -15,10 +15,12 @@ import (
|
|||||||
// eventBodyQuery reads one event's stored body as bytes. The cast
|
// eventBodyQuery reads one event's stored body as bytes. The cast
|
||||||
// to blob is what makes the driver hand back the stored bytes
|
// to blob is what makes the driver hand back the stored bytes
|
||||||
// rather than a string conversion, so Content-Length taken from
|
// rather than a string conversion, so Content-Length taken from
|
||||||
// the result matches what goes on the wire. The soft-delete
|
// the result matches what goes on the wire. The retention reaper
|
||||||
// predicate is spelled out because Raw bypasses GORM's default
|
// deletes event rows outright, so a reaped event is simply gone
|
||||||
// scope, and it is what stops a reaped event still being
|
// and the query finds no row. The deleted_at predicate repeats
|
||||||
// downloadable.
|
// the soft-delete scope GORM adds to its own queries, which Raw
|
||||||
|
// bypasses; nothing soft-deletes an event, so today it excludes
|
||||||
|
// nothing.
|
||||||
const eventBodyQuery = "SELECT cast(body as blob) " +
|
const eventBodyQuery = "SELECT cast(body as blob) " +
|
||||||
"FROM events WHERE id = ? AND webhook_id = ? AND deleted_at IS NULL"
|
"FROM events WHERE id = ? AND webhook_id = ? AND deleted_at IS NULL"
|
||||||
|
|
||||||
|
|||||||
@@ -405,10 +405,11 @@ func TestHandleEventBodyDownload_UnknownEvent404s(t *testing.T) {
|
|||||||
// route. The body is read in one query before any header is
|
// route. The body is read in one query before any header is
|
||||||
// written, so a reaped event cannot produce a partial download:
|
// written, so a reaped event cannot produce a partial download:
|
||||||
// it is a clean 404 with no Content-Length and no
|
// it is a clean 404 with no Content-Length and no
|
||||||
// Content-Disposition. Both removals the codebase performs are
|
// Content-Disposition. The reaper deletes event rows outright,
|
||||||
// covered — the reaper hard-deletes, and a soft-deleted row is
|
// which is the "hard deleted" case. The "soft deleted" case
|
||||||
// excluded by the query's own deleted_at predicate rather than
|
// covers a row no code produces today: it only pins the query's
|
||||||
// by GORM's default scope, which Raw bypasses.
|
// own deleted_at predicate, the soft-delete condition Raw would
|
||||||
|
// otherwise skip.
|
||||||
func TestHandleEventBodyDownload_ReapedEvent404s(t *testing.T) {
|
func TestHandleEventBodyDownload_ReapedEvent404s(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user