Removes stale paywall template screenshots if necessary#6984
Merged
JayShortway merged 2 commits intoJun 16, 2026
Conversation
The screenshot upload lane was add-only, so when a paywall is removed, renamed, or its directory name changes, old ios.png / mac-*.png files lingered forever in paywall-rendering-validation. Have process_paywall_screenshots return the offering IDs it produced per platform, then delete any of this lane's platform files (ios.png and the mac-*.png variants) whose directory is no longer produced, and remove directories that become empty. Only files produced by this lane are pruned, so screenshots owned by other platforms (e.g. android.png) are never affected. A per-platform guard skips pruning if a platform produced nothing, to avoid wiping screenshots on a failed render. Co-authored-by: joop <joop@revenuecat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
We would only ever add new paywall screenshots to paywall-rendering-validation, never remove ones that we deleted from paywall-preview-resources. This PR implements just that.
Android equivalent: RevenueCat/purchases-android#3595
Note
Medium Risk
The lane deletes files in the target validation repo; safeguards (per-platform scope, skip on empty output) limit blast radius but a bad CI run could still remove expected screenshots if offerings fail to render yet the run is non-empty.
Overview
Keeps paywall-rendering-validation in sync when templates disappear from paywall-preview-resources by pruning stale assets during
record_and_push_paywall_template_screenshots, not only copying new screenshots.process_paywall_screenshotsnow returns the offering IDs produced for each platform; the lane aggregates them and runs newremove_stale_template_screenshotsbefore commit/PR. Cleanup deletesscreenshots/templates/<offering>/<platform>.pngwhen that offering was not rendered for that platform in the current run, then removes empty offering directories. Only Apple lane filenames (ios.png,mac-*.png) are touched—android.pngand other platforms are never deleted. If a platform run produces no screenshots, stale cleanup for that platform is skipped to avoid mass deletion on a failed/partial run.Reviewed by Cursor Bugbot for commit 0ba2b2d. Bugbot is set up for automated code reviews on this repo. Configure here.