test(paywalls): regression tests for workflow exit offer surviving non-content reconfigures#6919
Closed
vegaro wants to merge 6 commits into
Closed
test(paywalls): regression tests for workflow exit offer surviving non-content reconfigures#6919vegaro wants to merge 6 commits into
vegaro wants to merge 6 commits into
Conversation
Feed the embedded SwiftUI paywall's step-aware workflow exit offer into the UIKit controller's exitOfferOffering (via the exit-offer environment binding plus the preference key), so swipe-to-dismiss and the close button surface it through the existing exit-offer machinery. Exit-offer children bridge too, so a workflow can open another workflow as its exit offer and chain further. Clear the offer when the host is rebuilt under workflows so update(with:) can't surface a stale exit offer during the reload window. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds a "UIKit View Controller" entry to the Live Paywalls context menu that modally presents the offering through PaywallViewController, so its UIKit dismissal handling and the workflow exit-offer bridge can be exercised (the SwiftUI PaywallView path does not go through that controller). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
configuration.didSet cleared exitOfferOffering directly, bypassing updateWorkflowExitOffer's "don't clear while an exit offer is presenting" guard. Route through it so a hybrid update(with:) during an in-flight exit-offer dismiss can't drop the offer. Behavior is unchanged for the normal reload case (not presenting) and remains a no-op under the legacy path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…n-content reconfigures Adds three tests that document expected behavior: - update(with displayCloseButton:) must not clear exitOfferOffering - updateFont(with:) must not clear exitOfferOffering - update(with offering:) should clear exitOfferOffering (legitimate rebuild) Also exposes workflowsEndpointEnabled as an overridable var and adds @_spi(Internal) test hooks (exitOfferOfferingForTesting, simulateWorkflowExitOfferUpdate) so tests don't need a scheme launch argument and can inspect private state. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
❌ Failures
The following Swift files were added but are missing from To fix: open |
Generated by 🚫 Danger |
…lass init issues Convenience inits on PaywallViewController aren't inherited by subclasses because the class defines its own designated init(content:fonts:...). Replacing the overridable computed var with a stored internal var lets tests set it directly on an instance, removing the need for a subclass entirely. Also drops the @_spi(Internal) annotation from the test hooks — @testable import is sufficient since they only need to be internal. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
b359c54 to
67162d5
Compare
Member
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.
Summary
PaywallViewControllerExitOfferTestscovering the exit-offer-vs-reconfigure interaction identified in code review of #facu/workflow-exit-offer-uikit-bridge@_spi(Internal)test hooks onPaywallViewControllerso tests can seed and inspect private exit offer state without a scheme launch argumentworkflowsEndpointEnabledas an overridablevarso test subclasses can control the flagContext
Code review of the UIKit workflow exit offer bridge (facu/workflow-exit-offer-uikit-bridge) flagged a Critical issue:
configuration.didSetfires on all property mutations — including non-content ones likeupdate(with displayCloseButton:)andupdateFont(with:)— which now callsupdateWorkflowExitOffer(nil)and rebuilds the hosting controller, creating a race window where the exit offer is cleared mid-session.These tests document the expected behavior before the fix lands:
testUpdateDisplayCloseButtonDoesNotClearWorkflowExitOffertestUpdateFontDoesNotClearWorkflowExitOffertestUpdateOfferingClearsWorkflowExitOfferOnce the
didSetguard (guard configuration.content != oldValue.content else { return }) is applied in the parent branch, the first two tests will go green.Test plan
displayCloseButton,updateFont) fail on this branch as-isdidSetfix is applied infacu/workflow-exit-offer-uikit-bridge🤖 Generated with Claude Code