Skip to content

feat(cms): the Lumen account and billing pages in the Payload admin (LX2) - #20

Merged
ruehowl merged 1 commit into
mainfrom
orun/LX-3-account-billing
Oct 28, 2026
Merged

ruehowl merged 1 commit into
mainfrom
orun/LX-3-account-billing

Conversation

@ruehowl

@ruehowl ruehowl commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

LX2 of multi-tenant-saas-2-console (task LX-3, milestone LX2). It ports sourceplane/lumen-payload#23 and #24 (PX2 and PX3) together.

The old console's account and billing pages move into the Payload admin, behind the staff Lumen sign-in from LX1 (#19), under an Account nav group. Every staff role (admin, editor, instructor) can open them; a pending account can't.

Page Path
Profile /admin/account (display name, also written to the users row)
Security activity /admin/account/security
Organization /admin/organization
Notifications /admin/organization/notifications
Billing & plan /admin/organization/billing

These pages show the staff member's own Lumen account and organization, not an academy's.

Also in this change

  • Forms post to same-origin /lumen/* routes and land back on their page with a status. No token reaches client code.
  • Billing:
    • Upgrade goes to the provider's checkout, which returns to the billing page; one same-origin reconcile post follows.
    • Switch and cancel each sit behind a confirm step.
    • The customer portal is offered for a paid subscription.
    • Stage has no payment provider, so the page says so instead.
  • Session lookups: concurrent requests with one token share a single lookup, and a recently confirmed session survives api-edge being briefly unable to answer. The admin can't be framed by another origin.
  • identity-worker: security events are queried by the user's UUID, not the public usr_ id. Without this, the endpoint answers 503 for everyone; the same fix is in sourceplane/orun-cloud#2114.
  • api-edge: a bearer's own session, profile and security-events reads get an account rate family (60/min). Sign-in stays at 10/min.
  • Docs: CMS runbook (a new Your account section), architecture, overview; operations guide; epic status.

Verification

  • LX1 is live on stage and prod (12/12 read-only checks): the Lumen staff sign-in with no password form; password login and first-register answer 403; learner sign-in is still on; the catalogue renders at /.
  • Locally, I ran the built Worker in workerd against stage's real api-edge:
    • account pages: 23/23 (Account nav, profile saved to Lumen and the users row, security activity, organization, notifications off and back on, cross-origin and pending posts refused, signed-out redirect);
    • billing: 11/11 (plan, plans, entitlements, invoices, Upgrade's explanation on stage, the checkout return's single reconcile).
  • Test suites: tests/cms 214, tests/api-edge 411, tests/identity-worker 181.
  • Typecheck: clean for apps/cms, tests/cms and apps/identity-worker.
  • After merge: Security activity reads on stage through api-edge (today it answers 503).

Orun-Task: LX-3



Generated by Claude Code

…LX2)

The old console's account and billing pages move into the Payload admin, as
views behind the staff Lumen sign-in, for every staff role: Profile
(/admin/account), Security activity (/admin/account/security), Organization
(/admin/organization), Notifications (/admin/organization/notifications) and
Billing & plan (/admin/organization/billing), under an Account group in the
nav. Ported from sourceplane/lumen-payload#23 and #24 (PX2, PX3).

- each reads and writes the signed-in Lumen account through api-edge with
  the session cookie's bearer; forms post to same-origin /lumen/* routes and
  land back on their page with a status; no client-side token
- Upgrade starts the provider's checkout, which returns to the billing page,
  which reconciles with one same-origin form post; switch or cancel behind a
  confirm step; the customer portal for a paid subscription; where no
  provider is configured (stage) the page says so
- session lookups are shared per token, and a session api-edge confirmed in
  the last 5 minutes survives api-edge being unable to answer, until it
  expires; the admin cannot be framed by another origin
- identity-worker: security events take the user's UUID, not the public
  usr_ id, which made the endpoint answer 503 for everyone
- api-edge: a bearer's own session, profile and security-events reads get
  an `account` rate family (60/min); sign-in stays on `auth` (10/min)
- docs: runbook, architecture, overview, operations guide; epic status

Orun-Task: LX-3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013JuHbkZCjDrGgHdzCrCRqG
@ruehowl
ruehowl marked this pull request as ready for review October 28, 2026 22:09
@ruehowl
ruehowl merged commit d86124c into main Oct 28, 2026
13 checks passed
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.

2 participants