Skip to content

lighthouse#1109

Draft
brendan-kellam wants to merge 34 commits intov5from
bkellam/lighthouse
Draft

lighthouse#1109
brendan-kellam wants to merge 34 commits intov5from
bkellam/lighthouse

Conversation

@brendan-kellam
Copy link
Copy Markdown
Contributor

@brendan-kellam brendan-kellam commented Apr 12, 2026

Offline license expired banner (owner):
image

Offline license expired banner (member):
image

Online license expired banner (owner):
image

Online license expired banner (member):
image

Permission sync banner:
image

Expiry heads up banner:
image

Invoice past due banner:
image

License stale warning banner:
image

License stale error banner (owner):
image

image

License stale error banner (member):
image

Trial banner (payment method added):
image

Trial banner (payment method not added):
image

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 12, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d685f9ec-e5ec-4c37-aafa-1d50c7ba2ca9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bkellam/lighthouse

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

brendan-kellam and others added 21 commits April 16, 2026 17:46
User was hitting a unique constraint on UserToOrg(orgId, userId) when
redeeming an invite, because onCreateUser auto-joins new signups in
self-serve mode and redeemInvite then tried to create the same row.
Make the insert idempotent via upsert so the downstream AccountRequest
and invite cleanup still runs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds cancelAt to the License model and the lighthouse ping schema, and
renders "Cancels on <date>" on the current plan card when there's no
upcoming renewal. Prefers "Next renewal" when Stripe still has an
upcoming invoice — so subscriptions scheduled to end after the next
billing cycle keep showing the renewal row.

Also makes nextRenewalAt / nextRenewalAmount nullable to match the
lighthouse response, and guards new Date() against null in servicePing.

Adds a CLAUDE.md under the lighthouse feature folder pointing at the
service repo so the two schemas stay in lockstep.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
brendan-kellam and others added 7 commits April 21, 2026 12:28
Renders a dedicated card for offline (SOURCEBOT_EE_LICENSE_KEY) licenses
showing the license id, seat cap, and expiry. When an offline license
is present, the page skips the online license lookup entirely to mirror
the precedence in entitlements.ts.

Also adds a header row with a mailto link to support and an "All plans"
shortcut to the public pricing page.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Introduces a priority-ordered, single-slot banner system under
(app)/components/banners/. A server-side resolver picks the highest-priority
banner that matches the current context (role, license state, offline
license, permission-sync status) and renders it through a shared BannerShell
that handles per-day dismissal via cookies.

Banners included:
- License expired (everyone, non-dismissible, role-aware copy)
- License expiry heads-up (owner, dismissible, 14d window, uses
  formatDistance for relative copy)
- Invoice past due (owner, non-dismissible)
- Permission sync pending (everyone, non-dismissible, migrated from the
  prior standalone component through BannerShell)

Precedence mirrors entitlements.ts: offline license is the sole source
of truth when present, so online billing state is ignored.

Also splits getValidOfflineLicense into a decode-only path so
getOfflineLicenseMetadata can surface expired licenses to the UI.

Includes bannerResolver.test.ts covering priority, audience filtering,
dismissal filtering, offline/online expiry rules, and permission sync.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds trialEnd to the ping response schema and installId / requestTrial
to the checkout request schema so types match the lighthouse service.
createCheckoutSession passes the instance's SOURCEBOT_INSTALL_ID and
defaults requestTrial to false (the existing "upgrade" button is not
a trial path).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a trial banner to the owner-facing banner stack and the
surrounding plumbing:

- Schema: License.trialEnd, License.hasPaymentMethod, Org.trialUsedAt
  (durable flag that survives license deactivation). Two migrations.
- servicePing persists trialEnd / hasPaymentMethod and flips
  Org.trialUsedAt on first trial sync.
- Trial banner (owner, dismissible, priority 25): title uses
  formatDistance ("Your trial ends in 10 days"); copy + action branch
  on hasPaymentMethod. With-PM variant links to /settings/license;
  no-PM variant opens the Stripe portal via a new
  OpenBillingPortalButton (LoadingButton + createPortalSession).
- currentPlanCard gains a "Trial ends on" fallback column for the
  trial-without-PM case (where nextRenewalAt is null).
- activationCodeCard accepts isTrialEligible and flips its checkout
  button from "Purchase a license" to "Start a free trial" when the
  org hasn't trialed yet, passing requestTrial through to the checkout
  endpoint.
- Types mirror the new lighthouse fields (trialEnd, hasPaymentMethod)
  and the checkout request additions (installId, requestTrial).

Side-trips to Stripe (portal, checkout) now append ?refresh=true so
the license resyncs on return; trial-checkout also appends
?trial_used=true so Org.trialUsedAt flips immediately (closes the UX
gap between checkout completion and activation-code entry). page.tsx
handles both params, preserves any other query params, and redirects
to a clean URL.

Also: fetchWithRetry now only retries 5xx, 408, and 429 — 4xx errors
(e.g. TRIAL_ALREADY_USED at 409) propagate immediately instead of
retrying pointlessly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant