Skip to content

feat(renewal): smart renewal pause below configurable usage floor (#2251) - #2328

Merged
github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
IVANLI2412:fix/issue-2251
Nov 24, 2026
Merged

github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
IVANLI2412:fix/issue-2251

Conversation

@IVANLI2412

Copy link
Copy Markdown
Contributor

Closes #2251

Summary

Implements the smart renewal pause surface from issue #2251 in the two scoped paths, with zero new dependencies:

  • backend/src/services/renewalPause.ts — pure, dependency-free TypeScript service following the sibling billingShift.ts pattern: JSDoc header referencing the issue, typed RenewalPauseError with stable code + frozen details, validated/frozen config factory, frozen UsageSignal / RenewalPauseDecision / batch plan, injected metrics and logger hooks (no-op defaults), and fail-open behaviour when there is no signal or too few samples.
  • ml-service/app/usage/floor.py (+ package __init__.py) — standard-library-only usage-floor signal with a frozen dataclass config, UsageFloorError carrying a stable code, immutable UsageSignal, and below_floor() requiring min_samples before any pause. The ML service owns the summary; the backend worker owns the charge decision.

Behaviour covered: trailing-window summarisation, out-of-window sample exclusion, usage below/above floor, insufficient samples, active pause retention vs expiry-based resume, bounded pause duration, per-item rejection in batch plans, and invalid config/sample/pause failure modes.

No .md/.json, binaries, lockfiles or generated artifacts added. Documentation is in the JSDoc/docstrings on the code itself.

Test evidence

  • Node-26 .ts harness (native type stripping, jest shim emitted as .ts, file:// imports): 18 passed / 0 failed (HARNESS_RESULT passed=18 failed=0). The MODULE_TYPELESS_PACKAGE_JSON notice is benign and expected for this repo layout.
  • Python unit tests ml-service/app/usage/tests/test_floor.py: 7 passed / 0 failed (python -m unittest app.usage.tests.test_floor -v → OK).
  • Secret scan over all changed files (tools/check_secrets.py --root <changed-files>): [OK], SECRETS_EXIT=0. The repo's pre-existing findings in pnpm-lock.yaml and contracts/**/test_snapshots/*.json are upstream baseline and were not touched by this PR.

Payout addresses

Please send any reward for this issue to one of these general addresses (one wallet per crypto/network):

  • Base Mainnet (USDC / ETH): 0xC5dD2Ea54FF138bb3f71D3466092eA31eF115868
  • Solana (USDC / SOL): DN3pfYEvdkoTBP4oaEVvemsr98fZPhDSAbfVfmewRGQ5
  • PayPal: ivanzenteno3@gmail.com

No new wallet was created; these are the existing general addresses.

@github-actions
github-actions Bot merged commit 802233c into Smartdevs17:main Nov 24, 2026
6 of 26 checks passed
@IVANLI2412

Copy link
Copy Markdown
Contributor Author

@Smartdevs17 Las entregas de @IVANLI2412 ya están mergeadas en los PRs #2328, #2327, #2326, #2325, #2324, #2323, #2322, #2320, #2319, #2317, #2316, #2314, #2313, #2312, #2311, #2310, #2309, #2306, #2305, #2304, #2303, #2302, #2301, #2300, #2299, #2297, #2295, #2294 y #2298. Los issues vinculados siguen sin assignee; por favor asígnalos a @IVANLI2412 y confírmalos como completados para que Drips Wave contabilice los puntos (200 pts por issue).

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.

Implement smart renewal pause when usage drops below configurable floor

1 participant