Skip to content

Store a trial that has already ended as expired, not active - #1483

Merged
helpcodeai merged 5 commits into
mainfrom
fix/trial-already-ended
Nov 3, 2026
Merged

helpcodeai merged 5 commits into
mainfrom
fix/trial-already-ended

Conversation

@helpcodeai

Copy link
Copy Markdown
Contributor

Summary

The licence site grants one trial per email address. When the same address asks again, for example from a second workspace, the site returns the old trial even if it has already ended. requestTrialLicense stored that trial as active, and the licence page said "Trial activated successfully". Then the workspace stayed blocked, and the row stayed active until the hourly cron marked it expired.

Seen on Cloud on 2026-11-02 at 17:24 UTC.

Changes

  • requestTrialLicense stores a returned trial whose expiresAt is in the past as expired. The guard then shows "trial ended" with the plans, and the repair cron does not ask for that workspace again, because it now holds a licence.
  • It then throws TrialAlreadyEndedError: "The free trial for this email has already ended. Choose a plan to continue." The licence page's Start trial button shows this message instead of a false success. Email verification and social sign-up only log it, as before for any trial failure.
  • On self-hosted, an ended trial is not set as the instance licence key.
  • A running trial is handled exactly as before.

Cloud and self-hosted: both use this path. The only change is for a trial that has already ended.

Type

  • Bug fix

Testing

  • Added/updated unit tests (license-trial.service.spec.ts: an ended trial is stored as expired and throws, and is not set as the instance key; a running trial is still active)

In packages/backend, after npx prisma generate:

  • npx jest --maxWorkers=4 src/license: 14 suites, 241 tests passed.
  • npx jest --maxWorkers=4 src/auth: 30 suites, 470 tests passed.
  • npx eslint on the two changed files: clean.
  • npx tsc --noEmit -p tsconfig.json: no errors in the changed files. The only errors were in File Search modules (picomatch, @aws-sdk/client-s3, basic-ftp, ssh2), because the local node_modules came from an older checkout. CI runs the full check.

Checklist

  • My code follows the existing code style
  • I have tested my changes locally
  • This PR has a descriptive title

@helpcodeai
helpcodeai enabled auto-merge (squash) November 3, 2026 12:21
@helpcodeai
helpcodeai merged commit fb16cc0 into main Nov 3, 2026
14 checks passed
@helpcodeai
helpcodeai deleted the fix/trial-already-ended branch November 3, 2026 13:40
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant