Skip to content

Precleared hold: list every way to carry on that the answer offers - #256

Open
gabrielaoimevbore-beep wants to merge 1 commit into
ethanplusai:mainfrom
gabrielaoimevbore-beep:precleared-paid-options
Open

gabrielaoimevbore-beep wants to merge 1 commit into
ethanplusai:mainfrom
gabrielaoimevbore-beep:precleared-paid-options

Conversation

@gabrielaoimevbore-beep

Copy link
Copy Markdown
Contributor

What this changes

When a key runs out of checks, the Today page and sellbird status show one way to carry on: the checkout link for the £39 pack. Precleared's 402 answer carries more than that, and Sellbird wasn't showing it. Someone sending a few dozen emails a day, or buying for the first time, saw only the largest one-off purchase.

The hold now lists each option the answer offers, with its price and its own checkout link, cheapest commitment first:

  • a starter pack (offered for a key's first purchase only),
  • the monthly plan, only when the answer recommends it,
  • a pack,
  • the Growth plan (or the switch to it, for a key already on the monthly plan).

The monthly plan is left out when the answer recommends Growth. In that case the key already has the monthly plan's allowance (a new key's first 14 days), so that plan would send nothing today and listing it under "to send them now" would be wrong.

What a user out of checks reads now, with three options offered:

3 cold emails are waiting. The key has used today's free checks and has no pack left. To send them now, pick one: a starter pack, £9 for 300 checks (link); the monthly plan, £15 a month for 100 checks a day (link); or a pack, £39 for 2,000 checks (link). Otherwise they go out after the free checks reset at midnight UK time, or switch the check off (compliance.precleared.enabled: false). Replies are not held.

How it stays safe:

  • Nothing from the answer is shown as text. A label is Sellbird's own words around figures read from the answer and bounded in _pounds and _whole; the monthly price must match a strict pattern. The answer's own name, message and operator_message are never used.
  • Every link passes the same test as the pack's. That test is now _checkout_url, split out of _buy_url without changing it: https only, Precleared or its card checkout (BUY_HOSTS), no credentials, and never a link that carries the key.
  • The options are stored with the hold and checked again when it is read (_hold_options), so an edited settings row can't show a foreign link, a link written into a label, or control characters.
  • At most four options (MAX_FIX_OPTIONS).

Unchanged: the Outbox reason still names the pack's link; the Today item's url and url_label are still the pack's; the other holds (no key, rejected key, rate limit, unreachable); and the two free ways out, waiting for the reset and switching the check off, stay in the message. An answer without these fields, or with only one option, reads exactly as before, so nothing depends on Precleared sending them.

Files: sellbird/integrations/precleared.py, docs/precleared.md (the allowance section), CHANGELOG.md, and a new tests/test_precleared_options.py.

How it was tested

Full suite: 3754 passed, 29 skipped (Python 3.13, Linux; CI covers 3.11 and 3.12 on the three platforms). The six existing Precleared test files pass unchanged (262 tests), including the checkout-link safety tests that exercise _buy_url.

tests/test_precleared_options.py (54 tests): the options read from an answer and their order; the monthly plan dropped when Growth is recommended; the switch to Growth; no starter on a second purchase; prices with pence; answers without the fields, non-JSON bodies and wrong types; bad figures (text, booleans, zero, negative, too large, NaN) and bad links; a monthly price that isn't a price; the answer's own names never reaching a label; a link carrying the key left out; the cap; what the sender records; nothing recorded for an older answer or for another kind of hold; cleaning and capping on the way in; a tampered stored hold; the message with three, two and one option; the Today page and sellbird status.

Everything runs against mocked answers. No live checks were made and nothing was sent.

Checklist

  • No real person's or business's name, email, phone, address or domain anywhere in the code, tests, docs or this description (CONTRIBUTING.md).
  • pytest passes.
  • Commits are signed off (git commit -s).
  • Docs and CHANGELOG.md updated if behaviour changed.

Disclosure: I build Precleared, and this change is about how its paid options are shown, so my interest here is direct. It only changes what a user who is already out of checks reads, it puts the cheaper options ahead of the pack, and it keeps both free ways out in the message. If you would rather it showed fewer options, or none beyond the pack, say so and I'll cut it back. The code was written with Claude (Anthropic's AI) at my direction.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FQdvgNwwnTYBHUGD2dPwFh

When a key runs out of checks, the Today page and `sellbird status` gave
one link, the checkout for the £39 pack. Precleared's 402 answer carries
more: a starter pack for a first purchase, the monthly plan when it would
cover what the key sends, and the Growth plan for a key that needs more
than 100 checks a day. Someone sending a few dozen emails a day was shown
only the largest one-off purchase.

The hold now lists each option the answer offers, with its price and its
own checkout link, cheapest commitment first (starter pack, monthly plan,
pack, Growth plan). The monthly plan is listed only when the answer
recommends it: when it recommends Growth, the key already has the monthly
plan's allowance, so that plan would send nothing today.

Nothing from the answer is shown as text. A label is Sellbird's own words
around figures read from the answer and bounded here (_pounds, _whole, a
strict pattern for the monthly price), and each link passes the same test
as the pack's (_checkout_url, split out of _buy_url: https, Precleared or
its card checkout, never a link carrying the key). The options are stored
with the hold and checked again when it is read (_hold_options), so an
edited settings row can't show a foreign link, a link written into a
label, or control characters.

Unchanged: the Outbox reason still names the pack's link, the Today item's
url is still the pack's, the other holds, and the two free ways out
(waiting for the reset, switching the check off) stay in the message. An
answer without these fields, or with one option, reads exactly as before.

docs/precleared.md and the changelog say what is listed. 54 tests in
tests/test_precleared_options.py cover what is read from the answer, bad
figures and links, the stored hold, a tampered hold, the message, the
Today page and `sellbird status`.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FQdvgNwwnTYBHUGD2dPwFh
Signed-off-by: Gabriel Imevbore <gabrielaoimevbore@gmail.com>
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