Skip to content

[wip] Setup wizard#1211

Closed
brendan-kellam wants to merge 18 commits into
mainfrom
bkellam/setup-wizard
Closed

[wip] Setup wizard#1211
brendan-kellam wants to merge 18 commits into
mainfrom
bkellam/setup-wizard

Conversation

@brendan-kellam
Copy link
Copy Markdown
Contributor

No description provided.

brendan-kellam and others added 18 commits April 15, 2026 17:27
* wip

* remove unused hook

* Add collapse sidebar button

* refactor settings into sidebar as a override context

* chat thread styling

* notification dot

* improved rendering

* fix light mode

* imporved api key page

* add chats page

* not found nit

* guest sidebar footer

* add tooltip for sidebar collapse button

* nit

* onboard nit

* fix permission sync banner

* what's new

* profile settings

* home view settings

* general settings

* remove shadow

* changelog

* feedback
* wip on service ping

* add concept of License to the database and wire it into the enitlements system

* wip on e2e checkout flow

* basic card to display current plan

* store activation code at rest

* add manage subscription button

* wip on lighthouse client

* wip on lighthouse client

* remove the concept of a plan and just rely on entitlements at the app layer

* fix sidebar

* add temporary refresh license button

* clarified org availability design

* entitlements naming nit

* remove concept of a GUEST user

* remove anonymous-access entitlement

* change offline license to support optional seats

* handle license validation for all paths

* refactor some actions

* add explicit service ping calls to user <> organization update paths

* fix refresh bug with sidebar

* add billing details card

* fix invite redemption when user already a member

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>

* wip on license card

* further wip on license card / activaction code card

* add recent invoices UI

* nit on seats terminology

* feat(web): surface subscription cancellation on license card

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>

* feat(web): add offline license card to settings

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>

* feat(web): banner system for license + permission sync

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>

* handle failure case where lighthouse cannot be reached

* chore(web): mirror lighthouse trial + checkout schema changes

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>

* feat(web): trial banner + plumbing

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>

* add badges to invoice cards

* add basic billing docs

* refactor(lighthouse): throw ServiceErrorException on ping failure

syncWithLighthouse previously swallowed ping errors with a log and early
return, which masked real problems. Flip the model: on a lighthouse
ServiceError response, throw ServiceErrorException. The sew() middleware
already knows how to marshal that into an API response for user-initiated
paths.

Callers fall into two camps:
- Propagate (user-initiated): activateLicense and refreshLicense. The
  existing try/catch in activateLicense now correctly rolls back the
  license row when lighthouse rejects the activation code; refreshLicense
  lets the throw propagate so the UI surfaces a toast.
- Swallow explicitly (background / side-effect): license page load, the
  24h cron, user-approval, and signup paths all wrap with
  `.catch(() => { /* ignore */ })`. These happen as a side effect of
  other successful operations; a ping failure shouldn't block them.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feedback

* fix tests

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* wip on reactivation flow

* add banner for license bound to another instance error case
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 19, 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: 357a5402-53d8-4a99-b81a-48c761d718b8

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/setup-wizard

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.

@github-actions
Copy link
Copy Markdown
Contributor

License Audit

⚠️ Status: PASS

Metric Count
Total packages 2092
Resolved (non-standard) 20
Unresolved 0
Strong copyleft 0
Weak copyleft 38

Weak Copyleft Packages (informational)

Package Version License
@img/sharp-libvips-darwin-arm64 1.0.4 LGPL-3.0-or-later
@img/sharp-libvips-darwin-arm64 1.2.4 LGPL-3.0-or-later
@img/sharp-libvips-darwin-x64 1.0.4 LGPL-3.0-or-later
@img/sharp-libvips-darwin-x64 1.2.4 LGPL-3.0-or-later
@img/sharp-libvips-linux-arm 1.0.5 LGPL-3.0-or-later
@img/sharp-libvips-linux-arm 1.2.4 LGPL-3.0-or-later
@img/sharp-libvips-linux-arm64 1.0.4 LGPL-3.0-or-later
@img/sharp-libvips-linux-arm64 1.2.4 LGPL-3.0-or-later
@img/sharp-libvips-linux-ppc64 1.2.4 LGPL-3.0-or-later
@img/sharp-libvips-linux-riscv64 1.2.4 LGPL-3.0-or-later
@img/sharp-libvips-linux-s390x 1.0.4 LGPL-3.0-or-later
@img/sharp-libvips-linux-s390x 1.2.4 LGPL-3.0-or-later
@img/sharp-libvips-linux-x64 1.0.4 LGPL-3.0-or-later
@img/sharp-libvips-linux-x64 1.2.4 LGPL-3.0-or-later
@img/sharp-libvips-linuxmusl-arm64 1.0.4 LGPL-3.0-or-later
@img/sharp-libvips-linuxmusl-arm64 1.2.4 LGPL-3.0-or-later
@img/sharp-libvips-linuxmusl-x64 1.0.4 LGPL-3.0-or-later
@img/sharp-libvips-linuxmusl-x64 1.2.4 LGPL-3.0-or-later
@img/sharp-wasm32 0.33.5 Apache-2.0 AND LGPL-3.0-or-later AND MIT
@img/sharp-wasm32 0.34.5 Apache-2.0 AND LGPL-3.0-or-later AND MIT
@img/sharp-win32-arm64 0.34.5 Apache-2.0 AND LGPL-3.0-or-later
@img/sharp-win32-ia32 0.33.5 Apache-2.0 AND LGPL-3.0-or-later
@img/sharp-win32-ia32 0.34.5 Apache-2.0 AND LGPL-3.0-or-later
@img/sharp-win32-x64 0.33.5 Apache-2.0 AND LGPL-3.0-or-later
@img/sharp-win32-x64 0.34.5 Apache-2.0 AND LGPL-3.0-or-later
axe-core 4.10.3 MPL-2.0
lightningcss 1.32.0 MPL-2.0
lightningcss-android-arm64 1.32.0 MPL-2.0
lightningcss-darwin-arm64 1.32.0 MPL-2.0
lightningcss-darwin-x64 1.32.0 MPL-2.0
lightningcss-freebsd-x64 1.32.0 MPL-2.0
lightningcss-linux-arm-gnueabihf 1.32.0 MPL-2.0
lightningcss-linux-arm64-gnu 1.32.0 MPL-2.0
lightningcss-linux-arm64-musl 1.32.0 MPL-2.0
lightningcss-linux-x64-gnu 1.32.0 MPL-2.0
lightningcss-linux-x64-musl 1.32.0 MPL-2.0
lightningcss-win32-arm64-msvc 1.32.0 MPL-2.0
lightningcss-win32-x64-msvc 1.32.0 MPL-2.0
Resolved Packages (20)
Package Version Original Resolved Source
@react-grab/cli 0.1.23 UNKNOWN MIT LICENSE file in node_modules
@react-grab/cli 0.1.29 UNKNOWN MIT LICENSE file in node_modules
@react-grab/mcp 0.1.29 UNKNOWN MIT LICENSE file in node_modules
@sentry/cli 2.58.5 FSL-1.1-MIT FSL-1.1-MIT npm registry (registry.npmjs.org/@sentry/cli/2.58.5)
@sentry/cli-darwin 2.58.5 FSL-1.1-MIT FSL-1.1-MIT npm registry (matches parent @sentry/cli)
@sentry/cli-linux-arm 2.58.5 FSL-1.1-MIT FSL-1.1-MIT npm registry (matches parent @sentry/cli)
@sentry/cli-linux-arm64 2.58.5 FSL-1.1-MIT FSL-1.1-MIT npm registry (matches parent @sentry/cli)
@sentry/cli-linux-i686 2.58.5 FSL-1.1-MIT FSL-1.1-MIT npm registry (matches parent @sentry/cli)
@sentry/cli-linux-x64 2.58.5 FSL-1.1-MIT FSL-1.1-MIT npm registry (matches parent @sentry/cli)
@sentry/cli-win32-arm64 2.58.5 FSL-1.1-MIT FSL-1.1-MIT npm registry (matches parent @sentry/cli)
@sentry/cli-win32-i686 2.58.5 FSL-1.1-MIT FSL-1.1-MIT npm registry (matches parent @sentry/cli)
@sentry/cli-win32-x64 2.58.5 FSL-1.1-MIT FSL-1.1-MIT npm registry (matches parent @sentry/cli)
codemirror-lang-elixir 4.0.0 UNKNOWN Apache-2.0 LICENSE file in node_modules
element-source 0.0.3 UNKNOWN MIT LICENSE file in node_modules
lezer-elixir 1.1.2 UNKNOWN Apache-2.0 LICENSE file in node_modules
map-stream 0.1.0 UNKNOWN MIT GitHub repo (github.com/dominictarr/map-stream LICENCE file)
memorystream 0.3.1 UNKNOWN MIT package.json "licenses" array (legacy format) "type": "MIT"
pause-stream 0.0.11 MIT,Apache2 MIT OR Apache-2.0 extracted from license object array ["MIT","Apache2"]
posthog-js 1.369.0 SEE LICENSE IN LICENSE Apache-2.0 LICENSE file in node_modules (Apache License 2.0)
valid-url 1.0.9 UNKNOWN MIT LICENSE file in node_modules (MIT permission text)

@mintlify
Copy link
Copy Markdown

mintlify Bot commented May 19, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
sourcebot 🟢 Ready View Preview May 19, 2026, 5:18 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

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