Name each database target's archive for its webhook and target (closes #376)
check / check (push) Successful in 3m28s

Each database target now has its own archive file,
archive-WEBHOOKNAME-TARGETNAME-TARGETID.db, instead of one
archive-WEBHOOKID.db per webhook. delivery.ArchiveFileName builds the
name: each name is lowercased, keeps ASCII letters and digits, turns
every other run of characters into one dash, and is cut to 40
characters.

A change of webhook or target name renames its archive files under the
archive writer's lock, before the new name is saved, and back again if
the save fails. A rename never replaces a file: if one already has the
new name, the edit is refused. Deleting a target evicts only that
target's writer. Archive files are never deleted, and nothing looks for
files under the old name.

Model: opus-5-5
This commit is contained in:
2026-10-02 07:54:37 +00:00
committed by clawbot
parent c23ffbac65
commit 6257c6ec23
21 changed files with 1545 additions and 663 deletions
+9 -3
View File
@@ -132,9 +132,15 @@ type noopNotifier struct{}
func (n *noopNotifier) Notify([]delivery.Task) {}
type noopEvictor struct{}
type noopArchives struct{}
func (n *noopEvictor) EvictWebhook(string) {}
func (n *noopArchives) EvictWebhook(string) {}
func (n *noopArchives) EvictTarget(string) {}
func (n *noopArchives) Rename(_, _, _ string) error {
return nil
}
// newServerApp starts the real login path against dir: the handlers,
// the middleware that bounds password verification, the session store
@@ -163,7 +169,7 @@ func newServerApp(
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,