Skip to content

[MWPW-199606]Fix intermittent issue of experiment data not fetched for A/B testing#835

Open
Ruchika4 wants to merge 6 commits into
stagefrom
page-config
Open

[MWPW-199606]Fix intermittent issue of experiment data not fetched for A/B testing#835
Ruchika4 wants to merge 6 commits into
stagefrom
page-config

Conversation

@Ruchika4

Copy link
Copy Markdown
Collaborator

Problem

A race condition existed between workflow-acrobat's page config initialization and Adobe Launch (_satellite) not being ready at page load. When the unity block initialized, ensurePageConfig was fired fire-and-forget, which fetched page config and immediately called window._satellite.track(...) to retrieve Target experiment data. Since _satellite loads asynchronously, this call would throw a TypeError if Launch hadn't initialized yet. The error was caught and swallowed, leaving experimentData permanently null for that session because pageConfigFetched = true was already set, preventing any retry when the user actually uploaded a file.

Changes

unitylibs/utils/experiment-provider.js

  • Added waitForSatellite() polls window._satellite every 100ms (up to 5 seconds) before invoking _satellite.track(...)
  • Resolves immediately if _satellite is already present, rejects with a clear error on timeout
  • Handles the common case where Launch initializes within a few seconds of page load

unitylibs/core/workflow/workflow-acrobat/action-binder.js

  • Refactored ensurePageConfig to handle the edge case where _satellite takes longer than 5 seconds or fails for other reasons
  • Used !pageConfig in the catch block to distinguish between fetchPageConfig failure vs getExperimentData failure:
    • fetchPageConfig fails → dispatch error to Splunk, return early, keep pageConfigFetched = true (not a transient failure, no retry)
    • getExperimentData fails → reset pageConfigFetched = false and pageConfigPromise = null so the existing || this.ensurePageConfig() in handleFileUpload naturally triggers a fresh attempt when the user uploads
  • Added const isRetry = !!this.pageConfigLocation to detect first attempt vs user-triggered retry error is only dispatched to Splunk on retry, suppressing noise from the recoverable first-attempt failure

test/utils/experiment-provider.test.js / test/core/workflow/workflow-acrobat/action-binder.test.js

  • Added 9 unit tests covering waitForSatellite polling and timeout, ensurePageConfig guard, flag reset without Splunk dispatch on first failure, flag reset with Splunk dispatch on retry, and success paths via both pageConfig.config.target and targetCfg.experimentationOn

Behavior After Fix

Scenario Outcome
_satellite ready before page config completes Experiment data fetched at page load, no retry needed
_satellite not ready within 5s Silent failure at page load, retry triggered automatically when user uploads
Retry also fails Error dispatched to Splunk, resets again for next upload attempt
fetchPageConfig itself fails Error dispatched to Splunk immediately, no retry

Test plan

  • Verify experiment data is correctly fetched on pages where _satellite loads before user interaction (happy path)
  • Verify no visible error toast appears to users when experiment data fetch fails at page load
  • Verify file upload works correctly when _satellite is delayed past the 5s timeout
  • Verify warn_fetch_experiment Splunk entry is logged only on retry failure, not on initial page load failure

Resolves: MWPW-199606

Test URLs:

@aem-code-sync

aem-code-sync Bot commented Jun 25, 2026

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run all PSI checks
  • Re-run failed PSI checks
  • Re-sync branch
Commits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants