Repository navigation
feat(renewal): smart renewal pause below configurable usage floor (#2251) - #2328
Merged
Merged
Conversation
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). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 siblingbillingShift.tspattern: JSDoc header referencing the issue, typedRenewalPauseErrorwith stablecode+ frozendetails, validated/frozen config factory, frozenUsageSignal/RenewalPauseDecision/ batch plan, injectedmetricsandloggerhooks (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,UsageFloorErrorcarrying a stablecode, immutableUsageSignal, andbelow_floor()requiringmin_samplesbefore 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
.tsharness (native type stripping, jest shim emitted as.ts,file://imports): 18 passed / 0 failed (HARNESS_RESULT passed=18 failed=0). TheMODULE_TYPELESS_PACKAGE_JSONnotice is benign and expected for this repo layout.ml-service/app/usage/tests/test_floor.py: 7 passed / 0 failed (python -m unittest app.usage.tests.test_floor -v→OK).tools/check_secrets.py --root <changed-files>):[OK],SECRETS_EXIT=0. The repo's pre-existing findings inpnpm-lock.yamlandcontracts/**/test_snapshots/*.jsonare 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):
0xC5dD2Ea54FF138bb3f71D3466092eA31eF115868DN3pfYEvdkoTBP4oaEVvemsr98fZPhDSAbfVfmewRGQ5ivanzenteno3@gmail.comNo new wallet was created; these are the existing general addresses.