Name each database target's archive for its webhook and target (closes #376)
check / check (push) Waiting to run

Each database target now writes its own archive file, archive-WEBHOOKNAME-TARGETNAME-TARGETID.db, named by delivery.ArchiveFileName, in place of one archive per webhook keyed on its UUID. Renaming a webhook or a target renames its archive files (with any -wal and -shm) before the new name is saved, never over an existing file, and moves every one back if a rename or the save fails. The webhook edit, the target edit and target creation share one lock so no two interleave. Deleting a webhook or target leaves its files on disk. Nothing looks for the old archive-WEBHOOKID.db files. The README gives the naming and the recovery steps.

Model: opus-5-5
This commit was merged in pull request #418.
This commit is contained in:
2026-10-02 13:28:49 +02:00
parent 21aafbf928
commit fd036774f9
21 changed files with 1825 additions and 663 deletions
+12 -6
View File
@@ -47,12 +47,18 @@ type noopNotifier struct{}
func (n *noopNotifier) Notify([]delivery.Task) {}
// noopEvictor satisfies handlers.New's delivery.WebhookEvictor
// dependency. No test here checks what gets evicted, so it records
// nothing.
type noopEvictor struct{}
// noopArchives satisfies handlers.New's delivery.Archives
// dependency. No test here checks what gets evicted or renamed, so
// it records nothing.
type noopArchives struct{}
func (e *noopEvictor) EvictWebhook(string) {}
func (e *noopArchives) EvictWebhook(string) {}
func (e *noopArchives) EvictTarget(string) {}
func (e *noopArchives) Rename(_, _, _ string) error {
return nil
}
// testEnv is the real router from routes.go plus the collaborators
// tests need to seed users and forge sessions.
@@ -117,7 +123,7 @@ func newTestEnvWithConfig(
healthcheck.New,
session.New,
func() delivery.Notifier { return &noopNotifier{} },
func() delivery.WebhookEvictor { return &noopEvictor{} },
func() delivery.Archives { return &noopArchives{} },
metrics.NewRegistry,
metrics.New,
middleware.New,