feat: implement subscription limit for users - #2231
Merged
Merged
Conversation
- Add `ErrUserMaxSubscriptions` to `lib/backendtypes/types.go` to signal when a user has reached their subscription limit. - Add `ErrSubscriptionLimitExceeded` to `lib/gcpspanner/saved_search_subscription.go` for the database layer. - Update `searchConfig` in `lib/gcpspanner/client.go` to include `maxSubscriptionsPerUser`, defaulting to 25. - Update `createSavedSearchSubscription` in `lib/gcpspanner/saved_search_subscription.go` to enforce the subscription limit before creation. - Update `CreateSavedSearchSubscription` adapter in `lib/gcpspanner/spanneradapters/backend.go` to map the database limit error to the backend type error. - Update `CreateSubscription` handler in `backend/pkg/httpserver/create_subscription.go` to return a 403 Forbidden status when the limit is exceeded similar to the error and status for the limit for CreateSavedSearch. - Update frontend component `ManageSubscriptionsDialog` in `frontend/src/static/js/components/webstatus-manage-subscriptions-dialog.ts` to gracefully handle the error and display a user-friendly message. - Add tests covering the limit logic in: - `backend/pkg/httpserver/create_subscription_test.go` - `lib/gcpspanner/saved_search_subscription_test.go` - `lib/gcpspanner/spanneradapters/backend_test.go` - `frontend/src/static/js/components/test/webstatus-manage-subscriptions-dialog.test.ts`
jcscottiii
requested review from
DanielRyanSmith,
jrobbins,
neilv-g and
szy196
February 5, 2026 17:00
DanielRyanSmith
approved these changes
Feb 5, 2026
DanielRyanSmith
left a comment
Collaborator
There was a problem hiding this comment.
I'll have to use my 25 subscriptions wisely! 😉
Closed
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.
ErrUserMaxSubscriptionstolib/backendtypes/types.goto signal when a user has reached their subscription limit.ErrSubscriptionLimitExceededtolib/gcpspanner/saved_search_subscription.gofor the database layer.searchConfiginlib/gcpspanner/client.goto includemaxSubscriptionsPerUser, defaulting to 25.createSavedSearchSubscriptioninlib/gcpspanner/saved_search_subscription.goto enforce the subscription limit before creation.CreateSavedSearchSubscriptionadapter inlib/gcpspanner/spanneradapters/backend.goto map the database limit error to the backend type error.CreateSubscriptionhandler inbackend/pkg/httpserver/create_subscription.goto return a 403 Forbidden status when the limit is exceeded similar to the error and status for the limit for CreateSavedSearch.ManageSubscriptionsDialoginfrontend/src/static/js/components/webstatus-manage-subscriptions-dialog.tsto gracefully handle the error and display a user-friendly message.backend/pkg/httpserver/create_subscription_test.golib/gcpspanner/saved_search_subscription_test.golib/gcpspanner/spanneradapters/backend_test.gofrontend/src/static/js/components/test/webstatus-manage-subscriptions-dialog.test.ts