Skip to content

fix: name the real reason a retry collected nothing, and report the send honestly - #61

Merged
wzul merged 1 commit into
mainfrom
fix/retry-blocker-reasons
Sep 25, 2026
Merged

wzul merged 1 commit into
mainfrom
fix/retry-blocker-reasons

Conversation

@wzul

@wzul wzul commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

fix: name the real reason a retry collected nothing, and report the send honestly

Two faults, both about telling the operator something untrue.

  1. "Nothing to retry: the subscription is not due, or has no stored card."

That single sentence covered four unrelated situations, so it did not tell the
operator anything. They had to work out which one applied — and one of the four
is fixable from this very screen, which the wording hid.

The four are now named, each with the reference and what would change the
answer:

not due until <date>          -> nothing to do; collected automatically
no stored card                -> send an update-card link, then retry
no next payment date          -> check the feed's billing cycle
cancelled/expired/pending     -> reactivate first
not a subscription            -> no renewal to collect

GF_Chip_Renewals::blocking_reason() returns which one, and is_due() is now
null === blocking_reason(), so the two cannot drift apart. The classifier
tests conditions in the order the charge path refuses in, so the reason
reported is the reason that would actually stop the charge — reporting a later
one would name a cause that is not the cause. A missing token is checked before
the date for that reason: a subscription with no card is the one case the
operator can fix here, and it must not be reported as "not due yet".

The date is shown in the site's timezone, not the raw UTC that is stored.

  1. "Send update-card link" always reported success.

The handler redirected with &sent=<id> whether or not the mail left, and the
notice was printed from that flag alone. A refused recipient and a refused send
were indistinguishable from a success. It now captures the return value, and a
failure redirects to a distinct error notice instead.

Verified on a live install. Clicking Retry on a subscription not due until the
next day now reports:

Nothing to do yet (#93): the next payment is not due until 2026-09-26
01:59 (+00:00). It will be collected automatically — press Retry only if
you want to charge it before then.

Potential Risks & Review Items

  • The message is still a display of redirect parameters, so the nonce-ignore
    annotations stay. Nothing from the request is echoed: the reason is matched
    against the known set and the id is cast to int, so an unknown reason falls
    through to a generic sentence rather than printing the supplied value.
  • blocking_reason() is public because the handler and the notice both need
    it. It is pure, so it stays directly testable.
  • The wording is longer than before. That is the fix: the old one was short
    because it was not saying anything specific. It remains a single sentence.
  • A unit test cannot reach wp_date() or the site timezone, so the notice text
    is pinned by direct reflection on skipped_message(), and the rendering was
    confirmed on a live install.

…end honestly

Two faults, both about telling the operator something untrue.

1. "Nothing to retry: the subscription is not due, or has no stored card."

That single sentence covered four unrelated situations, so it did not tell the
operator anything. They had to work out which one applied — and one of the four
is fixable from this very screen, which the wording hid.

The four are now named, each with the reference and what would change the
answer:

    not due until <date>          -> nothing to do; collected automatically
    no stored card                -> send an update-card link, then retry
    no next payment date          -> check the feed's billing cycle
    cancelled/expired/pending     -> reactivate first
    not a subscription            -> no renewal to collect

`GF_Chip_Renewals::blocking_reason()` returns which one, and `is_due()` is now
`null === blocking_reason()`, so the two cannot drift apart. The classifier
tests conditions in the order the charge path refuses in, so the reason
reported is the reason that would actually stop the charge — reporting a later
one would name a cause that is not the cause. A missing token is checked before
the date for that reason: a subscription with no card is the one case the
operator can fix here, and it must not be reported as "not due yet".

The date is shown in the site's timezone, not the raw UTC that is stored.

2. "Send update-card link" always reported success.

The handler redirected with `&sent=<id>` whether or not the mail left, and the
notice was printed from that flag alone. A refused recipient and a refused send
were indistinguishable from a success. It now captures the return value, and a
failure redirects to a distinct error notice instead.

Verified on a live install. Clicking Retry on a subscription not due until the
next day now reports:

    Nothing to do yet (#93): the next payment is not due until 2026-09-26
    01:59 (+00:00). It will be collected automatically — press Retry only if
    you want to charge it before then.

## Potential Risks & Review Items

- The message is still a display of redirect parameters, so the nonce-ignore
  annotations stay. Nothing from the request is echoed: the reason is matched
  against the known set and the id is cast to int, so an unknown reason falls
  through to a generic sentence rather than printing the supplied value.
- `blocking_reason()` is public because the handler and the notice both need
  it. It is pure, so it stays directly testable.
- The wording is longer than before. That is the fix: the old one was short
  because it was not saying anything specific. It remains a single sentence.
- A unit test cannot reach `wp_date()` or the site timezone, so the notice text
  is pinned by direct reflection on `skipped_message()`, and the rendering was
  confirmed on a live install.
@wzul
wzul merged commit 319cca1 into main Sep 25, 2026
7 checks passed
@wzul
wzul deleted the fix/retry-blocker-reasons branch September 25, 2026 08:02
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