Change. The code that manages archive files moves out of internal/delivery into a new package, internal/archive, whose doc comment says it manages the SQLite archive files the database target writes. It holds the file naming, rotation, the writers (open, write, close, reopen, close all at stop), pruning by expiry, rename with rollback, the gzipped JSON export, the idle sweep, and the lock that keeps a rename apart from writes and exports (today Handlers.renameMu, handed into delivery.NewArchiveExport). The database target type stays in internal/delivery as the few lines that call it; the handlers call internal/archive for rename, download and the target list's file figures.
Why.internal/delivery is "deliver an event to a target", but about a quarter of it is file management for one target type, and the lock that orders renames against writes lives in the HTTP handlers' struct. In one package, the writers, the sweeper, the export and their lock live together.
Not part of this. Renaming the database target type to archive was not approved; keep every name a user or the database sees. Move code; do not rewrite what it does.
What it touches.internal/delivery/target_database.go, target_database_archive.go, target_database_rotation.go, target_database_export.go, archive_sweeper.go and their tests; internal/delivery/engine.go (the engine's archive writers, the Archives interface, closing the writers at stop); internal/handlers/handlers.go (renameMu), target_create.go, target_edit.go, webhook_edit.go, target_download.go, target_list.go (archiveFileView); cmd/webhooker/main.go (wiring; the stop order in the README's Shutdown section must not change); the README wherever it names these files or packages.
Definition of done.internal/archive holds all archive file management and the rename lock; internal/delivery keeps only the target type's delivery; the handlers hold no archive lock. Behaviour is unchanged: the moved tests pass in their new package, and the stop order is as the README lists it. The README names the new package where it named the old files.
Model: opus-5-5
Approved by sneak on https://git.eeqj.de/sneak/webhooker/issues/499#issuecomment-142500.
**Change.** The code that manages archive files moves out of `internal/delivery` into a new package, `internal/archive`, whose doc comment says it manages the SQLite archive files the `database` target writes. It holds the file naming, rotation, the writers (open, write, close, reopen, close all at stop), pruning by expiry, rename with rollback, the gzipped JSON export, the idle sweep, and the lock that keeps a rename apart from writes and exports (today `Handlers.renameMu`, handed into `delivery.NewArchiveExport`). The `database` target type stays in `internal/delivery` as the few lines that call it; the handlers call `internal/archive` for rename, download and the target list's file figures.
**Why.** `internal/delivery` is "deliver an event to a target", but about a quarter of it is file management for one target type, and the lock that orders renames against writes lives in the HTTP handlers' struct. In one package, the writers, the sweeper, the export and their lock live together.
**Not part of this.** Renaming the `database` target type to `archive` was not approved; keep every name a user or the database sees. Move code; do not rewrite what it does.
**What it touches.** `internal/delivery/target_database.go`, `target_database_archive.go`, `target_database_rotation.go`, `target_database_export.go`, `archive_sweeper.go` and their tests; `internal/delivery/engine.go` (the engine's archive writers, the `Archives` interface, closing the writers at stop); `internal/handlers/handlers.go` (`renameMu`), `target_create.go`, `target_edit.go`, `webhook_edit.go`, `target_download.go`, `target_list.go` (`archiveFileView`); `cmd/webhooker/main.go` (wiring; the stop order in the README's Shutdown section must not change); the README wherever it names these files or packages.
**Definition of done.** `internal/archive` holds all archive file management and the rename lock; `internal/delivery` keeps only the target type's delivery; the handlers hold no archive lock. Behaviour is unchanged: the moved tests pass in their new package, and the stop order is as the README lists it. The README names the new package where it named the old files.
Model: opus-5-5
clawbot
self-assigned this 2026-10-15 11:57:19 +02:00
Built in #552: the archive files are managed by internal/archive, the database target in internal/delivery writes through it, and the rename lock lives there. The handlers take that lock through the package's interface rather than owning one. The stop order is unchanged.
Model: opus-5-5
Built in https://git.eeqj.de/sneak/webhooker/pulls/552: the archive files are managed by `internal/archive`, the `database` target in `internal/delivery` writes through it, and the rename lock lives there. The handlers take that lock through the package's interface rather than owning one. The stop order is unchanged.
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. The code that manages archive files moves out of
internal/deliveryinto a new package,internal/archive, whose doc comment says it manages the SQLite archive files thedatabasetarget writes. It holds the file naming, rotation, the writers (open, write, close, reopen, close all at stop), pruning by expiry, rename with rollback, the gzipped JSON export, the idle sweep, and the lock that keeps a rename apart from writes and exports (todayHandlers.renameMu, handed intodelivery.NewArchiveExport). Thedatabasetarget type stays ininternal/deliveryas the few lines that call it; the handlers callinternal/archivefor rename, download and the target list's file figures.Why.
internal/deliveryis "deliver an event to a target", but about a quarter of it is file management for one target type, and the lock that orders renames against writes lives in the HTTP handlers' struct. In one package, the writers, the sweeper, the export and their lock live together.Not part of this. Renaming the
databasetarget type toarchivewas not approved; keep every name a user or the database sees. Move code; do not rewrite what it does.What it touches.
internal/delivery/target_database.go,target_database_archive.go,target_database_rotation.go,target_database_export.go,archive_sweeper.goand their tests;internal/delivery/engine.go(the engine's archive writers, theArchivesinterface, closing the writers at stop);internal/handlers/handlers.go(renameMu),target_create.go,target_edit.go,webhook_edit.go,target_download.go,target_list.go(archiveFileView);cmd/webhooker/main.go(wiring; the stop order in the README's Shutdown section must not change); the README wherever it names these files or packages.Definition of done.
internal/archiveholds all archive file management and the rename lock;internal/deliverykeeps only the target type's delivery; the handlers hold no archive lock. Behaviour is unchanged: the moved tests pass in their new package, and the stop order is as the README lists it. The README names the new package where it named the old files.Model: opus-5-5
Built in #552: the archive files are managed by
internal/archive, thedatabasetarget ininternal/deliverywrites through it, and the rename lock lives there. The handlers take that lock through the package's interface rather than owning one. The stop order is unchanged.Model: opus-5-5