Skip to content

fix(billing): stop the repair reporting already-reconciled rows - #39

Merged
EOEboh merged 1 commit into
mainfrom
fix/repair-skips-reconciled-rows
Aug 3, 2026
Merged

fix(billing): stop the repair reporting already-reconciled rows#39
EOEboh merged 1 commit into
mainfrom
fix/repair-skips-reconciled-rows

Conversation

@EOEboh

@EOEboh EOEboh commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Found while running the repair on production after #38.

The live subscription was correctly marked auto_renews=0, but re-running the repair still reported one row outstanding:

repair: 1 Paystack row(s) need repair (DRY RUN)
repair:   customer=CUS_… has no Paystack subscription
repair:     auto_renews        false -> false

The selection is provider_sub_id NOT LIKE 'SUB_%', which is permanently true for a bank-transfer payment — there is no subscription at Paystack, so a SUB_ code will never appear. Re-marking is idempotent so nothing breaks, but it means the command can never report "nothing to do", which is the signal that tells you the system is clean.

Rows already marked non-recurring are now excluded.

Also makes a zero-value hazard explicit: AutoRenews defaults to false, i.e. "does not renew". The test fixture was seeding rows that way unintentionally, which is how this surfaced. Both production write paths set it explicitly so nothing was affected, but the synthetic free subscription now sets it too rather than describing a free plan as non-renewing.

Your subscription is already correct — this is cleanup.

After marking the live subscription non-recurring, re-running the repair
still reported one row outstanding — "auto_renews false -> false" — and
would have done so on every run for ever.

The selection is provider_sub_id NOT LIKE 'SUB_%', which stays true
permanently for a bank-transfer payment: there is no subscription at
Paystack, so a SUB_ code will never appear. Harmless in effect, since
re-marking is idempotent, but it destroys the "nothing to do" signal that
says the system is clean.

A row already marked non-recurring has been reconciled, so it is now
excluded.

Also makes two zero-value hazards explicit. models.Subscription.AutoRenews
defaults to false, meaning "does not renew" — the test fixture was
seeding rows that way without intending to, which is what surfaced this.
Both production write paths set it explicitly, so nothing was affected,
but the synthetic free subscription returned for users without a row now
sets it too, rather than reporting a free plan as something that will not
renew.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Deploying hookdrop-frontend with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5060eda
Status: ✅  Deploy successful!
Preview URL: https://2636964f.hookdrop-frontend.pages.dev
Branch Preview URL: https://fix-repair-skips-reconciled.hookdrop-frontend.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown
Contributor

Deploying hookdrop with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5060eda
Status: ✅  Deploy successful!
Preview URL: https://7cc13f28.hookdrop.pages.dev
Branch Preview URL: https://fix-repair-skips-reconciled.hookdrop.pages.dev

View logs

@EOEboh
EOEboh merged commit fc757b7 into main Aug 3, 2026
6 checks passed
EOEboh added a commit that referenced this pull request Aug 3, 2026
#39)

After marking the live subscription non-recurring, re-running the repair
still reported one row outstanding — "auto_renews false -> false" — and
would have done so on every run for ever.

The selection is provider_sub_id NOT LIKE 'SUB_%', which stays true
permanently for a bank-transfer payment: there is no subscription at
Paystack, so a SUB_ code will never appear. Harmless in effect, since
re-marking is idempotent, but it destroys the "nothing to do" signal that
says the system is clean.

A row already marked non-recurring has been reconciled, so it is now
excluded.

Also makes two zero-value hazards explicit. models.Subscription.AutoRenews
defaults to false, meaning "does not renew" — the test fixture was
seeding rows that way without intending to, which is what surfaced this.
Both production write paths set it explicitly, so nothing was affected,
but the synthetic free subscription returned for users without a row now
sets it too, rather than reporting a free plan as something that will not
renew.
@EOEboh
EOEboh deleted the fix/repair-skips-reconciled-rows branch August 3, 2026 22:32
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