Skip to content

Removes stale paywall template screenshots if necessary#6984

Merged
JayShortway merged 2 commits into
mainfrom
cursor/remove-stale-paywall-template-screenshots-7727
Jun 16, 2026
Merged

Removes stale paywall template screenshots if necessary#6984
JayShortway merged 2 commits into
mainfrom
cursor/remove-stale-paywall-template-screenshots-7727

Conversation

@JayShortway

@JayShortway JayShortway commented Jun 12, 2026

Copy link
Copy Markdown
Member

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

Open in Web Open in Cursor 

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_screenshots now returns the offering IDs produced for each platform; the lane aggregates them and runs new remove_stale_template_screenshots before commit/PR. Cleanup deletes screenshots/templates/<offering>/<platform>.png when 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.png and 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.

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>
@JayShortway JayShortway requested review from a team June 16, 2026 10:37
@JayShortway JayShortway marked this pull request as ready for review June 16, 2026 10:37
@JayShortway JayShortway requested a review from a team as a code owner June 16, 2026 10:37

@tonidero tonidero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense!

@JayShortway JayShortway changed the title Remove stale Apple paywall template screenshots on upload Removes stale paywall template screenshots if necessary Jun 16, 2026
@JayShortway JayShortway merged commit 87af2f8 into main Jun 16, 2026
18 of 20 checks passed
@JayShortway JayShortway deleted the cursor/remove-stale-paywall-template-screenshots-7727 branch June 16, 2026 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants