Archive database filename includes the webhook name and the target name #376

Open
opened 2026-10-01 21:18:21 +02:00 by clawbot · 3 comments
Collaborator

Owner's words (chat, 2026-10-01 ~19:18 UTC):

the filename of the archive database should include the webhook name and target name in the filename

Today the file is archive-<webhook id>.db (internal/delivery/target_database.go, archivePath): one file per webhook, with no names in it.

PRIORITY: an owner's direct request of 1 October, in the tier of #367 to #375: after the production path, ahead of the older backlog. Related: #374 (Download button; its export filename should follow the same naming).

Definition of done:

  • An archive database's filename contains the webhook's name and the database target's name, made filesystem-safe, plus whatever ID keeps it unique. For example: archive-<webhook-name>-<target-name>-<id>.db.
  • The plan comment on this issue states, before implementation:
    • whether there is one archive per database target or one per webhook. Including the target name implies one per target;
    • how names are made safe (characters, length);
    • what happens when the webhook or target is renamed. Recommendation: the file is renamed along with it, so the name on disk always matches the UI;
    • that deleting a webhook still leaves its archive file on disk (owner confirmed this as correct, ~19:16 UTC).
  • Pre-1.0: no handling of files under the old name, no migration, no compatibility.
  • Tests cover the naming, unsafe characters, and renames. Lands on next with an independent review.

model: opus-5-5

Owner's words (chat, 2026-10-01 ~19:18 UTC): > the filename of the archive database should include the webhook name and target name in the filename Today the file is `archive-<webhook id>.db` (`internal/delivery/target_database.go`, `archivePath`): one file per webhook, with no names in it. PRIORITY: an owner's direct request of 1 October, in the tier of https://git.eeqj.de/sneak/webhooker/issues/367 to https://git.eeqj.de/sneak/webhooker/issues/375: after the production path, ahead of the older backlog. Related: https://git.eeqj.de/sneak/webhooker/issues/374 (Download button; its export filename should follow the same naming). Definition of done: - An archive database's filename contains the webhook's name and the database target's name, made filesystem-safe, plus whatever ID keeps it unique. For example: `archive-<webhook-name>-<target-name>-<id>.db`. - The plan comment on this issue states, before implementation: - whether there is one archive per database target or one per webhook. Including the target name implies one per target; - how names are made safe (characters, length); - what happens when the webhook or target is renamed. Recommendation: the file is renamed along with it, so the name on disk always matches the UI; - that deleting a webhook still leaves its archive file on disk (owner confirmed this as correct, ~19:16 UTC). - Pre-1.0: no handling of files under the old name, no migration, no compatibility. - Tests cover the naming, unsafe characters, and renames. Lands on `next` with an independent review. model: opus-5-5
clawbot self-assigned this 2026-10-01 21:18:21 +02:00
Author
Collaborator

Question for the owner, asked in chat 2026-10-01 ~19:24 UTC: today every database target of a webhook writes into one shared archive file, archive-<webhook id>.db. The path is keyed by the webhook only (archivePath(webhookID) in internal/delivery/target_database.go on next). Putting the target's name in the filename means each database target gets its own archive file. Is that what you want?

Recommendation: yes, one archive file per database target. Then each target's pruning setting (#373) and its Download button (#374) apply to exactly its own data.

model: opus-5-5

Question for the owner, asked in chat 2026-10-01 ~19:24 UTC: today every database target of a webhook writes into one shared archive file, `archive-<webhook id>.db`. The path is keyed by the webhook only (`archivePath(webhookID)` in `internal/delivery/target_database.go` on `next`). Putting the target's name in the filename means each database target gets its own archive file. Is that what you want? Recommendation: yes, one archive file per database target. Then each target's pruning setting (https://git.eeqj.de/sneak/webhooker/issues/373) and its Download button (https://git.eeqj.de/sneak/webhooker/issues/374) apply to exactly its own data. model: opus-5-5
Author
Collaborator

Plan.

  • One archive per database target, not one per webhook. Each target's own expiry then governs only its own archive, and the README's note that the shortest expiry governs a shared archive goes.
  • Filename: archive-WEBHOOKNAME-TARGETNAME-TARGETID.db. One function makes the names safe: lowercased; letters and digits kept; every other run of characters becomes one -; leading and trailing - trimmed; each name cut to 40 characters; an empty result becomes unnamed. The target ID keeps the filename unique.
  • Renames: when the webhook or the target is renamed, the file is renamed with it, under the same lock that the archive writer and the sweep take, so the name on disk always matches the UI. A missing file (moved away by the operator) is not an error; the next write creates it under the new name.
  • Deletes: deleting a webhook leaves its archive files on disk, as the owner confirmed; deleting a target leaves its file too.
  • Pre-1.0: nothing looks for or moves files under the old archive-WEBHOOKID.db name.
  • Sequencing: after #367, which touches the same rename handlers. #374's export uses the same naming function.

Model: opus-5-5

Plan. - **One archive per `database` target**, not one per webhook. Each target's own expiry then governs only its own archive, and the README's note that the shortest expiry governs a shared archive goes. - **Filename:** `archive-WEBHOOKNAME-TARGETNAME-TARGETID.db`. One function makes the names safe: lowercased; letters and digits kept; every other run of characters becomes one `-`; leading and trailing `-` trimmed; each name cut to 40 characters; an empty result becomes `unnamed`. The target ID keeps the filename unique. - **Renames:** when the webhook or the target is renamed, the file is renamed with it, under the same lock that the archive writer and the sweep take, so the name on disk always matches the UI. A missing file (moved away by the operator) is not an error; the next write creates it under the new name. - **Deletes:** deleting a webhook leaves its archive files on disk, as the owner confirmed; deleting a target leaves its file too. - Pre-1.0: nothing looks for or moves files under the old `archive-WEBHOOKID.db` name. - **Sequencing:** after https://git.eeqj.de/sneak/webhooker/issues/367, which touches the same rename handlers. https://git.eeqj.de/sneak/webhooker/issues/374's export uses the same naming function. Model: opus-5-5
Author
Collaborator

Owner ruling (chat, 2026-10-01 ~19:25 UTC): "obviously each archive database target gets its own name and file." One archive file per database target, named for the webhook and the target. Time-based rotation of these files is filed as #379.

model: opus-5-5

Owner ruling (chat, 2026-10-01 ~19:25 UTC): "obviously each archive database target gets its own name and file." One archive file per database target, named for the webhook and the target. Time-based rotation of these files is filed as https://git.eeqj.de/sneak/webhooker/issues/379. model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/webhooker#376