Skip to content

test(jobs): billing/payment jobs to >=95% coverage#50

Merged
mastermanas805 merged 1 commit into
masterfrom
coverage/worker-jobs-billing-95
May 22, 2026
Merged

test(jobs): billing/payment jobs to >=95% coverage#50
mastermanas805 merged 1 commit into
masterfrom
coverage/worker-jobs-billing-95

Conversation

@mastermanas805
Copy link
Copy Markdown
Member

Summary

  • Adds billing_coverage_test.go driving every billing/payment job in internal/jobs to >=95% statement coverage: billing_reconciler.go, checkout_reconcile.go, churn_predictor.go, payment_grace_reminder.go, payment_grace_terminator.go, razorpay_webhook_prune.go, entitlement_reconciler.go.
  • Covers every state-machine transition, Razorpay client/circuit-breaker mock paths, each plan-tier arm, and per-row error branches (scan failures, rows.Err, fail-open audit inserts, circuit-open, JWT signing).
  • Two minimal source seams (churnMetaMarshal / graceReminderMetaMarshal package vars defaulting to json.Marshal) make the otherwise-unreachable defensive marshal-error guards testable.

Per-file statement coverage

File Coverage
billing_reconciler.go 97.7%
checkout_reconcile.go 96.2%
churn_predictor.go 100%
payment_grace_reminder.go 100%
payment_grace_terminator.go 95.5%
razorpay_webhook_prune.go 100%
entitlement_reconciler.go 98.8%

Remaining sub-100% lines are unreachable mid-loop ctx-cancellation re-checks and fail-open audit paths.

Test plan

  • make gate (go build + vet + go test ./... -short -count=1) green, exit 0, zero failures
  • Targeted suite TestBilling|TestCheckout|TestChurn|TestPaymentGrace|TestRazorpay|TestEntitlement passes

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

Adds billing_coverage_test.go covering every state-machine transition,
Razorpay client/breaker mock paths, per-tier arms, and error branches for
billing_reconciler, checkout_reconcile, churn_predictor, payment_grace_*,
razorpay_webhook_prune, and entitlement_reconciler.

Two minimal test seams (churnMetaMarshal / graceReminderMetaMarshal package
vars defaulting to json.Marshal) make the otherwise-unreachable defensive
marshal-error guards coverable. Remaining sub-100% lines are unreachable
ctx-cancellation re-checks and fail-open audit paths.

Per-file statement coverage: billing_reconciler 97.7%, checkout_reconcile
96.2%, churn_predictor 100%, payment_grace_reminder 100%,
payment_grace_terminator 95.5%, razorpay_webhook_prune 100%,
entitlement_reconciler 98.8%. make gate green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mastermanas805 mastermanas805 merged commit 9768e29 into master May 22, 2026
10 checks passed
@mastermanas805 mastermanas805 deleted the coverage/worker-jobs-billing-95 branch May 22, 2026 02:07
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