feat(subscription): temporarily disable subscription gating
Subscriptions aren't a shipping feature for now. Make
GET /api/subscription/status/ return a "limitations disabled" / pro-tier
stub at the top of the function with no DB or Redis work:
- tier="pro"
- is_active=true
- limitations_enabled=false (master kill switch in SubscriptionHelper.kt;
every canCreate* check short-circuits true)
- usage=0 across the board
- limits map present with empty entries (all-nil = unlimited per the KMM
model convention) so client tier-lookups don't NPE
The original implementation is preserved verbatim as the unexported
getSubscriptionStatusFromDB method. Re-enabling is a one-line change:
swap GetSubscriptionStatus's body to call s.getSubscriptionStatusFromDB.
Two integration tests in subscription_is_free_test.go assert the original
"limitations actually apply based on settings/IsFree" behavior. They now
t.Skip with the same TEMPORARILY DISABLED marker pointing back to the
service comment. CheckLimit-based tests in the same file still pass
because that codepath is unchanged.
Perf side effect: POST/GET on this route drops to ~1ms (just JSON marshal),
removing 4-5 serial Neon RTTs from every cold call. Was the slowest endpoint
in the live dashboard (~213ms p95 / ~480ms after the pod roll).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -171,6 +171,11 @@ func (app *SubscriptionTestApp) makeAuthenticatedRequest(t *testing.T, method, p
|
||||
// TestIntegration_IsFreeBypassesLimitations tests that users with IsFree=true
|
||||
// see limitations_enabled=false regardless of global settings
|
||||
func TestIntegration_IsFreeBypassesLimitations(t *testing.T) {
|
||||
// TEMPORARILY DISABLED — Subscriptions: GetSubscriptionStatus now returns
|
||||
// a limitations_enabled=false stub for everyone, so the assertion that a
|
||||
// normal user sees limitations_enabled=true (per EnableLimitations setting)
|
||||
// no longer holds. Remove this skip when GetSubscriptionStatus is restored.
|
||||
t.Skip("subscription feature disabled — see subscription_service.go TEMPORARILY DISABLED")
|
||||
app := setupSubscriptionTest(t)
|
||||
|
||||
// Register and login a user
|
||||
@@ -289,6 +294,10 @@ func TestIntegration_IsFreeBypassesCheckLimit(t *testing.T) {
|
||||
// TestIntegration_IsFreeIndependentOfTier tests that IsFree works regardless of
|
||||
// the user's subscription tier
|
||||
func TestIntegration_IsFreeIndependentOfTier(t *testing.T) {
|
||||
// TEMPORARILY DISABLED — Subscriptions: GetSubscriptionStatus is stubbed,
|
||||
// so the Pro+!IsFree case (which would normally return limitations_enabled=true)
|
||||
// is no longer reachable. Remove this skip when the feature is restored.
|
||||
t.Skip("subscription feature disabled — see subscription_service.go TEMPORARILY DISABLED")
|
||||
app := setupSubscriptionTest(t)
|
||||
|
||||
// Register and login a user
|
||||
|
||||
Reference in New Issue
Block a user