Skip to content

Subscription: charge_status view and interval validation - #137

Open
edwina105 wants to merge 2 commits into
stellar-sub:mainfrom
edwina105:fix/drips-edwina105-49-52
Open

edwina105 wants to merge 2 commits into
stellar-sub:mainfrom
edwina105:fix/drips-edwina105-49-52

Conversation

@edwina105

@edwina105 edwina105 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Subscription: charge_status view and interval validation, and design proposals for #49 and #52

Closes #50
Closes #51
Refs #49 (design proposal: docs/design/49-batch-charge.md)
Refs #52 (design proposal: docs/design/52-expires-at.md)

Known gap in #51: a ledger that advances far enough for an accepted interval to overflow would still fail later with Overflow. A complete fix needs a rule for that case, which is left as a follow-up.

Notes for review:

  • The code changes have not been compiled or run. Please check them in CI.
  • Maintainers: please review the two proposals and say whether to go ahead. Once agreed, the code can follow in a separate change.

🤖 Generated with Claude Code

edwina105 and others added 2 commits October 21, 2026 15:31
charge computes now + interval_ledgers with checked_add. An interval near
u32::MAX therefore made every charge fail with Overflow, although subscribe
accepted it. subscribe now refuses an interval that does not fit at the
current ledger with InvalidInterval. Tests cover the rejected case and the
largest interval that still fits, which must charge.

Not covered: a ledger that advances far enough for an accepted interval to
overflow later. Charges after that still fail with Overflow, so a full fix
needs a rule for that case and is left as a follow-up.

Closes stellar-sub#51

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
…sub#50)

Add a ChargeStatus enum (Chargeable, Paused, Cancelled, Exhausted,
TooEarly, CapWouldBeExceeded, IntervalOverflows) and a charge_status(id)
view. It runs the same checks as is_chargeable, in the same order, so
Chargeable is returned exactly when is_chargeable is true. Tests cover
each reason, and check that the two views agree in each case.

IntervalOverflows is defined but is not covered by a test, because it needs
a ledger far enough along for an interval to overflow.

Closes stellar-sub#50

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
@drips-wave

drips-wave Bot commented Oct 21, 2026

Copy link
Copy Markdown

@edwina105 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Reject intervals that can never be charged when subscribing Add a charge_status(id) view that explains why a charge would be refused

1 participant