Skip to content

fix: make startVerification single-flight so a repeated call cannot start a second verification - #93

Merged
arosasg merged 1 commit into
didit-protocol:mainfrom
Nishant-96:fix/single-flight-start-verification
Nov 17, 2026
Merged

arosasg merged 1 commit into
didit-protocol:mainfrom
Nishant-96:fix/single-flight-start-verification

Conversation

@Nishant-96

@Nishant-96 Nishant-96 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Calling startVerification / startVerificationWithWorkflow while a verification was running started a second native verification. On Android that opened two screens and the promises disagreed (completed vs cancelled). On iOS the bridge dropped the result, neither promise settled and the app stopped taking touches. Details in #92.

Both entry points are now single-flight in src/index.tsx:

  • An identical repeat call (same entry point and arguments) joins the running verification and resolves with the same result.
  • A different call resolves immediately as failed / unknown with "A verification is already in progress." and starts nothing.

The second call never reaches native, so this covers both platforms without native changes. No public API or type changes.

Trade-off: if a running native call never settles (a separate bug), later calls stay blocked until the JS context reloads. Before this change only that one promise hung. Happy to switch to a dedicated error type, or move the guard into the native modules, if you prefer.

Closes #92

Verification

  • yarn lint, yarn typecheck, yarn test (212 passing; 6 new in verification-single-flight.test.ts, 4 of which fail without this change), yarn prepare
  • Example app on an Android 17 emulator (native SDK 4.15.4):
    • identical double call: one native start, one screen, both promises completed after finishing the flow
    • different double call: the second resolved failed in 0 ms, one screen, the first cancelled on exit
    • a new verification starts normally afterwards
  • Example app on an iOS 26.5 simulator (native SDK 4.15.4):
    • identical double call: one presentation, both promises cancelled on exit, the app keeps responding to touches
    • different double call: the second resolved failed in 0 ms, the first cancelled on exit
    • a new verification starts normally afterwards
  • Not tested on physical devices.

Privacy check

  • The title, body, commits, branch name, changelog, logs, screenshots, and
    attachments contain no customer/prospect or organization names, contact
    details, account/session identifiers, private tracker keys, support
    details, or private repository/internal-tool links.
  • Any externally reported behavior is described anonymously and its
    identifying context remains only in the private tracker.

…tart a second verification

A second startVerification or startVerificationWithWorkflow call while one
was running started a second native verification. On Android this opened
two screens and gave the two promises different results; on iOS the result
was dropped, neither promise settled and the app stopped taking touches.

An identical repeat call now joins the running verification and gets the
same result. A different call resolves as failed ("A verification is
already in progress.") without starting anything.

Closes didit-protocol#92
@Nishant-96
Nishant-96 force-pushed the fix/single-flight-start-verification branch from 35e86a2 to dd2a5e3 Compare November 17, 2026 15:28
@arosasg

arosasg commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

Codex review (codex CLI, account codex-3, model gpt-5.6-sol)


💡 Code review

Reviewed commit: dd2a5e3

No blocking findings in commit dd2a5e3.

Verdict: APPROVE

@arosasg
arosasg merged commit fa035a5 into didit-protocol:main Nov 17, 2026
6 checks passed
@arosasg arosasg mentioned this pull request Nov 18, 2026
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.

Calling startVerification while a verification is running: two screens on Android, both promises hang and touches freeze on iOS

2 participants