Skip to content

Macos smoke test update - #8960

Closed
jigar-f wants to merge 7 commits into
mainfrom
jigar/smoke-test-update
Closed

Macos smoke test update#8960
jigar-f wants to merge 7 commits into
mainfrom
jigar/smoke-test-update

Conversation

@jigar-f

@jigar-f jigar-f commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces significant improvements to the macOS and Windows payment smoke test infrastructure and refactors the payment Stripe Checkout integration test for better reliability and maintainability. The changes enhance test safety, diagnostics, and code structure, especially for CI environments. The most important changes are grouped below:

macOS Payment Smoke Test Hardening & Diagnostics:

  • The macos_payment_checkout_smoke.sh script now refuses to run outside CI to prevent accidental data loss, adds a marker file to select the staging environment, and removes an unused Dart define.
  • The macos_smoke_suite.sh script adds extra diagnostic commands (csrutil status, systemextensionsctl developer) and introduces a function to enable system extension developer mode, improving reliability for Flutter connect smoke tests. [1] [2] [3]

Windows Payment Smoke Diagnostics:

  • The Windows workflow uploads Lantern logs as artifacts after payment checkout smoke tests, aiding in post-mortem analysis.

Stripe Checkout Integration Test Refactor:

  • The desktop_stripe_checkout_smoke_test.dart test is refactored to use new AppRobot and PaymentRobot helpers, removing direct provider manipulation and observer classes in favor of a stateful event tracker (_StripeCheckoutTracker). This improves clarity and robustness of test flow and error handling. [1] [2] [3] [4]

Test Utility Enhancements:

  • The new AppRobot class (in app_robot.dart) gains screenshot capture for diagnostics, a method to dismiss the macOS system extension screen, and improved tap helpers. These utilities streamline test writing and debugging across platforms. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Test Flow and Error Handling Improvements:

  • The Stripe Checkout test now uses a state-based wait for completion, clearer error messages, and more robust screenshot handling, making failures easier to diagnose and reducing flakiness. [1] [2]

These changes collectively make the payment smoke tests safer, more maintainable, and easier to debug in CI environments.

Summary by CodeRabbit

  • Improvements

    • Improved macOS app startup and environment selection.
    • Enhanced VPN setup handling, including automatic dismissal of extension prompts and clearer diagnostics.
    • Extended macOS readiness checks and troubleshooting information.
  • Bug Fixes

    • Improved payment checkout monitoring and WebView failure handling.
    • Added more reliable plan selection, checkout navigation, and unique checkout test data.
  • Testing

    • Strengthened desktop payment and VPN smoke tests with screenshots and error tracking.
    • Windows payment test logs are now uploaded automatically.

Copilot AI lite review requested due to automatic review settings August 10, 2026 13:40
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 27453136-e175-41e0-82d9-35182437a117

📥 Commits

Reviewing files that changed from the base of the PR and between 5ff8bb2 and 7231e04.

📒 Files selected for processing (2)
  • .github/scripts/macos_smoke_suite.sh
  • integration_test/payment/desktop_stripe_checkout_smoke_test.dart
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/scripts/macos_smoke_suite.sh
  • integration_test/payment/desktop_stripe_checkout_smoke_test.dart

📝 Walkthrough

Walkthrough

Changes

The PR replaces observer-based payment WebView tracking with Riverpod events and robot-driven checkout actions. It updates VPN smoke tests with macOS extension handling, screenshots, activation polling, and diagnostics. It also moves Radiance initialization to app launch and selects staging with .radiance_env.

Payment checkout flow

Layer / File(s) Summary
WebView event reporting and API migration
lib/core/widgets/app_webview.dart, lib/core/router/router.gr.dart, lib/core/utils/url_utils.dart, lib/features/auth/choose_payment_method.dart
AppWebView publishes loaded and failed page events through Riverpod. Observer parameters and checkout observer routing data are removed.
Robot-based payment smoke test
integration_test/utils/payment_robot.dart, integration_test/payment/desktop_stripe_checkout_smoke_test.dart, .github/workflows/build-windows.yml
PaymentRobot drives plan selection and Stripe checkout. The smoke test tracks WebView events, validates Stripe content, captures screenshots, and uploads payment logs.

VPN smoke-test readiness

Layer / File(s) Summary
Desktop robot and overlay handling
integration_test/utils/app_robot.dart, integration_test/vpn/vpn_smoke_helpers.dart
AppRobot handles desktop screenshots and macOS extension screens. VPN readiness dismisses the overlay before checking controls.
Robot-based VPN lifecycle
integration_test/vpn/connect_smoke_harness.dart
The harness uses AppRobot and VpnRobot for setup, connection, screenshots, error monitoring, and cleanup.
System-extension activation readiness
integration_test/vpn/macos_connect_smoke_test.dart
Readiness polling allows 120 seconds and requests installation once for pending or missing extensions.
Developer-mode diagnostics
.github/scripts/macos_smoke_suite.sh
The smoke suite records SIP and developer-mode status and attempts developer-mode activation before preflight.

Radiance environment and startup

Layer / File(s) Summary
Radiance environment selection
.github/scripts/macos_payment_checkout_smoke.sh, macos/Shared/FilePath.swift
The payment smoke script creates a staging marker after a CI-only safety check. FilePath maps the marker to stage or prod.
Application-launch initialization
macos/Runner/AppDelegate.swift, macos/Runner/Handlers/MethodHandler.swift, lib/lantern/lantern_platform_service.dart
Radiance setup runs from AppDelegate during launch. The previous Flutter method-channel initialization path is removed.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SmokeTest
  participant PaymentRobot
  participant ChoosePaymentMethod
  participant AppWebView
  participant WebViewPageEventProvider
  SmokeTest->>PaymentRobot: load and select plan
  PaymentRobot->>ChoosePaymentMethod: open payment methods
  PaymentRobot->>ChoosePaymentMethod: start Stripe checkout
  ChoosePaymentMethod->>AppWebView: open checkout URL
  AppWebView->>WebViewPageEventProvider: report page event
  WebViewPageEventProvider-->>SmokeTest: provide loaded or failed event
Loading

Possibly related PRs

Suggested reviewers: atavism

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately identifies the macOS smoke test changes, but it does not mention the broader payment infrastructure and Stripe checkout refactor.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jigar/smoke-test-update

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI 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.

Pull request overview

Updates macOS smoke-test infrastructure and app startup wiring to make desktop smokes more reliable, including moving Radiance setup earlier into the native macOS lifecycle and adding better in-test observability of native WebView navigation.

Changes:

  • Move macOS Radiance setup from a Flutter method-channel call into AppDelegate and select stage/prod via a filesystem marker.
  • Replace per-WebView observer callbacks with a Riverpod provider that emits page-load events for smoke tests.
  • Refactor desktop smoke tests toward “robot” helpers, improve macOS system-extension handling, and upload additional CI diagnostics/artifacts.

Reviewed changes

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

Show a summary per file
File Description
macos/Shared/FilePath.swift Add .radiance_env marker-based selection of Radiance environment (stage/prod).
macos/Runner/Handlers/MethodHandler.swift Remove setupRadiance method-channel entrypoint and related state.
macos/Runner/AppDelegate.swift Initialize Radiance during macOS app launch (native side).
lib/lantern/lantern_platform_service.dart Stop invoking setupRadiance over the method channel on macOS.
lib/features/auth/choose_payment_method.dart Remove WebView observer plumbing from payment flow UI.
lib/core/widgets/app_webview.dart Introduce webViewPageEventProvider and emit load success/failure events.
lib/core/utils/url_utils.dart Remove observer parameter from openWebview routing.
lib/core/router/router.gr.dart Remove observer arguments from generated routes/args.
integration_test/vpn/vpn_smoke_helpers.dart Dismiss macOS system-extension screen overlay while waiting for VPN controls.
integration_test/vpn/macos_connect_smoke_test.dart Increase timeout and proactively request system-extension activation in CI.
integration_test/vpn/connect_smoke_harness.dart Align desktop harness with robot-based structure and add screenshots/diagnostics.
integration_test/utils/payment_robot.dart New robot to drive plan selection and payment-method UI for smokes.
integration_test/utils/app_robot.dart Add desktop support, screenshots, and macOS extension-screen dismissal.
integration_test/payment/desktop_stripe_checkout_smoke_test.dart Switch to robots and provider-based WebView event tracking for Stripe checkout.
.github/workflows/build-windows.yml Upload Windows payment smoke diagnostics as an artifact.
.github/scripts/macos_smoke_suite.sh Capture extra system-extension diagnostics; attempt enabling dev mode before connect smoke.
.github/scripts/macos_payment_checkout_smoke.sh CI guard + .radiance_env marker; simplify Dart defines for payment smoke.
Suppressed comments (1)

macos/Runner/AppDelegate.swift:113

  • setupRadiance() runs synchronously on the main thread during applicationDidFinishLaunching. MobileSetupRadiance can take seconds (as logged) and will block app startup and window responsiveness. Consider running the setup inside a Task (as iOS does) to avoid blocking the launch path.
  /// Calls API handler setup
  private func setupRadiance() {
    let startupTime = Date()
    let opts = UtilsOpts()
    opts.dataDir = FilePath.dataDirectory.relativePath

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread macos/Runner/AppDelegate.swift

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 7

🧹 Nitpick comments (9)
lib/core/widgets/app_webview.dart (2)

29-40: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low value

Document the lifetime constraint on captureScreenshot more strongly, or capture eagerly.

captureScreenshot closes over the InAppWebViewController. The closure stays reachable through the provider state after the page navigates away or the WebView disposes. A late call then either returns null or throws a platform error. The comment states the constraint, but the event outlives the page.

Consumers must call it inside the listener callback. The current smoke test does this. If you want to remove the hazard, capture the bytes in _reportPageLoaded and store Uint8List? in the event instead of a closure. That costs a screenshot on every main-frame load, so keep the closure if that cost matters.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/core/widgets/app_webview.dart` around lines 29 - 40, Strengthen the
lifetime documentation for WebViewPageLoaded.captureScreenshot to explicitly
require consumers to invoke it only within the listener callback while the
page’s WebView remains active. Keep the closure-based API and do not add eager
screenshot capture.

15-52: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

One global event outlives the WebView that produced it. webViewPageEventProvider stores a single event with no instance scope and no reset, so both the event value and the controller closure it carries stay reachable after the page and the WebView are gone.

  • lib/core/widgets/app_webview.dart#L15-L52: add a clear() method to WebViewPageEvents and call it when _InnerWebViewState starts a load and when it disposes, so a later session cannot read the previous page's event.
  • lib/core/widgets/app_webview.dart#L29-L40: either require consumers to call captureScreenshot inside the listener callback, or store the captured Uint8List? in WebViewPageLoaded instead of a closure over the InAppWebViewController.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/core/widgets/app_webview.dart` around lines 15 - 52, Update
lib/core/widgets/app_webview.dart lines 15-52 by adding clear() to
WebViewPageEvents and invoking it from _InnerWebViewState when a load starts and
during disposal, preventing stale events from later sessions. Also update
WebViewPageLoaded at lib/core/widgets/app_webview.dart lines 29-40 to store
captured Uint8List? data rather than a controller-capturing closure, or enforce
that captureScreenshot is invoked only within the listener callback.
integration_test/payment/desktop_stripe_checkout_smoke_test.dart (2)

100-110: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

_waitForCheckout reports a misleading message on a clean timeout.

If no event ever arrives, lastFailure is null and the test fails with "Stripe Checkout did not load a non-empty document". That text suggests an empty document, not a timeout. State the timeout explicitly.

♻️ Proposed message
-  fail(checkout.failureMessage);
+  fail('Stripe Checkout did not finish within 3 minutes. '
+      '${checkout.failureMessage}');
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@integration_test/payment/desktop_stripe_checkout_smoke_test.dart` around
lines 100 - 110, Update _waitForCheckout so a deadline reached without
checkout.finished reports an explicit timeout message instead of using
checkout.failureMessage when no failure was recorded. Preserve the existing
failure message for checkout failures that do provide one.

54-61: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Serialize checkout.add calls; the fire-and-forget listener can interleave.

add is asynchronous and awaits _waitForRenderedScreenshot. unawaited starts a new call for every event, so calls overlap. Two effects follow:

  1. Two WebViewPageLoaded events for the Stripe host both pass the screenshot == null check before the await, so the screenshot capture runs twice.
  2. uri and documentLength are assigned after the await. A main-frame failure that arrives during an in-flight capture sets _terminalFailure, and the in-flight handler then sets uri to the Stripe host. _waitForCheckout returns, and Line 71 fails the test even though the page loaded.

Chain the futures so events apply in arrival order.

♻️ Proposed serialization
       final checkout = _StripeCheckoutTracker();
       final pageEventSubscription = payment.container.listen(
         webViewPageEventProvider,
         (_, event) {
-          if (event != null) unawaited(checkout.add(event));
+          if (event != null) checkout.enqueue(event);
         },
       );

In _StripeCheckoutTracker:

Future<void> _pending = Future<void>.value();

/// Applies events in arrival order; captures never overlap.
void enqueue(WebViewPageEvent event) {
  _pending = _pending.then((_) => add(event));
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@integration_test/payment/desktop_stripe_checkout_smoke_test.dart` around
lines 54 - 61, Serialize WebViewPageEvent processing in the payment listener by
routing events through an ordered queue on _StripeCheckoutTracker, such as an
enqueue method backed by a chained Future, instead of calling add with unawaited
directly. Ensure each event waits for the previous add operation to finish,
while preserving teardown and arrival order.
integration_test/utils/payment_robot.dart (3)

57-61: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

orElse throws a confusing error when plans.plans is empty.

If plans.plans is empty, plans.plans.first inside orElse throws Bad state: No element. The message does not name the robot step. The smoke test asserts non-empty plans before calling this method, so the path is currently unreachable. Add an explicit failure so future callers get a clear reason.

🛡️ Proposed guard
   Plan selectBestValuePlan(PlansData plans) {
+    if (plans.plans.isEmpty) {
+      fail('Cannot select a plan: the backend returned no plans');
+    }
     final plan = plans.plans.firstWhere(
       (plan) => plan.bestValue,
       orElse: () => plans.plans.first,
     );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@integration_test/utils/payment_robot.dart` around lines 57 - 61, Update
selectBestValuePlan to explicitly validate that plans.plans is non-empty before
firstWhere or its fallback executes, and fail with a clear message identifying
the robot step when the collection is empty. Preserve the existing bestValue
selection and first-plan fallback for non-empty plans.

29-44: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

The cache only helps if container is first read while home is mounted.

The doc comment says the container "outlives route changes". That holds only after the first read. openPaymentMethods calls appRouter.replaceAll, which unmounts the home screen. If a test calls openPaymentMethods before any other robot method, the first container read then fails with "home screen is not mounted".

The current smoke test reads container through loadPlans first, so it passes today. Resolve the container eagerly to make the order irrelevant.

♻️ Proposed eager resolution
-  Future<void> openPaymentMethods({
+  /// Resolves and caches the container while home is still mounted.
+  void primeContainer() => container;
+
+  Future<void> openPaymentMethods({
     required String email,
     required AuthFlow authFlow,
   }) {
+    primeContainer();
     return appRouter.replaceAll([
       ChoosePaymentMethod(email: email, authFlow: authFlow),
     ]);
   }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@integration_test/utils/payment_robot.dart` around lines 29 - 44, Resolve and
cache the ProviderContainer during robot initialization, while the home screen
is mounted, rather than deferring the first lookup until the container getter is
accessed. Update the initialization path and the container getter so
openPaymentMethods and other route-changing methods can safely use the cached
container regardless of call order.

104-115: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use uuid for the generated UUID.

package:uuid is available transitively, so _newUuid() can use const Uuid().v4() instead of generating and formatting UUID v4 bytes locally.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@integration_test/utils/payment_robot.dart` around lines 104 - 115, Update
_newUuid() to return a UUID generated via const Uuid().v4(), add the necessary
uuid import, and remove the local Random-based byte generation and formatting
logic.
integration_test/utils/app_robot.dart (2)

295-331: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

dismissMacOSExtensionScreenIfShown duplicates dismissOnboardingIfShown.

Both methods follow the same shape: return false when the screen is absent, poll up to 5 seconds for a hit-testable target, tap it, then wait for the screen to disappear. Extract one private helper that takes the screen finder, the candidate tap targets, and the log labels. Both public methods then delegate to it.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@integration_test/utils/app_robot.dart` around lines 295 - 331, Extract the
shared dismissal flow from dismissMacOSExtensionScreenIfShown and
dismissOnboardingIfShown into one private helper accepting the screen finder,
candidate tap targets, and log labels. Preserve each method’s existing return
behavior, 5-second polling, tap/pump sequence, disappearance wait, timeout
reason, and logging by delegating both public methods to the helper.

40-68: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

name flows straight into a file path.

captureScreenshot builds File('${dir.path}/$name.png'). A name that contains / or .. writes outside the screenshots directory. All current callers pass literals, so this is not a live defect. Sanitize the name to keep future callers safe.

🛡️ Proposed sanitization
-        final file = File('${dir.path}/$name.png');
+        final safeName = name.replaceAll(RegExp(r'[^A-Za-z0-9._-]'), '_');
+        final file = File('${dir.path}/$safeName.png');
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@integration_test/utils/app_robot.dart` around lines 40 - 68, Sanitize the
name used by captureScreenshot before constructing the screenshot File path,
removing path separators and preventing traversal segments such as “..”. Use the
sanitized value consistently for the output filename and related log messages
while preserving the existing screenshot capture behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/scripts/macos_payment_checkout_smoke.sh:
- Around line 33-34: Update the setup around the .radiance_env marker so staging
selection cannot persist unintentionally after the smoke test; replace the
persistent marker approach with a process-scoped signal, or implement a
stale-marker policy that detects and removes markers left by interrupted runs
while preserving staging selection for the current launch.
- Around line 20-24: Update the CI guard in the macOS payment checkout smoke
script to continue only when CI has the expected affirmative value, rejecting
false, zero, and arbitrary non-empty values before any destructive cleanup runs.
Preserve the existing refusal message and exit behavior for invalid CI values.

In @.github/scripts/macos_smoke_suite.sh:
- Around line 268-285: Update enable_system_extension_developer_mode so its
failure warning no longer states or implies that disabling SIP is required;
retain the sudo systemextensionsctl developer on attempt and report only the
relevant permission or command failure without instructing operators to disable
SIP.

In @.github/workflows/build-windows.yml:
- Around line 198-206: The “Upload Windows payment smoke diagnostics” step must
not upload the full C:\Users\Public\Lantern\logs directory, which contains
sensitive raw logs. Change its artifact path to the intentionally redacted
payment smoke diagnostics output, preserving the existing payment-smoke
condition, artifact name, and retention settings.

In `@integration_test/payment/desktop_stripe_checkout_smoke_test.dart`:
- Around line 196-227: The WebView failure handling in add currently makes
non-cancellation failures from any host terminal. Restrict _terminalFailure
assignment to failures from _stripeHost or the initiating Lantern host, while
preserving cancellation handling and lastFailure recording for all events;
identify and reuse the existing Lantern host symbol rather than introducing a
new host value.

In `@macos/Runner/AppDelegate.swift`:
- Around line 47-48: Add a native waitForRadiance method case to the macOS
method handler used by setupRadiance(), returning a successful readiness result
before startup invokes it; alternatively remove the Dart
service.waitForRadiance() call if Radiance readiness is intentionally handled
elsewhere, while ensuring unknown methods retain their existing behavior.
- Around line 123-132: Update setupRadiance() to return the MobileSetupRadiance
success status, including NSError failures, and make its caller handle a false
result by preventing method-channel registration or failing startup. Ensure
startup cannot continue as if Radiance initialized successfully after either the
error or !success path.

---

Nitpick comments:
In `@integration_test/payment/desktop_stripe_checkout_smoke_test.dart`:
- Around line 100-110: Update _waitForCheckout so a deadline reached without
checkout.finished reports an explicit timeout message instead of using
checkout.failureMessage when no failure was recorded. Preserve the existing
failure message for checkout failures that do provide one.
- Around line 54-61: Serialize WebViewPageEvent processing in the payment
listener by routing events through an ordered queue on _StripeCheckoutTracker,
such as an enqueue method backed by a chained Future, instead of calling add
with unawaited directly. Ensure each event waits for the previous add operation
to finish, while preserving teardown and arrival order.

In `@integration_test/utils/app_robot.dart`:
- Around line 295-331: Extract the shared dismissal flow from
dismissMacOSExtensionScreenIfShown and dismissOnboardingIfShown into one private
helper accepting the screen finder, candidate tap targets, and log labels.
Preserve each method’s existing return behavior, 5-second polling, tap/pump
sequence, disappearance wait, timeout reason, and logging by delegating both
public methods to the helper.
- Around line 40-68: Sanitize the name used by captureScreenshot before
constructing the screenshot File path, removing path separators and preventing
traversal segments such as “..”. Use the sanitized value consistently for the
output filename and related log messages while preserving the existing
screenshot capture behavior.

In `@integration_test/utils/payment_robot.dart`:
- Around line 57-61: Update selectBestValuePlan to explicitly validate that
plans.plans is non-empty before firstWhere or its fallback executes, and fail
with a clear message identifying the robot step when the collection is empty.
Preserve the existing bestValue selection and first-plan fallback for non-empty
plans.
- Around line 29-44: Resolve and cache the ProviderContainer during robot
initialization, while the home screen is mounted, rather than deferring the
first lookup until the container getter is accessed. Update the initialization
path and the container getter so openPaymentMethods and other route-changing
methods can safely use the cached container regardless of call order.
- Around line 104-115: Update _newUuid() to return a UUID generated via const
Uuid().v4(), add the necessary uuid import, and remove the local Random-based
byte generation and formatting logic.

In `@lib/core/widgets/app_webview.dart`:
- Around line 29-40: Strengthen the lifetime documentation for
WebViewPageLoaded.captureScreenshot to explicitly require consumers to invoke it
only within the listener callback while the page’s WebView remains active. Keep
the closure-based API and do not add eager screenshot capture.
- Around line 15-52: Update lib/core/widgets/app_webview.dart lines 15-52 by
adding clear() to WebViewPageEvents and invoking it from _InnerWebViewState when
a load starts and during disposal, preventing stale events from later sessions.
Also update WebViewPageLoaded at lib/core/widgets/app_webview.dart lines 29-40
to store captured Uint8List? data rather than a controller-capturing closure, or
enforce that captureScreenshot is invoked only within the listener callback.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 75d99a88-aa31-4318-90ef-5e4636565a91

📥 Commits

Reviewing files that changed from the base of the PR and between 1a331d2 and 5ff8bb2.

📒 Files selected for processing (17)
  • .github/scripts/macos_payment_checkout_smoke.sh
  • .github/scripts/macos_smoke_suite.sh
  • .github/workflows/build-windows.yml
  • integration_test/payment/desktop_stripe_checkout_smoke_test.dart
  • integration_test/utils/app_robot.dart
  • integration_test/utils/payment_robot.dart
  • integration_test/vpn/connect_smoke_harness.dart
  • integration_test/vpn/macos_connect_smoke_test.dart
  • integration_test/vpn/vpn_smoke_helpers.dart
  • lib/core/router/router.gr.dart
  • lib/core/utils/url_utils.dart
  • lib/core/widgets/app_webview.dart
  • lib/features/auth/choose_payment_method.dart
  • lib/lantern/lantern_platform_service.dart
  • macos/Runner/AppDelegate.swift
  • macos/Runner/Handlers/MethodHandler.swift
  • macos/Shared/FilePath.swift
💤 Files with no reviewable changes (3)
  • lib/lantern/lantern_platform_service.dart
  • macos/Runner/Handlers/MethodHandler.swift
  • lib/features/auth/choose_payment_method.dart

Comment thread .github/scripts/macos_payment_checkout_smoke.sh
Comment thread .github/scripts/macos_payment_checkout_smoke.sh
Comment thread .github/scripts/macos_smoke_suite.sh
Comment thread .github/workflows/build-windows.yml
Comment thread integration_test/payment/desktop_stripe_checkout_smoke_test.dart Outdated
Comment thread macos/Runner/AppDelegate.swift
Comment thread macos/Runner/AppDelegate.swift
@jigar-f

jigar-f commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

Overlapping with a ton of stuff. Going to create a focus PR.

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