Repository navigation
Precleared hold: list every way to carry on that the answer offers - #256
Open
gabrielaoimevbore-beep wants to merge 1 commit into
Open
gabrielaoimevbore-beep wants to merge 1 commit into
gabrielaoimevbore-beep wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
When a key runs out of checks, the Today page and
sellbird statusshow 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:
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:
How it stays safe:
_poundsand_whole; the monthly price must match a strict pattern. The answer's ownname,messageandoperator_messageare never used._checkout_url, split out of_buy_urlwithout changing it: https only, Precleared or its card checkout (BUY_HOSTS), no credentials, and never a link that carries the key._hold_options), so an edited settings row can't show a foreign link, a link written into a label, or control characters.MAX_FIX_OPTIONS).Unchanged: the Outbox reason still names the pack's link; the Today item's
urlandurl_labelare 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 newtests/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 andsellbird status.Everything runs against mocked answers. No live checks were made and nothing was sent.
Checklist
pytestpasses.git commit -s).CHANGELOG.mdupdated 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