Change. A webhook's retention is stored as the number of days entered, with 0 meaning events are kept forever. The column default goes; the create form applies the default of 30 itself.
Why.retention_days has a column default of 30 (in 001_schema.sql and the gorm:"default:30" tag on Webhook.RetentionDays), which turns a stored 0 back into 30. To store "forever" anyway the code uses a sentinel of 365000 days (RetentionForeverDays), written by Webhook.BeforeSave, tested by retainsForever, and accepted by parseRetentionDays as a third band of input. Without the column default, 0 is stored as 0 and all of that goes, and the edit form shows 0 for forever, which is what its text already says.
What it touches.
internal/db/migrations/main/001_schema.sql: drop DEFAULT 30 on retention_days (pre-1.0: edit the file, add no migration).
internal/database/model_webhook.go: remove RetentionForeverDays, BeforeSave and the default tag; retainsForever becomes a test for 0 or goes. DefaultRetentionDays and MaxFiniteRetentionDays stay.
internal/database/retention.go: retentionCutoff and its callers treat 0 as forever.
internal/handlers/shared.go (parseRetentionDays) and its callers in webhook_create.go and webhook_edit.go: blank means the default on create, 0 means forever, 1 to MaxFiniteRetentionDays is a day count, anything else is refused with the existing message.
README: the Webhook section and every other sentence about the sentinel.
Definition of done. No sentinel and no BeforeSave rewrite remain. A webhook saved with 0 reads back 0 and retention never deletes its events; a blank field on create gives 30; a value above MaxFiniteRetentionDays is refused. Tests cover blank, 0, a day count and a too-large value, and that retention keeps the events of a webhook set to 0. The README matches the code.
Model: opus-5-5
Approved by sneak on https://git.eeqj.de/sneak/webhooker/issues/499#issuecomment-142500.
**Change.** A webhook's retention is stored as the number of days entered, with 0 meaning events are kept forever. The column default goes; the create form applies the default of 30 itself.
**Why.** `retention_days` has a column default of 30 (in `001_schema.sql` and the `gorm:"default:30"` tag on `Webhook.RetentionDays`), which turns a stored 0 back into 30. To store "forever" anyway the code uses a sentinel of 365000 days (`RetentionForeverDays`), written by `Webhook.BeforeSave`, tested by `retainsForever`, and accepted by `parseRetentionDays` as a third band of input. Without the column default, 0 is stored as 0 and all of that goes, and the edit form shows 0 for forever, which is what its text already says.
**What it touches.**
- `internal/db/migrations/main/001_schema.sql`: drop `DEFAULT 30` on `retention_days` (pre-1.0: edit the file, add no migration).
- `internal/database/model_webhook.go`: remove `RetentionForeverDays`, `BeforeSave` and the default tag; `retainsForever` becomes a test for 0 or goes. `DefaultRetentionDays` and `MaxFiniteRetentionDays` stay.
- `internal/database/retention.go`: `retentionCutoff` and its callers treat 0 as forever.
- `internal/handlers/shared.go` (`parseRetentionDays`) and its callers in `webhook_create.go` and `webhook_edit.go`: blank means the default on create, 0 means forever, 1 to `MaxFiniteRetentionDays` is a day count, anything else is refused with the existing message.
- README: the Webhook section and every other sentence about the sentinel.
**Definition of done.** No sentinel and no `BeforeSave` rewrite remain. A webhook saved with 0 reads back 0 and retention never deletes its events; a blank field on create gives 30; a value above `MaxFiniteRetentionDays` is refused. Tests cover blank, 0, a day count and a too-large value, and that retention keeps the events of a webhook set to 0. The README matches the code.
Model: opus-5-5
clawbot
self-assigned this 2026-10-15 11:57:18 +02:00
Built in #546. A retention of 0 is now stored as 0 and means forever, and the stand-in value and save hook are gone. A blank field on the new webhook form still gives 30. One judgement call is recorded in the PR body: a negative value, which the forms refuse, is still read as forever.
Model: opus-5-5
Built in https://git.eeqj.de/sneak/webhooker/pulls/546. A retention of 0 is now stored as 0 and means forever, and the stand-in value and save hook are gone. A blank field on the new webhook form still gives 30. One judgement call is recorded in the PR body: a negative value, which the forms refuse, is still read as forever.
Model: opus-5-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Approved by sneak on #499 (comment).
Change. A webhook's retention is stored as the number of days entered, with 0 meaning events are kept forever. The column default goes; the create form applies the default of 30 itself.
Why.
retention_dayshas a column default of 30 (in001_schema.sqland thegorm:"default:30"tag onWebhook.RetentionDays), which turns a stored 0 back into 30. To store "forever" anyway the code uses a sentinel of 365000 days (RetentionForeverDays), written byWebhook.BeforeSave, tested byretainsForever, and accepted byparseRetentionDaysas a third band of input. Without the column default, 0 is stored as 0 and all of that goes, and the edit form shows 0 for forever, which is what its text already says.What it touches.
internal/db/migrations/main/001_schema.sql: dropDEFAULT 30onretention_days(pre-1.0: edit the file, add no migration).internal/database/model_webhook.go: removeRetentionForeverDays,BeforeSaveand the default tag;retainsForeverbecomes a test for 0 or goes.DefaultRetentionDaysandMaxFiniteRetentionDaysstay.internal/database/retention.go:retentionCutoffand its callers treat 0 as forever.internal/handlers/shared.go(parseRetentionDays) and its callers inwebhook_create.goandwebhook_edit.go: blank means the default on create, 0 means forever, 1 toMaxFiniteRetentionDaysis a day count, anything else is refused with the existing message.Definition of done. No sentinel and no
BeforeSaverewrite remain. A webhook saved with 0 reads back 0 and retention never deletes its events; a blank field on create gives 30; a value aboveMaxFiniteRetentionDaysis refused. Tests cover blank, 0, a day count and a too-large value, and that retention keeps the events of a webhook set to 0. The README matches the code.Model: opus-5-5
Built in #546. A retention of 0 is now stored as 0 and means forever, and the stand-in value and save hook are gone. A blank field on the new webhook form still gives 30. One judgement call is recorded in the PR body: a negative value, which the forms refuse, is still read as forever.
Model: opus-5-5