Skip to content

[SDK-705] IterablePushRegistrationTask as Runnable instead of AsyncTask - #1093

Open
franco-zalamena-iterable wants to merge 8 commits into
masterfrom
feature/sdk-705-push-registration-executor
Open

franco-zalamena-iterable wants to merge 8 commits into
masterfrom
feature/sdk-705-push-registration-executor

Conversation

@franco-zalamena-iterable

@franco-zalamena-iterable franco-zalamena-iterable commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Jira: SDK-705

Replaces push registration AsyncTask orchestration with SDK-owned executors while preserving production behavior and rapid login/logout ordering.

Behavior

  • Push token acquisition, registration, disable requests, and their retries use a dedicated SDK-owned serial lane.
  • A newer register or disable action invalidates stale retries from an earlier action.
  • Push client callbacks continue to run on the Android main thread.
  • General online API requests retain their existing thread-pool execution path.
  • JWT and HTTP 5xx retry behavior remains supported on the push lane.

Compatibility

  • No public API is added or changed.
  • Test injection uses package-private constructors and interfaces; no VisibleForTesting state is required.
  • The final diff adds no deprecated AsyncTask invocation.

Verification

  • Complete iterableapi and iterableapi-ui unit suites pass.
  • Focused push registration, public-flow integration, and malformed timestamp tests pass.
  • Checkstyle, lint, UI assembly, root consumer tests, and Android-test compilation pass.
  • The complete 26-test instrumentation suite passes locally on API 28.
  • The notification image test now uses a repository fixture instead of an external network asset.
  • The standalone sample reaches SDK compilation and then hits its existing Kotlin 1.8 versus 1.9 data-object mismatch.

@franco-zalamena-iterable
franco-zalamena-iterable requested a review from a team as a code owner September 16, 2026 15:34
@franco-zalamena-iterable
franco-zalamena-iterable added this pull request to stack #1095 September 17, 2026 15:00
@franco-zalamena-iterable franco-zalamena-iterable changed the title IterablePushRegistrationTask as Runnable instead of AsyncTask [SDK-705] IterablePushRegistrationTask as Runnable instead of AsyncTask Sep 21, 2026
@joaodordio
joaodordio requested a review from rtlsilva September 23, 2026 10:24
@franco-zalamena-iterable
franco-zalamena-iterable force-pushed the feature/sdk-705-push-registration-executor branch from 696e808 to 160504f Compare September 23, 2026 12:34
@franco-zalamena-iterable

Copy link
Copy Markdown
Contributor Author

Stack review update after the rebase:

  • The ordering concern remains addressed: push actions and their register/disable HTTP submissions use the same dedicated serial push lane.
  • Deterministic coverage protects enable-to-disable ordering and prevents stale registration retries after a newer push action.
  • The existing review discussion is preserved.
  • The remaining deprecated request AsyncTask findings are intentionally removed by stacked SDK-707 rather than duplicating that migration into SDK-705.

Check, BCIT, changelog, Java analysis, and the main build job passed. I have rerun the two failed jobs after confirming their failures were the external notification-image assertion and one instrumentation response timeout.

Ready for another review.

@franco-zalamena-iterable

Copy link
Copy Markdown
Contributor Author

Rerun follow-up: the unit job now fails only on the repository-wide external IterableNotificationTest.testNotificationImage assertion. The instrumentation rerun reproduced the lower-stack AsyncTask response timeout in IterableApiResponseTest; that suite passes on SDK-706 once the deep-link lane is separated and passes on SDK-707 after request AsyncTask is removed. The push ordering coverage and BCIT remain green.

@franco-zalamena-iterable

Copy link
Copy Markdown
Contributor Author

@rtlsilva SDK-705 is ready for re-review in 8d7e9e3.

The ordering concern is now handled across the complete push flow: registration and disable submissions, HTTP work, 5xx retries, and JWT retries remain on the SDK-owned serial push lane, while newer actions invalidate stale retries. General online requests are restored to their original thread-pool behavior, and push callbacks remain on main.

The previous CodeQL findings were caused by newly added deprecated AsyncTask calls; those additions are gone from the final diff. Focused behavior tests, UI unit tests, static checks, root consumer tests, and Android-test compilation pass. CI is now running on the updated commit.

@franco-zalamena-iterable
franco-zalamena-iterable force-pushed the feature/sdk-705-push-registration-executor branch from 8d7e9e3 to 50030e0 Compare September 23, 2026 18:34
unknownUserManager.trackUnknownTokenRegistration(deviceToken);
}
return;
registerDeviceToken(email, userId, authToken, applicationName, deviceToken, deviceAttributes, runnable -> new Thread(runnable).start());

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.

This default path still starts a separate thread before submitting the registration request, so an immediately following disablePush() can enqueue first and overtake a manual registerDeviceToken() call.
That leaves the public registration path outside the dedicated serial registration/disable lane described by this PR.

Suggest submitting it through the push executor and adding deterministic registerDeviceToken() → disablePush() ordering test coverage.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in fc4b5d7. The default manual registerDeviceToken(token) path now enters IterableExecutors.push(), while the automatic registration task keeps using Runnable::run because it is already executing on that lane. This preserves registration-before-disable submission order in both paths. Added a deterministic public-flow test that calls registerDeviceToken(token) followed immediately by disablePush() and verifies /registerDeviceToken is received before /disableDevice.

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.

3 participants