Skip to content

STF-2532: Deprecate ShippingAddress.isHighRisk - #2001

Merged
horgh merged 2 commits into
mainfrom
greg/stf-2532-deprecate-shipping-is-high-risk
Dec 2, 2026
Merged

horgh merged 2 commits into
mainfrom
greg/stf-2532-deprecate-shipping-is-high-risk

Conversation

@oschwald

@oschwald oschwald commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Deprecate ShippingAddress.isHighRisk with @deprecated. The minFraud web service is removing shipping_address.is_high_risk from its responses. Version 10.0.0 removes it.
  • Replace its comment, which described is_in_ip_country. The type stays boolean, because a change to optional can break code that compiles today.

The deprecation can release before the web service change deploys.

STF-2532

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Clarified that the shipping address high-risk field is deprecated in minFraud responses and is scheduled for removal in version 10.0.0; its declaration remains unchanged.
    • Updated address-field documentation to state that values are undefined when the service omits the relevant information, rather than null.
    • Clarified that the shipping address high-risk value relates to association with fraudulent transactions.

@oschwald
oschwald requested review from horgh and a balanced review from Copilot December 1, 2026 22:11
@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The PR documents the minFraud service’s removal of the shipping address high-risk field and marks it for removal in version 10.0.0. It also updates address-field documentation to state that unavailable values are undefined.

Changes: Shipping address field deprecation

Layer / File(s) Summary
Document field status and unavailable values
src/response/records.ts, src/response/web-records.ts, CHANGELOG.md
The response documentation and declaration mark the high-risk field for removal in version 10.0.0. The changelog records the service removal. Address-field documentation changes unavailable values from null to undefined.

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

Change: Other

Suggested reviewers: kevcenteno

Merge Risk: Minimal · up to 01b17

This change only documents the deprecation of the shipping address high-risk field and clarifies that unavailable address values are undefined. It does not change runtime behavior or the public types, so it is low risk 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 names the change: deprecating ShippingAddress.isHighRisk. The changeset marks that property as deprecated in src/response/records.ts and src/response/web-records.ts, and the CHANGELOG.md ent…
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 names the change: deprecating ShippingAddress.isHighRisk. The changeset marks that property as deprecated in src/response/records.ts and src/response/web-records.ts, and the CHANGELOG.md entry records the same change with removal planned for 10.0.0. The title is specific and matches the main change. The STF-2532 ticket prefix is a minor addition and does not affect the assessment.

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 reads the changelog by moonlit clover,
The field’s last season is coming closer.
“Undefined,” says the note, neat and clear,
“Version ten marks the change of year.”
The rabbit hops off, with docs in a row.

Recent 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: 0d04d1a4-24c6-4801-8990-e377783db7b4
Commits

Reviewing files that changed from the base of the PR and between 10f0a16 and 01b173b.

Files selected for processing: 2

  • CHANGELOG.md
  • src/response/records.ts

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

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.

🟢 Approval recommended

No active review issues were identified for the deprecation of ShippingAddress.isHighRisk.

No open issues 🎉

What changed in this PR

Deprecates ShippingAddress.isHighRisk ahead of the minFraud web service removing the field, while preserving the existing boolean type for source compatibility.

Changes:

  • Adds deprecation annotations to the public and raw response interfaces, announcing removal in version 10.0.0.
  • Replaces the incorrect public property description with guidance not to rely on the field.
  • Records the deprecation in the unreleased changelog.
File Description
src/​response/​web-records.ts Marks is_high_risk as deprecated.
src/​response/​records.ts Deprecates isHighRisk and corrects its documentation.
CHANGELOG.md Announces the deprecation and planned removal.

Review effort: Balanced

The minFraud web service is removing shipping_address.is_high_risk
from its responses. Mark the property deprecated for removal in
10.0.0. Keep its type, because widening it to optional could break
code that compiles today.

The old comment described is_in_ip_country. Replace it with the
deprecation notice.

STF-2532

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oschwald
oschwald force-pushed the greg/stf-2532-deprecate-shipping-is-high-risk branch from 10f0a16 to 6ad7a2a Compare December 1, 2026 22:56
Copilot AI balanced review requested due to automatic review settings December 1, 2026 22:56

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.

🟢 Approval recommended

No active review issues were identified for the shipping-address high-risk field deprecation.

No open issues 🎉

Review effort: Balanced

@horgh horgh left a comment

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.

Looks good. Most of Claude's comments don't look important and I ignored them on the other PRs I've looked at so far. There is at least one that seems worth looking at though.

Comment thread src/response/records.ts
* @category Deprecated
* @deprecated This property will be removed in 10.0.0.
*/
readonly isHighRisk: boolean;

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.

The comment above says this property is undefined when the web service does not return it, but the type is still boolean. The PR description gives the reason: a change to isHighRisk?: boolean can break code that compiles today.

But the web service already leaves out shipping_address.is_high_risk for some requests that have a shipping address. After STF-2444 deploys, it leaves the field out for all requests. So the boolean type is already wrong at runtime for some responses. With strictNullChecks, code such as addr.isHighRisk.toString() or const risky: boolean = addr.isHighRisk compiles and then throws or gets undefined. A compile error would point users to code that is already broken. Email.isHighRisk (line 291) is already optional.

Consider readonly isHighRisk?: boolean here and readonly is_high_risk?: boolean in ShippingAddressWebRecord (src/response/web-records.ts). If you keep boolean on purpose for semver, that is a fair tradeoff. In that case, see the CHANGELOG comment.

🤖 Comment by Claude Opus 5.5.

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.

Seems like it is intentional to leave it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, this is intentional as changing it would be a breaking change. I agree that it was wrong, but it is deprecated now and we will be removing it.

Comment thread CHANGELOG.md

* Deprecated the `isHighRisk` property on `response.shippingAddress`. The
minFraud web service is removing the `shipping_address.is_high_risk` field
from its responses. The property will be removed in 10.0.0.

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 entry says that 10.0.0 removes the property. It does not say that the value can be undefined before then. The web service already leaves out shipping_address.is_high_risk for some requests that have a shipping address. After the web service change deploys, the property is undefined in all responses, whatever library version the user has. The TypeScript type stays boolean, so users who read only the CHANGELOG can think the value stays valid until they upgrade to 10.0.0.

Suggest a sentence such as: "The property is undefined when the web service does not return the field. This already happens for some requests, and will happen for all requests once the web service change deploys."

🤖 Comment by Claude Opus 5.5.

Comment thread src/response/records.ts
* could not be geolocated, then the property is `null`.
* This is `true` if the shipping address is associated with fraudulent
* transactions. The minFraud web service deprecated this field. This is
* `undefined` when the web service does not return it.

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: no test covers the undefined case that this comment describes. The shipping address assertions in src/webServiceClient.spec.ts (lines 329, 590, 697) use only the fixture that has is_high_risk: true. Consider a case that removes shipping_address.is_high_risk from the response and asserts that got.shippingAddress?.isHighRisk is undefined and that the other shipping address properties still map. The web service already leaves out the field for some requests, so this case becomes the normal one.

🤖 Comment by Claude Opus 5.5.

Comment thread src/response/records.ts
* @deprecated This property will be removed in 10.0.0.
*/
readonly isHighRisk: boolean;
/**

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.

Pre-existing, not caused by this PR: the new isHighRisk comment correctly says undefined for a missing field. The comments on isPostalInCity (line 350) and isInIpCountry (line 373) say the property "will be null". The client does not add missing keys (maybeGet only runs camelcaseKeys), so the value is undefined. BillingAddress.isPostalInCity (line 383) and BillingAddress.isInIpCountry (line 402) have the same text. The comments in this interface now disagree. Optional follow-up: change "will be null" to "is undefined".

🤖 Comment by Claude Opus 5.5.

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.

That might be worth fixing given we fixed it for this one?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Comment from Claude Opus 5.5, an agent working on behalf of Greg.

Fixed in 01b173b. The isPostalInCity and isInIpCountry comments on BillingAddress and ShippingAddress now say undefined, not null.

Comment thread src/response/records.ts
* @deprecated This property will be removed in 10.0.0.
*/
readonly isHighRisk: boolean;
/**

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.

Pre-existing, not caused by this PR: latitude, longitude, distanceToIpLocation, and distanceToBillingAddress (lines 356-368) are typed as always present (number). I believe the web service leaves them out when it cannot locate the address, but please confirm. If it does, code such as addr.distanceToIpLocation > 500 compiles, and at runtime compares undefined, which is always false. BillingAddress and the *WebRecord types have the same shape. A fix probably belongs in 10.0.0 if the team treats it as a breaking type change.

🤖 Comment by Claude Opus 5.5.

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.

Interesting

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, I'll make an issue for this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Comment from Claude Opus 5.5, an agent working on behalf of Greg.

Filed as ENG-5895. I checked the web service code: it can leave out these address fields. The issue also lists the other Node response properties that are typed as always present but that the service can leave out, for example on the credit card, phone, email, and device. The fix is a breaking type change, so it is planned for 10.0.0.

Comment thread src/response/records.ts
* shipping address could not be parsed or was not provided or the IP address
* could not be geolocated, then the property is `null`.
* This is `true` if the shipping address is associated with fraudulent
* transactions. The minFraud web service deprecated this field. This is

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 comment says the web service "deprecated this field", but the CHANGELOG entry says the web service "is removing" it from its responses. "Deprecated" can suggest that the web service still sends the field. The web service already leaves the field out of some responses, and after the change it leaves it out of all responses.

Suggest the CHANGELOG wording here, for example: "The minFraud web service is removing this field from its responses. This is undefined when the web service does not return it."

🤖 Comment by Claude Opus 5.5.

Comment thread CHANGELOG.md
9.3.0 (unreleased)
------------------

* Deprecated the `isHighRisk` property on `response.shippingAddress`. The

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, optional: when this library deprecated the Factors subscores (8.0.0), the CHANGELOG entry linked to the minFraud release notes. Consider a link to the release note for this removal, so users can find the date and the reason. If this release ships before that release note is published, ignore this.

🤖 Comment by Claude Opus 5.5.

The client does not add keys that the web service leaves out, so a
missing isPostalInCity or isInIpCountry is undefined, not null. This
matches the new isHighRisk comment.

STF-2532

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oschwald
oschwald requested review from horgh and a balanced review from Copilot December 2, 2026 18:04

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.

@horgh
horgh merged commit c959eb2 into main Dec 2, 2026
16 checks passed
@horgh
horgh deleted the greg/stf-2532-deprecate-shipping-is-high-risk branch December 2, 2026 19:08
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