Report or refuse each unusable file webhooker reads (closes #290)
check / check (push) Successful in 3m20s

Audit of the files webhooker reads configuration or required state
from. A missing or zero-length database is reported with the "created
a new, empty database" warning and its path: webhooker.db at start,
and a per-webhook database at the latest at the next start, since
restart recovery now opens the database of every webhook that still
exists. The main database's open errors name webhooker.db
(#459). webhooker resetpw
refuses a zero-length webhooker.db as it refuses a missing one. A
directory in place of a database file or its -wal or -shm is refused,
naming it; beside a -shm directory SQLite opened the database
read-only without a word. The README says how each case is treated.

Model: opus-5-5
This commit is contained in:
2026-10-02 18:50:55 +00:00
parent 9526e961b5
commit 7cb3b006fb
13 changed files with 422 additions and 56 deletions
+24 -1
View File
@@ -699,10 +699,33 @@ func (e *Engine) recoverInFlight(ctx context.Context) {
default:
}
if !e.dbManager.DBExists(webhookID) {
// The web interface is already serving, so the webhook may
// have been deleted since the list was read. Opening its
// database then would create the file again after the delete
// removed it.
var count int64
err := e.database.DB().
Model(&database.Webhook{}).
Where("id = ?", webhookID).
Count(&count).Error
if err != nil {
e.log.Error(
"failed to confirm webhook exists for recovery",
"webhook_id", webhookID,
"error", err,
)
continue
}
if count == 0 {
continue
}
// Opened even when its file is missing, so that GetDB reports
// a lost database at start, not when the webhook next receives
// an event, which for a quiet webhook may be never.
e.recoverWebhookDeliveries(ctx, webhookID)
}
}