Skip to content

Precleared: optional prospect_country for addresses that don't show a country - #17

Open
gabrielaoimevbore-beep wants to merge 5 commits into
ethanplusai:mainfrom
gabrielaoimevbore-beep:precleared-prospect-country
Open

gabrielaoimevbore-beep wants to merge 5 commits into
ethanplusai:mainfrom
gabrielaoimevbore-beep:precleared-prospect-country

Conversation

@gabrielaoimevbore-beep

Copy link
Copy Markdown
Contributor

Precleared needs the recipient's country to pick a rule. It reads it from the domain (.co.uk, .de, .ca and so on), from UK company records, and from US and Canadian office addresses on the company's website. When none of those show it, as with some .com addresses, the verdict is unknown, which Harvey treats as don't send.

This adds one optional setting for users whose prospects are all in one country:

compliance:
  precleared:
    prospect_country: "US"

Harvey sends it as default_recipient_country, which Precleared uses only as a last resort: the address, company records and the company's website still win, so a .co.uk prospect is still checked under UK rules. When the default is used, the reasons say so and the confidence drops a level (how Precleared works out the country).

  • Empty by default, so nothing changes unless it's set.
  • Two letters, normalised (us becomes US, UK becomes GB). Anything else fails when the config loads, with a clear message.
  • Part of the cache fingerprint only when set, so existing cached verdicts stay valid, and setting it triggers fresh checks.
  • harvey.yaml, the README and the module docstring mention it.

Tests: four new tests in tests/test_precleared.py: config normalising and validation, from_config, the field is sent only when set, and the fingerprint is unchanged when it's empty. The full suite passes on the fork's CI on Ubuntu, macOS and Windows with Python 3.11 and 3.12 (run).

It touches different lines from #16, so the two can merge in either order.

Disclosure: I built Precleared, and I wrote this with help from Claude.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FQdvgNwwnTYBHUGD2dPwFh

Precleared uses it only when it can't work out the recipient's country from the address, company records or the company's website.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FQdvgNwwnTYBHUGD2dPwFh
Sent as default_recipient_country, and added to the cache fingerprint, only when set, so existing cached verdicts stay valid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FQdvgNwwnTYBHUGD2dPwFh
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FQdvgNwwnTYBHUGD2dPwFh
Config normalising and validation, from_config, sent only when set, and the cache fingerprint unchanged when empty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FQdvgNwwnTYBHUGD2dPwFh
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FQdvgNwwnTYBHUGD2dPwFh
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.

1 participant