Offer archive expiry choices on the target forms, show plain units (closes #396) #479

Merged
clawbot merged 1 commits from issue-396-archive-expiry-choices into next 2026-10-03 01:16:15 +02:00
Collaborator

Adding or editing a database target now offers the archive expiry choices of the new webhook page (never, 1h, 12h, 24h, 30d, 90d, 365d) in place of a text field, as planned on #396. The list is defined once, in internal/handlers/archive_expiry.go, and the new webhook page, the add target form and the target edit form all render it. The edit form starts on the expiry it shows: the stored one when opened, the submitted one after a refused save. The target list shows the expiry in plain units ("30 days", "12 hours", "never"), using the largest whole unit that fits.

What the diff does not show:

  • The server still accepts any expiry the add target form accepted before; the seven choices exist only in the forms, as on #476.

  • The add target form's select is set by Alpine from the form's expiry, like its other fields, so the server marks no choice selected there.

  • A target stored with an empty expiry opens on never; saving it unchanged stores never, which means the same.

  • Judgement call: a stored expiry that is not one of the choices is listed first in the edit form under its stored value, such as 36h, so saving unchanged keeps it.

Model: opus-5-5

Adding or editing a `database` target now offers the archive expiry choices of the new webhook page (never, 1h, 12h, 24h, 30d, 90d, 365d) in place of a text field, as planned on https://git.eeqj.de/sneak/webhooker/issues/396. The list is defined once, in `internal/handlers/archive_expiry.go`, and the new webhook page, the add target form and the target edit form all render it. The edit form starts on the expiry it shows: the stored one when opened, the submitted one after a refused save. The target list shows the expiry in plain units ("30 days", "12 hours", "never"), using the largest whole unit that fits. What the diff does not show: - The server still accepts any expiry the add target form accepted before; the seven choices exist only in the forms, as on https://git.eeqj.de/sneak/webhooker/pulls/476. - The add target form's select is set by Alpine from the form's expiry, like its other fields, so the server marks no choice selected there. - A target stored with an empty expiry opens on never; saving it unchanged stores never, which means the same. - Judgement call: a stored expiry that is not one of the choices is listed first in the edit form under its stored value, such as `36h`, so saving unchanged keeps it. Model: opus-5-5
clawbot added the needs-review label 2026-10-03 00:43:56 +02:00
clawbot self-assigned this 2026-10-03 00:43:56 +02:00
Author
Collaborator

Review: FAIL (needs-rebase, needs-rework).

  1. The branch no longer rebases onto current next. #474 has landed, and the rebase conflicts in internal/handlers/source_management.go, internal/handlers/target_edit.go, internal/server/alpine_browser_test.go and templates/target_edit.html. Acceptable: rebased onto current next, with the target edit form's choices built from the values the form shows (TargetForm.Expiry), so it starts on the stored expiry when opened and on the submitted expiry after a refused save; the database case of TestHandleTargetEditSubmit_RefusedFormComesBack checking that the select starts on the submitted expiry; and the browser test using next's checkAddEachTargetType instead of adding checkAddEveryTarget for the same table.
  2. Two comments are no longer true: the doc comment on databaseConfigForm in internal/delivery/target_config_edit.go, and the comment above TestNewTargetConfigForm_DatabaseNeverIsBlank in internal/delivery/target_headers_test.go. Both say an empty stored expiry fills the form with an empty field, so saving unchanged stores the same empty configuration. With the select, the edit form starts on never and saving stores {"expiry":"never"}. Acceptable: both comments say what now happens: the form starts on never, and saving stores never, which means the same as an empty expiry.

The disclosed handling of a stored expiry outside the choices is right: the server still accepts any positive duration, so the edit form must show the stored value rather than silently replace it with never on an unrelated edit.

Model: opus-5-5

Review: FAIL (needs-rebase, needs-rework). 1. The branch no longer rebases onto current `next`. https://git.eeqj.de/sneak/webhooker/pulls/474 has landed, and the rebase conflicts in `internal/handlers/source_management.go`, `internal/handlers/target_edit.go`, `internal/server/alpine_browser_test.go` and `templates/target_edit.html`. Acceptable: rebased onto current `next`, with the target edit form's choices built from the values the form shows (`TargetForm.Expiry`), so it starts on the stored expiry when opened and on the submitted expiry after a refused save; the `database` case of `TestHandleTargetEditSubmit_RefusedFormComesBack` checking that the select starts on the submitted expiry; and the browser test using `next`'s `checkAddEachTargetType` instead of adding `checkAddEveryTarget` for the same table. 2. Two comments are no longer true: the doc comment on `databaseConfigForm` in `internal/delivery/target_config_edit.go`, and the comment above `TestNewTargetConfigForm_DatabaseNeverIsBlank` in `internal/delivery/target_headers_test.go`. Both say an empty stored expiry fills the form with an empty field, so saving unchanged stores the same empty configuration. With the select, the edit form starts on never and saving stores `{"expiry":"never"}`. Acceptable: both comments say what now happens: the form starts on never, and saving stores never, which means the same as an empty expiry. The disclosed handling of a stored expiry outside the choices is right: the server still accepts any positive duration, so the edit form must show the stored value rather than silently replace it with never on an unrelated edit. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-03 00:59:57 +02:00
clawbot added 1 commit 2026-10-03 01:04:50 +02:00
Adding or editing a database target now offers the archive expiry
choices of the new webhook page (never, 1h, 12h, 24h, 30d, 90d, 365d)
in place of a text field. The list is defined once, in
internal/handlers/archive_expiry.go, and all three forms render it. The
edit form starts on the expiry it shows: the stored one, or the
submitted one after a refused save. One that is not among the choices
is listed first as its own entry, so saving unchanged keeps it. The
target list shows the expiry in plain units, such as "30 days" or
"12 hours", or "never".

Model: opus-5-5
clawbot force-pushed issue-396-archive-expiry-choices from af6cafc535 to 7151954a56 2026-10-03 01:04:50 +02:00 Compare
clawbot added needs-review and removed needs-rework labels 2026-10-03 01:05:10 +02:00
Author
Collaborator
  1. Rebased onto next. The target edit form's choices are built from TargetForm.Expiry, so it starts on the stored expiry when opened and on the submitted one after a refused save; the database case of TestHandleTargetEditSubmit_RefusedFormComesBack checks the select starts on the submitted expiry; the browser test keeps next's checkAddEachTargetType and only adds its archive expiry check after it.
  2. Both comments now say the form starts on never and saving stores never, which means the same as an empty expiry.

The PR body no longer carries the two lines the rebase made untrue (the unlanded #474 and the moved table).

Model: opus-5-5

1. Rebased onto `next`. The target edit form's choices are built from `TargetForm.Expiry`, so it starts on the stored expiry when opened and on the submitted one after a refused save; the `database` case of `TestHandleTargetEditSubmit_RefusedFormComesBack` checks the select starts on the submitted expiry; the browser test keeps `next`'s `checkAddEachTargetType` and only adds its archive expiry check after it. 2. Both comments now say the form starts on never and saving stores never, which means the same as an empty expiry. The PR body no longer carries the two lines the rebase made untrue (the unlanded https://git.eeqj.de/sneak/webhooker/pulls/474 and the moved table). Model: opus-5-5
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit 3489d6909a into next 2026-10-03 01:16:15 +02:00
clawbot deleted branch issue-396-archive-expiry-choices 2026-10-03 01:16:15 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/webhooker#479