Repository navigation
fix(sites): delete screenshot rows with their deployment - #14764
Conversation
Deleting a deployment removes the screenshot objects but keeps their file rows, and a deployment deleted while its capture runs still gets both files and rows written afterwards.
Security rulesNo new WARNING or ERROR findings from security rules. 6 existing findings tracked in
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
The Deletes worker removed the screenshot objects but kept their file rows in the platform screenshots bucket, so every deleted deployment or site left two unreachable rows behind. A deployment deleted while its capture ran was worse: the worker still wrote both objects and rows, then found no deployment to attach them to. It now re-checks the deployment before writing, and removes anything it already wrote whenever the capture fails before the deployment takes ownership of the screenshots.
|
Review complete. 🟡 1 medium 💬 Inline comments (1)
🧹 Nitpicks (1) — 🟢 1 low
This PR wires screenshot artifacts into the deployment deletion lifecycle: when a deployment (or function) is deleted, the Deletes worker now removes the stored screenshot files from storage and deletes their corresponding rows from the screenshots bucket collection, then proceeds with the usual deployment cleanup. A new e2e test in the Sites console suite confirms that after a deployment delete, the screenshot files are no longer listed in storage while the DB row is removed.
Reviewed commit: d6b0112 |
🟢 Tier S · Ready to merge
The pull request cleans up screenshot storage objects and platform file rows when site deployments are deleted, and removes captures that fail because their deployment disappears. Deployment deletion reads the row under the same lock as screenshot updates so the queued cleanup includes the latest screenshot IDs. E2E tests cover cleanup after deletion and deletion during capture. Latest changes: The new commit retains the last locked deployment snapshot across a transaction failure, then rereads and retries deletion under the row lock when the delete did not commit.
📂 Walkthrough · 4
Reviewed the commits since |
There was a problem hiding this comment.
Adds deployment screenshot cleanup to the Deletes worker plus an e2e test verifying screenshot persistence after deployment deletion.
Key findings
- 🟡 Delete screenshot row even when file removal failed — Deletes.php:1612
Deleting a deployment read it, then deleted it. A capture finishing in between wrote its screenshot IDs to a row the Deletes worker never saw, so the worker's files were orphaned after it handed them over. The read now happens under the row lock the screenshots worker's update takes: either the IDs are in the snapshot, or the update finds no row and the worker removes its own files. A deleted site's Deletes worker can likewise read a deployment before the capture updates it, so the worker keeps ownership of its files when the site update finds no site. A screenshot row is now kept while its object still exists, so a failed unlink leaves the object findable instead of untracked.
…ction The TransactionException fallback deleted the deployment but enqueued the copy read before the transaction, which can miss screenshot IDs a capture wrote in between. It now keeps the last locked read when the delete had committed, and otherwise locks, re-reads and deletes, enqueuing that copy.
fix(sites): delete screenshot rows with their deployment (cherry picked from commit 5b95b1f)
Site deployment screenshots leave platform file rows behind.
bucket_<screenshots>keptforUpdate) the worker's update takesTests (
SitesConsoleClientTest,screenshotsgroup):testDeleteDeploymentScreenshots: screenshot rows 404 after the deployment is deletedtestDeleteDeploymentDuringScreenshotCapture: no screenshot rows remain when the deployment is deleted mid-capture