Repository navigation
feat(subscription_manager): per-user trial daily caps and no-expiry mode - #116
Merged
Merged
Conversation
Public free tier: trial_duration_days=0 means no expiry. Optional per-user UTC daily caps (0 = off) for audio minutes/requests and chat requests. Hitting a daily cap sets Decision.reason=trial_daily_cap and an i18n string with minutes left today and the UTC reset time. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Extract lifetime/global/per-user daily cap helpers so reserve and authorize stay under the advisory lizard limit. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
# Conflicts: # botspot/components/new/subscription_manager/__init__.py # examples/components_examples/subscription_manager_demo/README.md # tests/components/test_subscription_manager.py
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.
Public free 20 min/day needs code (not the default). This adds optional per-user UTC daily trial caps and a no-expiry trial mode.
What
BOTSPOT_SUBSCRIPTION_MANAGER_, 0 = off):TRIAL_USER_AUDIO_MINUTES_PER_DAYTRIAL_USER_AUDIO_REQUESTS_PER_DAYTRIAL_USER_CHAT_REQUESTS_PER_DAYtrial_daily_usagedoc per user per UTC day (_id={user_id}:{YYYY-MM-DD}), incremented with atomic$inc.TRIAL_DURATION_DAYS=0means no expiry (public free tier). Default remains 7.Decision.reason=trial_daily_cap. The i18n string includes minutes left today and the UTC reset time. Existing subscribe upsell keyboard is unchanged.Tests
uv run pytest tests/components/test_subscription_manager.py— all existing tests plus:test_per_user_daily_cap_across_day_boundarytest_per_user_daily_request_capstest_trial_duration_zero_means_no_expiryruff clean. pyright clean on
botspot/components/new/subscription_manager. Full suite 262 passed, coverage 70%.Whisper env names (not the default)
For public free 20 min/day:
Lifetime totals still apply unless also set to 0 (off).
Do not merge.
🤖 Generated with Claude Code