Skip to content

Improve cancel callback documentation#109

Merged
predatorx7 merged 3 commits intomainfrom
update-docs
Jan 31, 2026
Merged

Improve cancel callback documentation#109
predatorx7 merged 3 commits intomainfrom
update-docs

Conversation

@predatorx7
Copy link
Contributor

@predatorx7 predatorx7 commented Jan 31, 2026

Description

Testing (ignore for documentation update)

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Checklist:

Additional Notes:

Summary by CodeRabbit

  • Documentation
    • Clarified what triggers the cancel callback with a dedicated section and enumerated exceptions.
    • Noted that additional errors can trigger cancel callbacks when auto-submit is enabled.
    • Added that analytics metadata may include a has_error flag for aborted verification after an error.
    • Reworked troubleshooting navigation and updated the structure and example of proof/cancel payloads for clarity.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link
Contributor

vercel bot commented Jan 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jan 31, 2026 3:29pm

Request Review

@coderabbitai
Copy link

coderabbitai bot commented Jan 31, 2026

📝 Walkthrough

Walkthrough

Updated documentation clarifying what triggers the cancel callback: added a dedicated section listing specific exceptions and a note about conditional error-triggered cancellations; restructured the troubleshooting index to consolidate cancellation and error handling and adjusted related troubleshooting pages' metadata notes and examples.

Changes

Cohort / File(s) Summary
Cancel Callback (JS SDK)
content/docs/js-sdk/preparing-request.mdx
Added a dedicated "What triggers cancel callback?" section with a table enumerating specific exceptions; added note about other errors possibly triggering cancel when auto-submit is enabled; updated surrounding wording.
Troubleshooting docs
content/docs/troubleshooting/index.mdx, content/docs/troubleshooting/analytics-event.mdx, content/docs/troubleshooting/anatomy.mdx
Removed the separate "Handle 'Verify Another Way'" list item and expanded "Handling Cancellation & Errors" to include verification-via-another-way as a cancellation cause; added analytics-event note about has_error for ReclaimVerificationAbortedException; expanded proof request JSON example and added publicData and metadata notes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • Karam19
  • kryptocodes

Poem

🐰 I hopped through docs both near and far,

Cleared cancel callbacks — now know what they are.
Tables tidy, examples bright,
Troubleshooting now takes flight.
Hop on, reviewers, let’s ship it right! 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Improve cancel callback documentation' directly and clearly summarizes the main purpose of the changeset, which involves updating documentation across multiple files to clarify cancel callback behavior, error handling, and request anatomy.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update-docs

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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
content/docs/troubleshooting/index.mdx (1)

17-17: ⚠️ Potential issue | 🟡 Minor

Fix grammar issues in this sentence.

This line has two grammar errors:

  1. "an cancel callback" → "a cancel callback"
  2. "session cancellations" → "session is cancelled"
📝 Proposed fix
-The easiest way to handle cancellation is to set up an cancel callback. This allows your application to react immediately when a user's verification session cancellations.
+The easiest way to handle cancellation is to set up a cancel callback. This allows your application to react immediately when a user's verification session is cancelled.
🤖 Fix all issues with AI agents
In `@content/docs/js-sdk/preparing-request.mdx`:
- Around line 107-116: Fix two minor wording issues in the "What triggers cancel
callback?" section: add the article "the" before "user" in the sentence
"Following are some exceptions that happen when user presses a button..." and
hyphenate "auto submit" to "auto-submit" in the sentence "Other errors (such as
network timeouts or internal exceptions) may also trigger this callback if auto
submit is enabled." Reference the section header and the exception names
ReclaimVerificationAbortedException and
ReclaimVerificationProviderScriptException to locate the paragraph to update.

Comment on lines +107 to +116
#### What triggers cancel callback?

Following are some exceptions that happen when user presses a button to cancel in UI or provider custom injection script causes a cancellation by calling `Reclaim.reportProviderError` in browser.

| Exception Name | Description |
|----------------|-------------|
| `ReclaimVerificationAbortedException` | User cancelled the verification (e.g., tapped on cancel or verify another way button). |
| `ReclaimVerificationProviderScriptException` | The provider script encountered an error (e.g., login failed, invalid account used). |

Other errors (such as network timeouts or internal exceptions) will **not** trigger this callback but can be found by [fetching analytics events](./troubleshooting/analytics-event) for the session.
Other errors (such as network timeouts or internal exceptions) may also trigger this callback if **auto submit is enabled**. In any case, you can always find the complete list of errors by [fetching analytics events](./troubleshooting/analytics-event) for the session.
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Minor grammar and formatting fixes needed.

Two small issues:

  1. Line 109: Missing article "the" before "user"
  2. Line 116: "auto submit" should be hyphenated as "auto-submit" (compound adjective)
📝 Proposed fixes
 #### What triggers cancel callback?

-Following are some exceptions that happen when user presses a button to cancel in UI or provider custom injection script causes a cancellation by calling `Reclaim.reportProviderError` in browser.
+Following are some exceptions that happen when the user presses a button to cancel in the UI or a provider custom injection script causes a cancellation by calling `Reclaim.reportProviderError` in the browser.

 | Exception Name | Description |
 |----------------|-------------|
 | `ReclaimVerificationAbortedException` | User cancelled the verification (e.g., tapped on cancel or verify another way button). |
 | `ReclaimVerificationProviderScriptException` | The provider script encountered an error (e.g., login failed, invalid account used). |

-Other errors (such as network timeouts or internal exceptions) may also trigger this callback if **auto submit is enabled**. In any case, you can always find the complete list of errors by [fetching analytics events](./troubleshooting/analytics-event) for the session.
+Other errors (such as network timeouts or internal exceptions) may also trigger this callback if **auto-submit is enabled**. In any case, you can always find the complete list of errors by [fetching analytics events](./troubleshooting/analytics-event) for the session.
🧰 Tools
🪛 LanguageTool

[grammar] ~116-~116: Use a hyphen to join words.
Context: ...may also trigger this callback if auto submit is enabled. In any case, you ca...

(QB_NEW_EN_HYPHEN)

🤖 Prompt for AI Agents
In `@content/docs/js-sdk/preparing-request.mdx` around lines 107 - 116, Fix two
minor wording issues in the "What triggers cancel callback?" section: add the
article "the" before "user" in the sentence "Following are some exceptions that
happen when user presses a button..." and hyphenate "auto submit" to
"auto-submit" in the sentence "Other errors (such as network timeouts or
internal exceptions) may also trigger this callback if auto submit is enabled."
Reference the section header and the exception names
ReclaimVerificationAbortedException and
ReclaimVerificationProviderScriptException to locate the paragraph to update.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
content/docs/troubleshooting/anatomy.mdx (1)

113-118: ⚠️ Potential issue | 🟡 Minor

Use a TypeScript code block for the cancel callback shape.

The code block is labeled as json but contains [key: any]: any, which is TypeScript syntax invalid in JSON. Since the documentation is showing a type structure with index signatures, use a TypeScript code block instead.

Suggested change
-```json
+```ts
 {
   "type": "string",
   "message": "string",
-  [key: any]: any
+  [key: string]: any
 }
</details>

</blockquote></details>

</blockquote></details>
🤖 Fix all issues with AI agents
In `@content/docs/troubleshooting/analytics-event.mdx`:
- Around line 208-210: The docs mention a has_error boolean in Reclaim
verification metadata but the MetadataReclaimException type definition is
missing it; update the MetadataReclaimException metadata type to include an
optional has_error?: boolean (and add a short inline comment or sentence
describing that it is true when the user cancelled after an error) so the
narrative and type definition match—look for the MetadataReclaimException type
definition in the analytics-event content and add the optional has_error field
to that type.

In `@content/docs/troubleshooting/anatomy.mdx`:
- Around line 36-58: The comment for "cancelCallbackUrl" conflicts with the
example because it says the URL is used only when auto submit is enabled while
the example sets "canAutoSubmit": false; update the example or the comment:
either set "canAutoSubmit": true in the JSON sample to match the comment, or
reword the comment to state that "cancelCallbackUrl" is used when auto submit is
enabled (canAutoSubmit: true) and may be ignored when false; adjust the
surrounding text for "cancelCallbackUrl" and "canAutoSubmit" so their behaviors
are consistent and unambiguous.

Comment on lines 208 to +210
> [!NOTE]
> In case of `ReclaimVerificationProviderScriptException`, the metadata may contain an additional `providerError` field with more detailed error information from the provider script.
> In case of `ReclaimVerificationAbortedException`, the metadata may contain an additional `has_error` boolean field which will be true if the user cancelled the verification after an error occurred during verification.
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Document has_error in the metadata type definition.

The new note introduces a has_error field, but MetadataReclaimException doesn’t include it. This makes the type definition inconsistent with the narrative.

📝 Suggested doc update
 export interface MetadataReclaimException {
   exception: {
     type: string; // e.g. "ReclaimVerificationCancelledException"
     message: string;
     providerError?: Record<string, any>;
   };
+  has_error?: boolean;
 }
🤖 Prompt for AI Agents
In `@content/docs/troubleshooting/analytics-event.mdx` around lines 208 - 210, The
docs mention a has_error boolean in Reclaim verification metadata but the
MetadataReclaimException type definition is missing it; update the
MetadataReclaimException metadata type to include an optional has_error?:
boolean (and add a short inline comment or sentence describing that it is true
when the user cancelled after an error) so the narrative and type definition
match—look for the MetadataReclaimException type definition in the
analytics-event content and add the optional has_error field to that type.

Comment on lines +36 to +58
// URL which is called when verification is cancelled by the user or after errors (only auto submit enabled; auto submit is enabled by default).
"cancelCallbackUrl": "https://api.example.com/cancel?session=def",
// URL to redirect to after cancelled proof generation
"cancelRedirectUrl": "https://example.com/cancelled?session=def",
// Timestamp of the proof request
"timestamp": "1769867597546",
// legacy: same as above
"timeStamp": "1769867597546",
"options": {
// enables diagnostic logging for debugging purposes
"log": true,
// enables use of AI in verification journey
"acceptAiProviders": false,
// users may use Reclaim Verifier app clip or instant app for verification
"useAppClip": false,
// URL of the custom share page (optional)
"customSharePageUrl": "https://portal.reclaimprotocol.org",
"launchOptions": {
// enables deferred deep links flow
"canUseDeferredDeepLinksFlow": true
},
// Enables auto submitting proofs on success or errors
"canAutoSubmit": false,
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Align cancel callback description with the example configuration.

The comment says cancelCallbackUrl is only used when auto submit is enabled, but the example sets "canAutoSubmit": false, which can be read as contradictory. Consider clarifying the comment or adjusting the example value to avoid confusion.

✏️ Possible clarification
-    // URL which is called when verification is cancelled by the user or after errors (only auto submit enabled; auto submit is enabled by default).
+    // URL called when the user cancels verification; error-triggered cancellations are delivered only when canAutoSubmit is true (default).
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// URL which is called when verification is cancelled by the user or after errors (only auto submit enabled; auto submit is enabled by default).
"cancelCallbackUrl": "https://api.example.com/cancel?session=def",
// URL to redirect to after cancelled proof generation
"cancelRedirectUrl": "https://example.com/cancelled?session=def",
// Timestamp of the proof request
"timestamp": "1769867597546",
// legacy: same as above
"timeStamp": "1769867597546",
"options": {
// enables diagnostic logging for debugging purposes
"log": true,
// enables use of AI in verification journey
"acceptAiProviders": false,
// users may use Reclaim Verifier app clip or instant app for verification
"useAppClip": false,
// URL of the custom share page (optional)
"customSharePageUrl": "https://portal.reclaimprotocol.org",
"launchOptions": {
// enables deferred deep links flow
"canUseDeferredDeepLinksFlow": true
},
// Enables auto submitting proofs on success or errors
"canAutoSubmit": false,
// URL called when the user cancels verification; error-triggered cancellations are delivered only when canAutoSubmit is true (default).
"cancelCallbackUrl": "https://api.example.com/cancel?session=def",
// URL to redirect to after cancelled proof generation
"cancelRedirectUrl": "https://example.com/cancelled?session=def",
// Timestamp of the proof request
"timestamp": "1769867597546",
// legacy: same as above
"timeStamp": "1769867597546",
"options": {
// enables diagnostic logging for debugging purposes
"log": true,
// enables use of AI in verification journey
"acceptAiProviders": false,
// users may use Reclaim Verifier app clip or instant app for verification
"useAppClip": false,
// URL of the custom share page (optional)
"customSharePageUrl": "https://portal.reclaimprotocol.org",
"launchOptions": {
// enables deferred deep links flow
"canUseDeferredDeepLinksFlow": true
},
// Enables auto submitting proofs on success or errors
"canAutoSubmit": false,
🤖 Prompt for AI Agents
In `@content/docs/troubleshooting/anatomy.mdx` around lines 36 - 58, The comment
for "cancelCallbackUrl" conflicts with the example because it says the URL is
used only when auto submit is enabled while the example sets "canAutoSubmit":
false; update the example or the comment: either set "canAutoSubmit": true in
the JSON sample to match the comment, or reword the comment to state that
"cancelCallbackUrl" is used when auto submit is enabled (canAutoSubmit: true)
and may be ignored when false; adjust the surrounding text for
"cancelCallbackUrl" and "canAutoSubmit" so their behaviors are consistent and
unambiguous.

@predatorx7 predatorx7 merged commit 9cc6be8 into main Jan 31, 2026
3 checks passed
@predatorx7 predatorx7 deleted the update-docs branch January 31, 2026 16:45
@coderabbitai coderabbitai bot mentioned this pull request Jan 31, 2026
10 tasks
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