Skip to content

fix(#135): revoke entitlements immediately on plan downgrade#136

Merged
Ayushh-Sharmaa merged 1 commit into
Ayushh-Sharmaa:mainfrom
Nagajyothi-tammisetti:fix/entitlement-leak-on-plan-downgrade
Jun 4, 2026
Merged

fix(#135): revoke entitlements immediately on plan downgrade#136
Ayushh-Sharmaa merged 1 commit into
Ayushh-Sharmaa:mainfrom
Nagajyothi-tammisetti:fix/entitlement-leak-on-plan-downgrade

Conversation

@Nagajyothi-tammisetti

@Nagajyothi-tammisetti Nagajyothi-tammisetti commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Program: NSoC'26

Description

Fixes the entitlement leak where downgraded users retained higher-tier
feature access until the next billing cycle boundary. The entitlement
engine now recalculates immediately on plan downgrade via an event-driven
approach with zero coupling between layers.

Changes

File Role
lib/plans.ts Single source of truth — tier levels and feature lists
lib/entitlements.ts Pure helpers — hasFeature, isDowngrade, getEntitlementsForPlan
lib/subscriptions.ts Emits subscription.downgraded whenever newTier < oldTier
lib/entitlementSync.ts Subscribes to event, recalculates entitlements immediately
__tests__/entitlementDowngrade.test.ts Asserts revocation < 1s, upgrade/same-plan don't fire event

Checklist

Closes #135

@vercel

vercel Bot commented Jun 4, 2026

Copy link
Copy Markdown

@Nagajyothi-tammisetti is attempting to deploy a commit to the ayushh-sharmaa's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🎉 Welcome, @Nagajyothi-tammisetti! This is your first PR to GSF — amazing!

Here's what happens next:

📋 Our 3-Stage Review Pipeline

Stage What Who
Stage 1 Automated checks (validation, DCO, size labeling) 🤖 GitHub Actions
Stage 2 Code review 👩‍💻 A mentor
Stage 3 Final approval 🏛️ Project Admin

✅ Checklist before we start

  • Your PR links an issue with Closes #N
  • All commits have Signed-off-by: (see DCO)
  • You've tested your changes locally

⏱️ Expected Timelines

  • Stage 1: Within minutes
  • Stage 2 (mentor review): 24–72 hours
  • Stage 3 (admin review): 24–48 hours after mentor approval

📖 See CONTRIBUTING.md for full details. We appreciate your contribution! 💙

@github-actions github-actions Bot added priority:high High priority — urgent needs-pr-fixes PR requires fixes before proceeding labels Jun 4, 2026
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

PR Validation Failed

The following required elements are missing:

  • Closes #<issue-number> reference
  • Non-empty Description section
  • Checklist section with at least one checkbox

Please edit your PR description to include them, then push a new commit or re-save the description. 📝

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

⚠️ @Nagajyothi-tammisetti — your PR body doesn't declare a program (GSSoC/NSoC/General). Please update your description to include the program name. 📝

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

⚠️ DCO Sign-off Missing

The following commit(s) are missing a Signed-off-by: line:

How to fix:

# For the last commit:
git commit --amend --signoff
git push --force-with-lease

# For multiple commits (replace N with the count):
git rebase HEAD~1 --signoff
git push --force-with-lease

By signing off, you certify that you have the right to submit this contribution under the project's license. See DCO. ✍️

@github-actions github-actions Bot added dco-missing One or more commits missing Signed-off-by size/L 150–499 lines changed labels Jun 4, 2026
…grade

Signed-off-by: Nagajyothi-tammisetti <nagajyothitammisetti@gmail.com>
@Nagajyothi-tammisetti Nagajyothi-tammisetti force-pushed the fix/entitlement-leak-on-plan-downgrade branch from f49b4f4 to 856e918 Compare June 4, 2026 04:02
@github-actions github-actions Bot added dco-ok All commits have DCO sign-off size/L 150–499 lines changed and removed size/L 150–499 lines changed dco-missing One or more commits missing Signed-off-by labels Jun 4, 2026
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

PR Validation Failed

The following required elements are missing:

  • Closes #<issue-number> reference
  • Non-empty Description section
  • Checklist section with at least one checkbox

Please edit your PR description to include them, then push a new commit or re-save the description. 📝

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

⚠️ @Nagajyothi-tammisetti — your PR body doesn't declare a program (GSSoC/NSoC/General). Please update your description to include the program name. 📝

@github-actions github-actions Bot added pr-valid PR passed all validation checks invalid-program-declaration Declared program doesn't match labels and removed needs-pr-fixes PR requires fixes before proceeding labels Jun 4, 2026
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Program Mismatch — Your PR declares NSOC26 but the nsoc26 label is not applied.

Please ensure the correct program label is on your PR, or update your PR description to match. A maintainer can also fix this. 🏷️

@Ayushh-Sharmaa Ayushh-Sharmaa merged commit b62db48 into Ayushh-Sharmaa:main Jun 4, 2026
17 of 19 checks passed
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Program Mismatch — Your PR declares NSOC26 but the nsoc26 label is not applied.

Please ensure the correct program label is on your PR, or update your PR description to match. A maintainer can also fix this. 🏷️

@github-actions github-actions Bot added the mentor:Ayushh-Sharmaa Reviewed/assigned by mentor Ayushh-Sharmaa label Jun 4, 2026
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

ℹ️ No mentor:* label was found on this PR at merge time. The fallback label mentor:Ayushh-Sharmaa has been applied automatically. If this is incorrect, a maintainer can update it. 🏷️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-ok All commits have DCO sign-off invalid-program-declaration Declared program doesn't match labels Level 3 mentor:Ayushh-Sharmaa Reviewed/assigned by mentor Ayushh-Sharmaa NSoC'26 pr-valid PR passed all validation checks priority:high High priority — urgent size/L 150–499 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

plan downgrade entitlement leak (bug)

2 participants