Skip to content

ci: static check for Adapty fallback paywalls format version#1058

Merged
kar merged 1 commit into
mainfrom
check-adapty-fallback-version
May 20, 2026
Merged

ci: static check for Adapty fallback paywalls format version#1058
kar merged 1 commit into
mainfrom
check-adapty-fallback-version

Conversation

@kar
Copy link
Copy Markdown
Contributor

@kar kar commented May 20, 2026

Summary

  • Tiny Node script (scripts/check-adapty-fallback-version.mjs) that reads each of the three bundled Adapty fallback JSONs (common/assets/fallbacks/{ios,android}.json + android/app/src/main/assets/fallbacks/android.json) and asserts meta.version >= MIN_VERSION (currently 9).
  • GitHub Actions workflow (.github/workflows/check-adapty-fallback.yml) that runs the script on Ubuntu in ~5s on PRs that touch the fallback files, the Adapty deps, or the script itself.

Why

Adapty SDK 3.15.7 was rejecting the bundled JSONs (meta.version: 8) at every cold start with error 2006"Decoding Fallback Paywalls failed... The fallback paywalls version is not correct." The Dart catch at common/lib/src/features/payment/domain/adapty.dart:39 swallows that error with a debug-level "ignore" log, so the bundled JSON went silently stale for months. When the live getPaywall() call also failed, the user ended up at StageModal.paymentTempUnavailable.

This catches it before merge with a deterministic signal — the format version is encoded in the file itself.

Why this approach (and not the Appium smoke from #1056)

#1056 attempted runtime detection from the Appium smoke test. Three runtime approaches were tried; all of them hit blockers that needed either developer provisioning, runner-dependent device behavior, or a new entitlement we don't want. See the close comment on #1056 for the full trail.

The static check has one limitation worth flagging: it only catches version-encoded staleness. If Adapty ever changed the format without bumping meta.version, we'd miss it. In practice that field is literally the format version, so this is fine.

When Adapty's format bumps with a future SDK upgrade, the same PR that refreshes the JSONs bumps MIN_VERSION in the script.

Verified locally

Test plan

  • CI runs the workflow on this PR and turns red (because main still has v8 JSONs).
  • After merging adapty: refresh bundled fallback paywalls to current SDK format #1057 (the refresh), this check turns green.
  • On a future SDK upgrade that bumps the format past 9, a PR that refreshes the JSONs and bumps MIN_VERSION together passes; one that only does one of those fails.

🤖 Generated with Claude Code

Bundled Adapty fallback JSONs encode their format version at meta.version.
When the SDK is upgraded past the format the bundled JSONs were exported
for, the SDK rejects them on every cold start with error 2006 ("Decoding
Fallback Paywalls failed... The fallback paywalls version is not correct"),
which is silently swallowed by the Dart catch in
common/lib/src/features/payment/domain/adapty.dart and ultimately surfaces
to users as StageModal.paymentTempUnavailable when the live getPaywall()
call also fails.

Adds a tiny Node script + GitHub Actions workflow that asserts every
bundled fallback JSON has meta.version >= MIN_VERSION (currently 9, which
matches SDK 3.15.x). When Adapty bumps the format alongside an SDK
upgrade, bump MIN_VERSION in the same PR that refreshes the JSONs.

Runs on Ubuntu in ~5s on PRs that touch the fallback files or the SDK
deps, no device, no Appium, no entitlements. Supersedes #1056 — see that
PR for the (failed) attempts at runtime detection that drove the pivot.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 20, 2026 10:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a lightweight CI guard to prevent Adapty fallback paywalls JSON bundles from silently drifting behind the minimum meta.version required by the shipped Adapty SDK.

Changes:

  • Introduces scripts/check-adapty-fallback-version.mjs to validate meta.version >= MIN_VERSION across the three bundled fallback JSON files.
  • Adds a GitHub Actions workflow to run the check on PRs that touch fallback bundles, selected dependency lockfiles, or the check script itself.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
scripts/check-adapty-fallback-version.mjs Node script that parses bundled fallback paywalls JSON files and enforces a minimum meta.version.
.github/workflows/check-adapty-fallback.yml CI workflow that runs the script on PRs/main pushes (with path filtering on PRs).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +5 to +12
paths:
- "common/assets/fallbacks/**"
- "android/app/src/main/assets/fallbacks/**"
- "common/pubspec.yaml"
- "common/pubspec.lock"
- "ios/Podfile.lock"
- "scripts/check-adapty-fallback-version.mjs"
- ".github/workflows/check-adapty-fallback.yml"
@kar
Copy link
Copy Markdown
Contributor Author

kar commented May 20, 2026

Red on this new Adapty fallback version check is expected here, another PR will fix it (actual paywall fallback update). Check should be green then.

@kar kar merged commit f6e6808 into main May 20, 2026
5 of 6 checks passed
@kar kar deleted the check-adapty-fallback-version branch May 20, 2026 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants