Repository navigation
feat(api): enforce time-based subscription entitlement - #28
Merged
Merged
Conversation
iamparmjeet
force-pushed
the
feat/subscription-entitlement
branch
from
September 19, 2026 16:39
b12980c to
a08f000
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub. 4 Skipped Deployments
|
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.
Summary
Time-based subscription entitlement. Migration
0045_subscription_entitlement(hand-authored, function-only, no schema drift) replaces
rently_assert_tenant_seatandrently_assert_pending_invite_quotaso the planlimit is entitlement-gated. Stacked base for the cancel and correction slices.
Rollback tag
pre-subscription-entitlement.its plan limit while
expiredis not true andcurrent_period_endis null orin the future.
the legacy
TENANT_LIMITfallback.getOwnerEntitlementintenant-limit.tsmirrors the SQL predicates(compared in SQL against
now() at time zone 'utc', sincecurrent_period_endis a zone-less UTC-wall-clocktimestamp).tenantPlanLimitError/pendingInviteQuotaErrornow report "subscription hasended" instead of "plan limit of 0".
pausedinside a paid period staysentitled;
expired = truedenies even mid-period.Design record:
docs/Decisions.md2026-09-17 — "Time-based subscriptionentitlement and cancel-at-period-end".
Verification
bun run db:generate— no driftbun run check-types --force— 6/6bun run db:migrate:testsubscription-entitlement.test.ts(10) + invite suite 25/25bun run build:adminBehavior change (open design item)
A lapsed owner gets limit 0 and cannot add tenants or send invites. Existing
tenants and owner access are unaffected — only growth is frozen.
Owner wants a grace period where growth stays frozen but the account keeps a
limited feature set, rather than a hard cut at
current_period_end. That is adesign decision, not part of this slice: it needs a grace window length, the
concrete limited-feature list, and (if the window defers the growth freeze) a
change to both SQL functions and
getOwnerEntitlementtogether. Land it as afollow-up slice on this branch, or amend before merge.
Not included