Report Retention Ledger — Browser Storage Webhooks Before Thumbnails and Virus Scans
Short answer: let the browser upload a generated report into a private quarantine bucket, but let an authenticated storage event create the durable processing record; bind the original, its thumbnail, its scan result, and its deletion deadline to one report ID, then reconcile storage against that ledger. The decisive issue is retention, not upload speed. A browser success screen proves only that…
A report retention ledger architecture is proposed for browser storage webhooks before thumbnails and virus scans in a B2B SaaS report service. The key principles are:
1. Create the report record before issuing upload authority
2. Bind the original, thumbnail, scan result and deletion deadline to one report ID
3. Reconcile storage against that ledger
4. The database record is the authority for lifecycle state
5. Private object storage holds bytes addressed by opaque keys
The proposed critical path is:
Browser -> Storage upload -> Authenticated completion notification -> Idempotent work creation -> Scan -> Derivation -> Controlled publication -> Deletion reconciliation
The storage notification proves bytes landed, but not permission to serve them. Verification of the object identity against the report record is required before serving.
Important invariants include:
- A storage object belongs to exactly one tenant and report ID
- A notification can create processing work at most once
- No original or derivative is customer-readable before scan passes
- Derivatives carry lineage to original and inherit deletion deadline
- Legal holds block physical deletion without changing deadline
- Every state transition records audit trail
Exactly-once delivery is not required, instead the useful property is exactly-once effect: accept repeated input, lock or claim a stable idempotency key, and make the state transition once.
Processing time answers when scan and thumbnail should run, while retention time answers when report can be deleted. A retry may move the processing time but must not extend retention time.
The deletion worker marks report as deletion-pending, enumerates ledger-known objects, deletes them, verifies absence, and records completion. A separate reconciler detects drift between ledger and objects.
Three signals each serve different purposes - browser callback for interface progress, storage webhook for prompt processing, and reconciliation for eventual repair. None should be overloaded.
Deletion authority should be treated separately from delivery mechanism. Rules cannot express every report-level state or audit reason, but serve as a backstop. One deadline governs original, scan artifact and derivatives, requiring deletion workers and reconciliation.
This architecture aims to provide a clear boundary between browser storage and durable processing, while ensuring proper retention and cleanup of report artifacts.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to