Skip to content

Add single_step_fallback_id field to PublishedWorkflow#3436

Merged
vegaro merged 4 commits into
mainfrom
cesar/2026-05-05-workflow-single-step-fallback-id
May 5, 2026
Merged

Add single_step_fallback_id field to PublishedWorkflow#3436
vegaro merged 4 commits into
mainfrom
cesar/2026-05-05-workflow-single-step-fallback-id

Conversation

@vegaro

@vegaro vegaro commented May 5, 2026

Copy link
Copy Markdown
Member

Adds the optional singleStepFallbackId field to PublishedWorkflow so the backend can identify which step holds the canonical package list for multi-step workflows where earlier steps have no package components.


Note

Low Risk
Low risk: adds an optional serialized field to PublishedWorkflow and validates parsing behavior with unit tests, with no changes to workflow resolution logic.

Overview
Adds an optional single_step_fallback_id (exposed as singleStepFallbackId) to the PublishedWorkflow JSON model so backend-provided workflows can indicate a canonical step for single-step fallback behavior.

Extends WorkflowDetailResolverTest coverage to assert the field is parsed when present and defaults to null when absent.

Reviewed by Cursor Bugbot for commit 1aaf371. Bugbot is set up for automated code reviews on this repo. Configure here.

vegaro and others added 3 commits May 5, 2026 16:47
Adds the optional `singleStepFallbackId` field to `PublishedWorkflow`
so the backend can identify which step holds the canonical package list
for multi-step workflows where earlier steps have no package components.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Covers the two resilience cases: field present is parsed correctly,
field absent (e.g. removed from backend) defaults to null without error.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Covers field present (parsed correctly) and field absent (defaults to
null without error, i.e. backend can safely remove it).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vegaro vegaro requested a review from a team as a code owner May 5, 2026 15:06
@vegaro vegaro requested a review from facumenzella May 5, 2026 15:06
@vegaro vegaro added the pr:other label May 5, 2026

@facumenzella facumenzella left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

easy

@codecov

codecov Bot commented May 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.47%. Comparing base (aa0f786) to head (1aaf371).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3436   +/-   ##
=======================================
  Coverage   79.47%   79.47%           
=======================================
  Files         362      362           
  Lines       14547    14547           
  Branches     1977     1977           
=======================================
  Hits        11561    11561           
  Misses       2190     2190           
  Partials      796      796           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vegaro vegaro added this pull request to the merge queue May 5, 2026
Merged via the queue into main with commit 4ddfe59 May 5, 2026
37 checks passed
@vegaro vegaro deleted the cesar/2026-05-05-workflow-single-step-fallback-id branch May 5, 2026 15:50
matteinn pushed a commit to matteinn/purchases-android that referenced this pull request Jun 5, 2026
**This is an automatic release.**

## RevenueCat SDK
### ✨ New Features
* Add optional support for setting obfuscated account id to product
changes (RevenueCat#3428) via Mark Villacampa (@MarkVillacampa)

## RevenueCatUI SDK
### Paywallv2
#### ✨ New Features
* Add slide transition to workflow paywalls (RevenueCat#3418) via Cesar de la Vega
(@vegaro)
* Workflow state & ViewModel infrastructure (RevenueCat#3416) via Cesar de la Vega
(@vegaro)
#### 🐞 Bugfixes
* Fix paywall layout direction for RTL locale overrides (PWENG-39)
(RevenueCat#3425) via Monika Mateska (@MonikaMateska)
* Apply ripple shape clip on a sibling Box to avoid clipping content
(RevenueCat#3395) via Toni Rico (@tonidero)

### 🔄 Other Changes
* build(deps): bump fastlane-plugin-revenuecat_internal from `21e02ec`
to `af7bb5c` (RevenueCat#3442) via dependabot[bot] (@dependabot[bot])
* Abstract workflow page transition animation behind sealed class
(RevenueCat#3430) via Cesar de la Vega (@vegaro)
* Add `single_step_fallback_id` field to `PublishedWorkflow` (RevenueCat#3436) via
Cesar de la Vega (@vegaro)
* build(deps): bump fastlane-plugin-revenuecat_internal from `2d11430`
to `21e02ec` (RevenueCat#3429) via dependabot[bot] (@dependabot[bot])
* Generalize `PaywallComponentsScaffold` for workflow reuse (RevenueCat#3417) via
Cesar de la Vega (@vegaro)
* perf: pre-warm workflow paywall step states off-thread (RevenueCat#3420) via
Cesar de la Vega (@vegaro)
* Update baseline profiles (RevenueCat#3427) via RevenueCat Git Bot (@RCGitBot)
* build(deps): bump fastlane-plugin-revenuecat_internal from `d24ab26`
to `2d11430` (RevenueCat#3426) via dependabot[bot] (@dependabot[bot])
* Replace unauthenticated SDKMAN install with SHA-pinned orb command
(RevenueCat#3407) via Rick (@rickvdl)
* Auto load paywall in paywall tester via local.properties (RevenueCat#3405) via
Cesar de la Vega (@vegaro)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk: this is a version/release cut that mainly updates version
strings, changelogs, and doc deployment targets with no functional logic
changes beyond version identifiers.
> 
> **Overview**
> Cuts the `10.4.0` release by removing `-SNAPSHOT` across the project
(core `VERSION_NAME`, `Config.frameworkVersion`, sample/test app
dependency versions, and the root `.version` file).
> 
> Updates release collateral and publishing to point at `10.4.0`,
including changelogs (`CHANGELOG.md`/`CHANGELOG.latest.md`), docs
redirect (`docs/index.html`), and the CircleCI `docs-deploy` S3 sync
path (from `10.4.0-SNAPSHOT` to `10.4.0`).
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
f7b3604. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
matteinn pushed a commit to matteinn/purchases-android that referenced this pull request Jun 5, 2026
## Motivation

In a multipage workflow paywall, `PackageComponent`s only live on the
terminal step. Early "info" screens have no package components, so
`selectedPackageInfo` is `null` on them. Price/period template variables
like `{{ price }}` and `{{ price_per_year }}` can't resolve on those
screens.

## Description

Adds a default-package fallback. The terminal step is identified by
`singleStepFallbackId` on the workflow (added in RevenueCat#3436). When any step
state is built, the terminal step's `selectedPackageInfo` is applied as
the default. Steps with their own `PackageComponent`s ignore the
default; steps without one resolve variables against it.

The default is set once per step and never overwritten, so back
navigation always shows the same content as the initial render, even if
the user changed the selection on the terminal step.

Changes:

- `PaywallState.Loaded.Components`: add `defaultPackageInfo` and
`setDefaultPackage(info)`. `setDefaultPackage` is idempotent (set once,
never overwritten). `selectedPackageInfo` is now `ownSelection ?:
defaultPackageInfo`.
- `PaywallViewModel`: in `updateStateFromWorkflow`, pre-compute the
`singleStepFallbackId` step first so its default is in cache before any
other step loads. On every step build, apply the fallback step's
`selectedPackageInfo` (idempotency means it only takes effect on the
first visit). Log a warning if `singleStepFallbackId` points to a
missing step.
- Tests: default-package application on packageless steps,
back-navigation preserving the initial default, own selection winning
over the default, graceful handling when `singleStepFallbackId` is
missing. Plus extra `WorkflowNavigator` cases (deep backstack,
non-linear navigation).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Touches workflow state construction/caching and selection precedence,
which can subtly affect navigation/backstack behavior and displayed
pricing context across steps.
> 
> **Overview**
> Adds a **default-package fallback** to multi-step workflow paywalls:
`PaywallState.Loaded.Components` now stores an idempotent
`defaultPackageInfo`, and `selectedPackageInfo` resolves as *own
selection* falling back to that default.
> 
> `PaywallViewModel` now precomputes the `singleStepFallbackId` step to
seed the cache, applies the fallback step’s `selectedPackageInfo` as a
default on every step build/prewarm (without overwriting on revisits),
and logs when the fallback step ID is missing.
> 
> Expands tests to cover context propagation on packageless steps,
back-navigation stability, selection precedence, missing-fallback
safety, plus additional `WorkflowNavigator` backstack/loop scenarios.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
a9a862d. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

2 participants