Fix Arkose challenge submit timing race condition during signup

What does this MR do and why?

Fix Arkose challenge submit timing race condition during signup

When users completed the Arkose challenge and clicked Continue before the SDK callback fired, they saw a misleading verification error. Now the form submission is deferred briefly, showing a spinner on the button, auto-submitting once the token arrives or showing the error after a 2s timeout.
One caveat: When the challenge was not done or done incorrectly and the user clicks Continue, then it takes 2s to show the error message. However, I think it's more important that the happy path works seamlessly. This change is gated behind the feature flag: arkose_labs_signup_challenge_loading_state

Rollout-issue: Roll out: feature-flag: arkose_labs_signup_chal... (#604110)

References

9d in Growth Team Brainstorm: Problems and Opportunities for FY27 H2
Closes Double continue required on registration due to... (#591805)

Screenshots or screen recordings

Context Before After
Normal registration
Trial registration
Submit without arkose

How to set up and validate locally

Setup Arkose locally

  1. Enable Arkose via rails console ApplicationSetting.current.update(arkose_labs_enabled: true)
  2. Enable Feature.flag(:arkose_labs_signup_challenge_loading_state)
  3. Set Arkose API keys in rails console (keys in 1Password under ArkoseLabs API keys, take the GITLAB - DEVELOPMENT - REGISTRATION FLOW - KEY 1 not production:
ApplicationSetting.current.update(
  arkose_labs_public_api_key: '<dev_public_key>',
  arkose_labs_private_api_key: '<dev_private_key>',
  arkose_labs_namespace: 'client'
)
  1. Visit https://gdk.test:3443/users/sign_up
  2. Finish the challenge and click Continue as soon as the Arkose iFrame shows success.
  3. It should wait for a second and then submit

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Konstantin Greif

Merge request reports

Loading