Skip to content

STF-2488: Fix README examples - #518

Merged
horgh merged 4 commits into
mainfrom
greg/stf-2488-update-api-reference-documentation-on-minfraud
Dec 1, 2026
Merged

horgh merged 4 commits into
mainfrom
greg/stf-2488-update-api-reference-documentation-on-minfraud

Conversation

@oschwald

@oschwald oschwald commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Summary

  • The shipping example in the README sent a phone verification time with a false verification result. The updated API reference says to send the time only when the result is true. This change removes the time from that example.
  • The two report transaction examples did not compile. They had no colon after the with statement and one space too many of indentation. The asynchronous example called async_client.report, but the context variable is client.
  • The Errors section named minfraud.HttpError. The package exports minfraud.HTTPError.

STF-2488

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Updated the documented HTTP error class name.
    • Revised the request example to omit shipping.phone_verification_time and corrected the indentation of the order dictionary.
    • Fixed syntax, indentation, and client calls in the synchronous and asynchronous report examples.

The shipping example sets the phone verification result to false.
The updated API reference says to send the verification time only
when the result is true.

STF-2488

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@oschwald
oschwald requested review from horgh and a balanced review from Copilot November 23, 2026 23:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Explain Change →

Walkthrough

The README updates the documented HTTP error class, removes shipping.phone_verification_time from a request example, and corrects the order dictionary and synchronous and asynchronous report examples.

Changes: README documentation

Layer / File(s) Summary
Correct API examples
README.rst
The documented error class changes to minfraud.HTTPError. The shipping example omits phone_verification_time, and the order dictionary has corrected indentation. The synchronous and asynchronous report examples have corrected syntax and indentation. The asynchronous example calls client.report.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Change: Other

Merge Risk: Minimal · up to 8810a

This is a documentation-only change that corrects README examples and the error class name. It has no runtime impact and is safe to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "STF-2488: Fix README examples" names the main change: the PR corrects README examples. It does not name the specific fixes (removed phone verification time, syntax and indentation fixes, cl…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "STF-2488: Fix README examples" names the main change: the PR corrects README examples. It does not name the specific fixes (removed phone verification time, syntax and indentation fixes, client.report call, HTTPError class name), but the title is related to the main change and is not overly misleading. The ticket prefix is acceptable, and the title is specific enough for a teammate scanning history to see the primary change.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checks the README page
And fixes examples line by line
The braces sit in proper place
The calls now follow syntax fine
Then hops away, contented and neat

oschwald and others added 2 commits November 23, 2026 23:12
Both examples had no colon after the `with` statement and one space
too many of indentation. The asynchronous example called
`async_client.report`, but the context variable is `client`.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The package exports `minfraud.HTTPError`. `minfraud.HttpError` does
not exist.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@oschwald oschwald changed the title STF-2488: Remove verification time from failed example STF-2488: Fix README examples Nov 23, 2026
Copilot AI balanced review requested due to automatic review settings November 23, 2026 23:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

The closing brace of the `order` dictionary had one space too many.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 30, 2026 20:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Additional comments: 1

README.rst: 1

295-295: Minor · Functional Correctness · Quick win

Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Use continuation prompts in the report examples.

Both examples use >>> for lines inside compound statements. A Python console uses [REDACTED] for those lines, and doctest treats each >>> as a new statement. As written, the examples fail before they call report. Replace the continuation prompts with [REDACTED] in both blocks.

Also applies to: 310-310

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: f638f476-fc01-4c5d-889f-3e9e1bc10bef
Commits

Reviewing files that changed from the base of the PR and between 9f71b26 and 8810aaf.

Files selected for processing: 1

  • README.rst

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Comment thread README.rst
>>> 'phone_number': '123-456-0000',
>>> 'phone_verification_method': 'network',
>>> 'phone_verification_time': '2026-10-01T14:35:00Z',
>>> 'phone_was_verification_successful': False,

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 PR changes the guidance for the verification inputs, but HISTORY.rst has no entry for it. The sibling STF-2488 PRs for Java, .NET, PHP, Node and Ruby each add a changelog entry that states the new rules:

  • Send true if your system considers the email address or phone number verified as of the time of the event.
  • Send false if it is not verified, for example if its only verification is pending or failed.
  • Send nothing if your system does not track verification.
  • Send a verification time only with true.

There are two more reasons to add an entry here:

  • The 3.4.0 entry says these inputs "describe the most recent verification". The new rule is different: an earlier completed verification stays true when a newer attempt is pending or failed. Only a newer entry corrects that statement.
  • README.rst is the PyPI long description. PyPI shows the old example, which sends a time with false, until the next release.

Suggestion: add a 3.4.1 entry that matches the siblings, with was_verification_successful and phone_was_verification_successful as the field names, and "There are no code changes."

🤖 Comment by Claude Opus 5.5.

Comment thread README.rst
address. It is also raised if validation of the request before it is sent to
the server fails.
* ``minfraud.HttpError`` - This will be raised when an unexpected HTTP
* ``minfraud.HTTPError`` - This will be raised when an unexpected HTTP

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 list is still incomplete. score(), insights(), factors() and report() raise PermissionRequiredError when the service returns PERMISSION_REQUIRED (_exception_for_web_service_error in src/minfraud/webservice.py). The list does not name it. Also, src/minfraud/__init__.py does not export it, so minfraud.PermissionRequiredError raises AttributeError, and only minfraud.errors.PermissionRequiredError works. The :raises: lines in the client method docstrings leave it out too.

This problem is older than this PR, but the PR already fixes one error name in this list.

Suggestion: export PermissionRequiredError from minfraud/__init__.py and add a bullet for minfraud.PermissionRequiredError here and in the :raises: lines. If you do not want to change the exports in a docs PR, add a bullet for minfraud.errors.PermissionRequiredError.

🤖 Comment by Claude Opus 5.5.

Comment thread README.rst
>>> 'phone_number': '123-456-0000',
>>> 'phone_verification_method': 'network',
>>> 'phone_verification_time': '2026-10-01T14:35:00Z',
>>> 'phone_was_verification_successful': False,

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.

Nit: this PR removes the time from the false shipping example. The tests still send a verification time with a false result, which the new reference text tells callers not to do:

  • tests/data/full-transaction-request.json lines 47-49 (shipping: network, a time, and false). The README example mirrors this fixture.
  • tests/test_request.py lines 71-72 and 79-80 (email time with false)
  • tests/test_webservice.py lines 284-285 and 300-301 (email time with false)

The tests pass because the client does not check the pairing. But readers copy request shapes from tests. Suggest removing the time from the false cases, or changing those cases to true, so that the fixture matches the README again.

The same comment is on the Java, .NET, PHP, Ruby, and Node PRs.

🤖 Comment by Claude Opus 5.5.

@horgh
horgh merged commit 15e04b5 into main Dec 1, 2026
49 of 50 checks passed
@horgh
horgh deleted the greg/stf-2488-update-api-reference-documentation-on-minfraud branch December 1, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants