Hosting & Pulumi
Hosting stance
Platform runs on Cloudflare (Workers, DOs, WFP dispatch namespaces, R2, KV, Queues, Workflows, Containers). Control-plane / admin SQL uses Aurora Serverless v2 Postgres reached through Hyperdrive (ADR prod-infra.md, db.md evolution from Neon).
Published apps: Workers for Platforms (ADR app-hosting-wfp.md, hosting-cloudflare.md).
Planned: drop AWS (#620, plan merged)
A plan merged on 2026-10-08 (17:07 IDT) moves every database from Aurora to Neon (behind Hyperdrive), secrets to Cloudflare Secrets Store, and Pulumi state from S3 + KMS to R2, then deletes all AWS resources in five waves, moving Pulumi state before anything is deleted. Only wave 1 code has landed so far; this page still describes today. See Drop AWS: Neon migration plan.
Wave 1 update (2026-10-08): the staging-on-Neon code is merged (#631, fix #632). Staging Hyperdrive will use Neon's direct URL once an approved allow-deletes infra.yml apply runs; until then staging still reads Aurora. See Wave 1 status.
Pulumi owns durable resources
infra/pulumi — TypeScript package (own lockfile, not a Bun workspace member). Stacks: staging, prod, and per-dev side-<name> (PR #142). State: S3 + KMS in AWS.
Rule (AGENTS.md): do not hand-create Aurora, Hyperdrive, R2, KV, queues, dispatch namespaces, DNS, Auth0 apps in console “just to unblock.” Add to the stack, preview, up. Ephemeral per-dev resources go through env:up / env:down, which drive Pulumi stacks side-<name> — not ad-hoc wrangler … create (see Side environments).
Bootstrap exceptions (accounts, state bucket, OIDC, Auth0 tenants/M2M): infra/pulumi/BOOTSTRAP.md.
GitHub Actions OIDC
CI assumes AWS roles via OIDC (infra/bootstrap/aws.sh). Two pairs of roles:
| Role | GitHub Environment | Purpose |
|---|---|---|
brilliant-gha-candidate | candidate | Pre-staging deploy to long-lived ci side env (smoke + e2e) — #222 (merged) |
brilliant-gha-staging | staging (deploy) | Worker / secrets CD |
brilliant-gha-production | production (not prod) | Worker / secrets CD |
brilliant-gha-infra-staging | infra-staging | Pulumi up staging |
brilliant-gha-infra-production | infra-production | Pulumi up prod (reviewer-gated) |
Deploy roles stay narrow. Infra roles get AdministratorAccess because the stack manages IAM — any principal that can pulumi up is effectively admin; trust is pinned to their own Environments so the deploy roles stay separate (#210, merged).
The GitHub Environment for production code deploys is named production (not prod). The IAM trust sub must be repo:DaPulse/brilliant-ai:environment:production. Using environment:prod fails OIDC at assume-role (seen on deploy run 36714441203). Trust was corrected live; bootstrap script aligned on merge (#146, merged).
Pulumi CI (.github/workflows/infra.yml)
Landed in #210 (merged; closes #150). Before this, merged infra only reached an environment if someone ran pulumi up by hand — e.g. #173’s Bedrock project/default grant landed on staging only, and the #184 secrets broker was never created on either stack.
| Trigger | What runs |
|---|---|
Push to main touching infra/pulumi/**, infra/secrets/**, or the workflow itself | Preview + up staging |
workflow_dispatch with stack: prod | Preview + apply prod behind the infra-production Environment reviewer |
workflow_dispatch with stack: staging | Preview + apply staging (same path as merge) |
Guards
- Runs only at main’s tip (checkout == trigger ==
ls-remotemain). Anupfrom behind main deletes whatever main added since (GOTCHAS). - A plan with any delete or replace fails before applying unless the dispatch sets
allow-deletes. The count comes frompulumi preview --jsonchangeSummary(infra/pulumi/ci/removals.ts), never a text grep. - No PR previews: preview runs the program with KMS decrypt and Cloudflare/Auth0 tokens, so PR code never gets them. Preview locally instead.
Shared setup: .github/actions/pulumi-setup (bun deps at root + infra/pulumi, pinned Pulumi CLI, OIDC, S3 backend login). Canonical runbook: infra/pulumi/BOOTSTRAP.md.
Gotcha — composite actions cannot read vars: GitHub’s vars (and secrets) exist only in the workflow file. A composite action that references vars (e.g. vars.AWS_ROLE_ARN) fails at load with Unrecognized named-value: 'vars' before any step runs — so the job log looks like the action never started, not an auth error. The first infra.yml run after #210 hit this. Callers must pass role-arn / aws-region (from vars.AWS_ROLE_ARN / vars.AWS_REGION) into pulumi-setup as inputs (#216, merged).
CD pipeline (#222 + #241, merged)
Exact-sha deploy on main: green verify on one 40-char sha → long-lived ci side env (Environment candidate) must pass smoke + e2e → staging → commit status brilliant/staging-verified → prod (dispatch) requires that status plus staging serving the sha. #241 removed STAGING_CD: every green main verify runs candidate then staging. Full runbook: Verify & ship.
Aurora min capacity (#395, merged)
Landed in #395 (merged 2026-10-04 by yoni-monday; refs #322): staging session reads and the OAuth callback intermittently hung ~15s and returned Hyperdrive SQLSTATE 58000, then succeeded on retry. Root cause is database wake-up, not a specific query or pool leak.
| Env | Aurora minAcu (Pulumi) | Notes |
|---|---|---|
| Staging (before #395) | 0 | Auto-pause after SecondsUntilAutoPause: 300; resume can exceed Hyperdrive’s 15s initial origin connection timeout |
| Staging + prod (after #395) | 0.5 | Same floor; staging cannot pause underneath the sign-in path |
Decision: keep shared staging at a minimum of 0.5 ACU (matching prod) so Aurora cannot auto-pause under auth. Deliberate idle-cost trade for authentication availability. No auth-mutation retries, pool-size changes, or console-created infra. Regression test: infra/pulumi/test/aurora-capacity.test.ts asserts staging and prod minAcu >= 0.5.
Ops: check CloudWatch ServerlessDatabaseCapacity on the staging cluster before diagnosing a Hyperdrive pool leak or adding retries to an auth mutation. Monorepo gotcha: gotchas/data.md (Hyperdrive). infra.yml must apply staging after this merge (minCapacity: 0 => 0.5 in-place). Close #322 only after live RDS minimum capacity is 0.5 and an authenticated request succeeds after more than the old five-minute auto-pause interval.
Admin read-only Postgres (#248, merged)
Landed in #248 (merged). Admin SQL reads go through a dedicated login role and Hyperdrive — not the master login. Every durable piece is Pulumi’s (same rule as Aurora / Hyperdrive generally):
| Piece | Owner |
|---|---|
Role brilliant_admin_ro (LOGIN only) + password | Pulumi infra/pulumi/src/admin-readonly.ts (@pulumi/postgresql, TLS, master login, superuser: false) |
Secret brilliant/<env>/admin-readonly = {ADMIN_READONLY_DATABASE_URL} | Pulumi (merged by secretIdsFor for staging/prod only, like database) |
Hyperdrive brilliant-admin-ro-<env> → cloudflare-ids key hyperdrive.ADMIN_HYPERDRIVE | Pulumi (always when the read-only URL is passed; old adminReadonlyHyperdrive flag is gone) |
| Table grants | apps/admin/readonly-role.sql, applied after migrate by scripts/deploy/admin-readonly-grants.ts (one transaction; refuses side DBs, a missing role, or SQL that alters the role) |
Staging already has the role, secret, Hyperdrive, and grants. The next staging deploy (on merge) binds admin to ADMIN_HYPERDRIVE. Prod: next prod infra up creates the role; if brilliant_admin_ro already exists there, import in two ups (import + ignoreChanges: ["password"], then a plain up) — see gotchas/deploying.md. A fresh role reads nothing until the next deploy applies grants.
Without ADMIN_HYPERDRIVE in cloudflare-ids, admin throws Missing hyperdrive entry in ids: ADMIN_HYPERDRIVE.
Secrets vs code deploy
- Pulumi: resource existence and names — applied by infra.yml (staging on merge; prod via dispatch), not by hand on every merge
secrets:push/ CD: Worker secret values from AWS Secrets Managerbun run deploy/deploy.yml: Worker code (+ conductor image when needed)
Staging custom domains (#171 + cutover #361, merged)
After marketing-site cutover step 2 (#361, merged 2026-10-03), staging custom hostnames are:
| Surface | Staging origin |
|---|---|
| Marketing site | https://brilliant.rocks |
| Studio / control plane | https://app.brilliant.rocks |
| Admin | https://admin.brilliant.rocks |
| Published apps (zone) | https://brilliant-app.rocks (*.brilliant-app.rocks → dispatch) — #412 (merged) |
Pulumi config (infra/pulumi/Pulumi.staging.yaml): domains.studio: app.brilliant.rocks, domains.site: brilliant.rocks, domains.admin unchanged; domains.apps: brilliant-app.rocks (#412, merged). Auth0 nonprod hosts include https://app.brilliant.rocks (callbacks); https://brilliant.rocks is in logoutOnlyHosts (logout return only) via #398 (merged). Smoke STAGING_URLS.controlPlaneUrl and staging health point at https://app.brilliant.rocks.
brilliant/<env>/cloudflare-ids holds origins.{studio,admin,site} (full https origins) and, when an apps zone is configured, origins.apps. The env renderer maps the base config's studio placeholder to each env's studio origin and fails closed if that string leaks into a non-staging render. Unset domains keep workers.dev fallbacks; origins.apps is absent when domains.apps is unset.
Apex handoff: custom domains use deleteBeforeReplace. The cutover apply ordered site after studio (dependsOn) so the apex was released by brilliant-control-plane before brilliant-site claimed it. #398 (merged) dropped that lasting edge — otherwise replacing the studio domain would recreate the site's. Plans that replace still need allow-deletes on infra.yml.
Marketing site origins: Pulumi environmentOrigins publishes origins.site (custom domain if set, else brilliant-site.<sub>.workers.dev). Site Worker vars must come from these origins (contract site-vars-from-origins) — never from the shared studio string replacement. Control plane gets SITE_ORIGIN / SITE_COOKIE_DOMAIN after that replacement (contract site-fronts-studio-only-on-a-subdomain). Merged #387 makes a missing origins.site fail early: writeRenderedConfigs refuses before writing any file (contract canonical-render-requires-site-origin), and deploy.ts throws on canonical envs (no more skip-with-warning). See Cutover hardening · Marketing site — Cutover step 2.
Live attach: code is on main; the lead still dispatches infra.yml with allow-deletes=true then lets deploy.yml render the new ids (or dispatches deploy for the merge sha). Everyone is signed out once (__Host- cookie was on the old host).
Prod custom domains (#226 + cutover #388, merged)
Moving to brilliant.ai (#831, merged; cutover pending)
#831 merged on 2026-10-12. main now targets brilliant.ai, app.brilliant.ai, admin.brilliant.ai and demo.brilliant.ai, with 308s from the old hosts, so the Pulumi.prod.yaml and targets.ts values below describe the pre-merge config. The itsbrilliant.ai hosts in this table stay live until the prod infra apply and deploy run, which wait on the preflight in #832 (open). See Move prod public domains to brilliant.ai.
After marketing-site prod domain flip (#388, merged 2026-10-04; stacked on #387; mirrors staging #361), prod custom hostnames are (#226 initial custom domains + #388 site/studio split). The itsbrilliant.ai zone is registered and active in the prod Cloudflare account. workers.dev origins remain as Auth0 fallbacks.
| Surface | Prod origin |
|---|---|
| Marketing site | https://itsbrilliant.ai |
| Studio / control plane | https://app.itsbrilliant.ai |
| Admin | https://admin.itsbrilliant.ai |
| Published apps (zone) | https://brilliant-app.ai (*.brilliant-app.ai → dispatch) — #412 (merged) |
Pulumi config (infra/pulumi/Pulumi.prod.yaml): domains.studio: app.itsbrilliant.ai, domains.site: itsbrilliant.ai, domains.admin unchanged; domains.apps: brilliant-app.ai (#412, merged). Auth0 prod hosts include https://app.itsbrilliant.ai (studio callbacks) plus admin and workers.dev; https://itsbrilliant.ai is in logoutOnlyHosts via #398 (merged). PRODUCTION_URLS.controlPlaneUrl in scripts/env/lib/targets.ts → https://app.itsbrilliant.ai (deploy.yml’s prod /health check). Those domains become prod’s origins in brilliant/prod/cloudflare-ids; CONTROL_PLANE_URL / SITE_ORIGIN / site vars already render from origins (#387).
Still not in scope: conductor preview host on a custom domain. Published-app wildcards are not on *.itsbrilliant.ai / *.brilliant.rocks — they live on the separate apps zones below.
Prod cutover rollout (#388)
Config is on main; the live domain attach still needs lead infra + deploy. Full product checklist: Marketing site — Prod cutover.
- Before/alongside flip:
infra.ymlprod withallow-deletessocloudflare-idspublishesorigins.site(workers.dev first; no user-visible change).ci/removals.tscounts thecloudflare-ids-versionreplace as a removal. deploy.ymlproduction → site onbrilliant-site.brilliant-ai-production.workers.dev.- Quiet-time flip:
infra.ymlprodallow-deletes(replacedomain-studio, createdomain-site, update Auth0, replacecloudflare-ids), thendeploy.ymlproduction at a staging-verified sha. Everyone is signed out once; conductor deploy evicts running turns. - Live checks: apex HTML; 308s for studio prefixes; sign-in on
app.; landing →/start→ build; preview/Code/publish; logout → apex.
secrets:push (any CD deploy) sets conductor/workflows CONTROL_PLANE_URL from origins.studio (contract control-plane-url-from-studio-origin). A hand-edit of the stored key in brilliant/prod is ignored. A custom domain also needs its Worker script already deployed and the zone active in the same account (GOTCHAS).
Rollback (two applies)
A plain revert in one apply fails: Pulumi deletes a removed resource at the end of the update, so studio would reclaim the apex while domain-site still holds it.
- Remove only
domains.sitefromPulumi.prod.yaml, merge,infra.ymlprodallow-deletes— deletesdomain-site, frees the apex. - Set
domains.studioback toitsbrilliant.ai, reverttargets.ts, merge,infra.ymlprodallow-deletes+ redeploy.
See Marketing site — Prod cutover rollback.
Move prod public domains to brilliant.ai (#831, merged)
Status: merged, not applied yet. Opened 2026-10-12 14:32 IDT and merged 15:12 IDT by yoni-monday (branch domain-cutover, merge commit 7149b6c). No production preview, apply or staging redirect rehearsal had run at merge. The prod infra apply and deploy are gated on the preflight issue #832 (open), so the itsbrilliant.ai hosts above stay live until cutover. Rollout runbook: docs/domain-cutover.md.
| Surface | New host | Old host (308 redirect) |
|---|---|---|
| Marketing site | brilliant.ai | itsbrilliant.ai |
| Studio | app.brilliant.ai | app.itsbrilliant.ai |
| Admin | admin.brilliant.ai | admin.itsbrilliant.ai |
| Template demos | demo.brilliant.ai | demo.itsbrilliant.ai |
- What changes: prod Pulumi domains, Auth0 callbacks, logout and branding, and deploy targets. Old Auth0 URLs stay listed during the transition. The Auth0 tenant stays
brilliant-prod.us.auth0.com. - Redirects: exact-host rules on the four old hosts only (not all subdomains), 308 so paths, queries and OAuth/MCP POSTs survive (a 301 can turn POSTs into GETs). Redirect DNS is created only after the old custom domains release their names.
- Unchanged:
brilliant-app.ai(published apps must not share the studio's registrable domain) andsecrets.itsbrilliant.ai(the bootstrap/Access endpoint CI uses for both stacks). Keep the old zone and registration; the redirects and secrets Worker need them. Database, published-app domain and encryption salt are unchanged. - Indexing: only prod on
https://brilliant.aibecomes indexable. Staging, side envs and old or fallback origins stay noindex. - Admin health probe: deploy now checks admin health on its stable
workers.devhost (all three env aliases), somainstays deployable before the separate domain apply. - Where it lives:
infra/pulumi/Pulumi.prod.yaml(domains and Auth0 URLs), newinfra/pulumi/src/domain-redirects.ts(old-host 308 rules and DNS),infra/pulumi/src/demo.ts,scripts/env/lib/targets.tsandscripts/env/lib/render.ts(prod URLs and indexing), with regression tests ininfra/pulumi/test/domain-cutover.test.ts. - User impact: cookies and storage can't cross registrable domains, so everyone signs in again and an in-flight login, connect or demo may need restarting. MCP clients must switch to the new URL and reauthorize.
One-way door after cutover
Permanent 308s can be cached, so a code rollback does not undo the domain move. This is a cutover window, not a zero-downtime dual-host rollout. Restoring the old custom domains needs a reviewed Pulumi change that releases the redirect DNS first.
Rollout order (from the runbook): before apply, confirm brilliant.ai is an active zone in the prod Cloudflare account with TLS for apex, app, admin and demo; the prod token covers both zones plus Zone > Single Redirect > Edit on itsbrilliant.ai; adopt any existing old-zone redirect ruleset into Pulumi; audit external OAuth allowlists (Composio and custom clients), webhooks and MCP URLs. After the merge, let the same SHA pass staging, dispatch infra.yml stack=prod with allow-deletes=false, review the four custom-domain replacements, rerun with allow-deletes=true, and immediately dispatch deploy.yml environment=production for that SHA (the secrets push is required so conductor and workflows get the new CONTROL_PLANE_URL). Live checks include https://app.brilliant.ai/health, sign-in and logout, canonical and og:url on brilliant.ai, 308s with path and query from each old host, an MCP/OAuth POST, a publish plus sign-in on brilliant-app.ai, a demo with Turnstile, and the unchanged secrets endpoint.
Preflight evidence (#832): confirm the brilliant.ai zone, TLS and no conflicting parking records (keep mail and secrets/bootstrap records); confirm token coverage and adopt any existing http_request_dynamic_redirect entrypoint; run a reviewed throwaway staging redirect rehearsal through Pulumi from clean main that proves 308 path, query and POST preservation; attach the prod preview from infra.yml with allow-deletes=false, expecting four custom-domain replacements, one ruleset, four DNS records and Auth0/Turnstile updates, and stop if Turnstile would replace or rotate keys or anything else unexpected would be replaced or deleted; audit OAuth/Composio callbacks, webhook, ad and invitation links, and MCP issuer/client config; inspect www.itsbrilliant.ai (NXDOMAIN today) and historical links; pick the staging-verified SHA and plan the window and partial-apply recovery (fix and rerun the reviewed config rather than blind revert). After cutover, attach the runbook live-check evidence to the issue.
Published apps zone (#412, merged)
Landed in #412 (merged 2026-10-04 by yoni-monday; closes #407; part of #305). Published apps get a registrable domain of their own, one subdomain per app — not a wildcard under the studio or marketing zone.
| Env | domains.apps | Wildcard route |
|---|---|---|
| Staging | brilliant-app.rocks | *.brilliant-app.rocks/* → brilliant-dispatch |
| Prod | brilliant-app.ai | *.brilliant-app.ai/* → brilliant-dispatch |
Why a separate zone: model-authored app code on a subdomain of the studio’s registrable domain could set cookies the studio reads, and apps on one shared origin can read each other’s storage. Nothing else lives on the apps zone, so the wildcard route cannot catch a platform host.
Pulumi (when domains.apps is set):
| Piece | Behaviour |
|---|---|
| Zone | Registrar purchase listed in BOOTSTRAP.md (same class as brilliant.rocks / itsbrilliant.ai) — not created or imported by Pulumi. Zones must already be active in the right account. |
| DNS | Proxied originless AAAA *.<apps> 100:: |
| Route | Workers route *.<apps>/* → script brilliant-dispatch (zone id looked up by name) |
cloudflare-ids | Gains origins.apps = https://<apps> (absent when unset; contract cloudflare-ids-shape) |
| Isolation | Contract apps-domain-never-shares-studio-registrable-domain: program throws before creating anything if domains.apps shares a registrable domain with studio, admin, or site |
Companion (dispatch host mode): #413 (merged 2026-10-04; part of #408 until staging checks) serves each app on <script>.<APPS_DOMAIN> when origins.apps is present, redirects document navigations off the shared path-mode host, and keeps side envs in path mode. Until infra applies the #412 zone resources, x.brilliant-app.rocks reaches dispatch without host resolution ("no app"). Full rules: Dispatch — Host mode.
Ops after #412 merge: ids replace makes infra.yml stop by design — re-run staging with allow-deletes. Then verify host mode (#413 on main) on staging (<script>.brilliant-app.rocks). See Dispatch.
Cutover hardening (#387, merged)
Landed in #387 (merged 2026-10-04 by yoni-monday; blocks of #370; prerequisite for prod cutover #304).
| Piece | Behaviour |
|---|---|
CONTROL_PLANE_URL push | From cloudflare-ids origins.studio — see Secrets — CONTROL_PLANE_URL. |
Health probes (release-manifest.ts) | Control-plane /health uses the Worker's workers.dev host (STAGING_WORKERS_DEV_URLS / PRODUCTION_WORKERS_DEV_URLS), not the custom domain. After a cutover the old custom domain answers for the marketing site. |
Studio asset carry-forward (deploy.ts) | Same: fetch the previous asset-manifest.json from the control plane's workers.dev origin on canonical envs (the apex has no studio manifest). |
Missing origins.site | writeRenderedConfigs refuses before writing any file (contract canonical-render-requires-site-origin); deploy.ts also throws on canonical envs (was a ::warning:: skip that kept CD green while the apex served a stale site). |
BASE_STUDIO_ORIGIN | https://app.brilliant.rocks (staging studio), not the site apex. |
Verify site-build | Prerenders all site pages (~9 s) so a throwing page fails before merge — Verify & ship. |
Rollout note: #388 domain-flip code is on main. The lead still must run infra.yml prod with allow-deletes before/as part of the live flip so origins.site and the domain attach land. Until that infra runs, a prod deploy fails at the site step (step 1 of the #388 rollout / #304).
#370: #398 (merged) dropped the site domain's dependsOn and moved the marketing apex to Auth0 logoutOnlyHosts. Conductor-last ordering in deploy.yml remains (now guarded by site-build). See Marketing site — Auth0 logout-only apex.
No live brilliant.lighting fallbacks (#447, open; closes #443)
Open on drop-brilliant-lighting (#447, open — not merged). brilliant.lighting is a dropped zone, but ~30 call sites still used it as a silent fallback host. A deploy missing one var would send users to a host that does not exist. Document the intended fail-closed rule now; flip to merged when it lands.
Rule: no fallback host. A missing preview / studio / control-plane origin fails with an error that names the var.
| Surface | Required var | On missing |
|---|---|---|
| Control plane | PREVIEW_URL | Existing 500 misconfigured |
| Conductor | PREVIEW_HOST | requirePreviewHost — contract preview-host-never-defaulted |
| Evals | PREVIEW_HOST | Taken from the conductor URL, else throw |
| Dispatch | CONTROL_PLANE_URL | Contract control-plane-origin-never-guessed (still derives brilliant-control-plane[-<env>] from its own workers.dev host) |
| Studio SPA | VITE_PREVIEW_URL | previewOrigin() throws; vite build fails. scripts/verify.ts / deploys / side envs set it; scripts/dev.sh defaults it for local. Preview error classifier compares against the configured origin |
Also removed: studio.brilliant.lighting from conductor routes/dev.ts frame-ancestors / CORS (studio origin comes from CONTROL_PLANE_URL, as for app.brilliant.rocks); dispatch’s brilliant.lighting and retired monday-vibe-stg studio fallbacks; the 421 guard for preview.brilliant.lighting (and contract preview-host-not-dispatch-404).
Agent id: brilliant-conductor-${BRILLIANT_ENV} (was "staging" when the preview host contained brilliant.lighting, else "dev"). LangSmith / trace agent ids become per-env (staging, prod, side-env names).
Not in #447: apps/site contact addresses (hello@ / security@brilliant.lighting, #444) — need a real inbox. Fixture-only brilliant.lighting hostnames in tests stay. Markdown docs in the monorepo are out of scope for that PR.
Every deployed env (staging, prod, side envs, ci) already sets each required var (base wrangler, render.ts, config.ts). See Getting started · Conductor · Dispatch · Secrets · Troubleshooting.
Staging stack key and branches namespace (#492, merged)
Merged #492 (yoni-monday, merge 409ee616, 2026-10-05; already applied to staging). See Secrets & environments:
- Stack secrets providers: prod uses the shared
awskms://alias/brilliant-pulumi, staging uses its ownalias/brilliant-pulumi-staging, and side stacks usealias/brilliant-pulumi-side. Both new keys are bootstrap (infra/bootstrap/aws.sh), because a stack must not manage the key that decrypts it. The staging key exists so thebrilliant-staging-agentstatic key can run Pulumi on staging without touching the shared key, which also unwraps prod's stack key. brilliant-branchesdispatch namespace (staging only): holds Branch Workers (<branch>--<service>) that staging's router middleware dispatches to on thex-brilliant-branchheader, for branch routing (repodocs/plans/branch-routing.md, #338). A test pins it to staging; prod never gets a namespace the router could send traffic into. The router middleware (on control-plane, dispatch and agents),branch:deploy|down|listand the browser switcher landed in #561 (merged 2026-10-07), see Side environments — Branch routing. #606 (merged 2026-10-07 22:31 IDT) removed branch routing andinfra/pulumi/src/branches.ts, so this namespace is on its way out: the next stagingpulumi updeletes it (it is empty), which needs the CI deletes-guard allowance or an admin session. Not yet confirmed done.
BI
Behavioural events → Pipelines / R2 Iceberg. Event catalog and browser / platform split live on BI events (repo docs/bi.md). Never put prompt text in BI payloads. Merged #363 (bi-browser-events-only, closes #309). Merged #364 (visitor ingest, closes #321): no-session /api/bi accepts only VISITOR_BI_EVENTS, rate-limited per IP (BI_VISITOR_RATELIMIT ns 4606).
Template demos (#358)
On main (templates stack via #345 / #358): Pulumi owns a separate WFP namespace (brilliant-demos / brilliant-demos-stg), a WorkersCustomDomain for demo.<studio domain> on dispatch, and a Turnstile widget whose keys land in brilliant/<env>/turnstile. cloudflare-ids gains dispatchNamespaces.demos and origins.demo (renderer fails closed without them). Side envs use always-pass Turnstile test keys and serve demos under dispatch /demo/<versionId>/.
Cloudflare API token: the stack token listed in infra/pulumi/BOOTSTRAP.md needs Turnstile (Edit). Without it, staging’s infra apply for the Turnstile widget fails with 403 on /challenges/widgets (#416, merged 2026-10-04 — docs the missing permission after #345).
Rollout: infra → secrets:push → deploy demo-data, dispatch, template-share, conductor, control plane. Product behaviour: Template demos.
AI Gateway Unified Billing (#618, merged)
#618 (merged 2026-10-08 11:21 IDT, yoni-monday, merge 64830aec) sets workersAiBillingMode: "unified" on the existing brilliant AI Gateway in each Pulumi stack (infra/pulumi/src/cloudflare.ts). It is a one-line infra change: no new or deleted resources, IAM, provider keys, app code or migrations. With this mode on, Workers AI traffic routed through the gateway is paid from Cloudflare prepaid credits (Cloudflare Unified Billing docs).
Why it is split out: it is the infra prerequisite for the app inference cutover in #610 (merged 2026-10-08 12:33 IDT, merge d95f16f9), so the automatic staging infra and app deploy workflows don't race.
- Before relying on it: the owner confirms the staging credit balance, intended auto-top-up and low-balance alerting. Turning the mode on can affect existing Workers AI gateway traffic, and running out of credits is a shared inference outage risk.
- Staging: on merge,
infra.ymlpreviews and applies the main tip. Review the full Resources block (no allowed deletes), wait for a successful apply, and verify the live setting before merging #610. - Production: needs an approved preview plus a manual infra dispatch, with finance, security, legal and funded-credit gates; the app cutover comes afterwards.
- Not in this PR: retiring the default Vertex BYOK key or Bedrock IAM. That happens only after the replacement code ships and wholesale billing is proven in both environments, tracked in #593. The code side of that retirement is #634 (below). The last Vertex consumer (the preset generator) moved off Vertex in #678, and the inactive staging Vertex provider-key record was deleted (below).
What #610 does (merged 2026-10-08 12:33 IDT, merge d95f16f9): routes Studio, app AI and image calls through the trusted conductor proxy into the same brilliant gateway (Claude, Gemini and GPT on native APIs; some models over Cloudflare REST; Workers AI via binding), replaces the conductor Bedrock/Vertex transports, and withdraws GLM 5.3 / GLM 5.3 Flash (drafting/compaction default becomes Kimi K2.7 Code). Its deploy checklist lives in repo gotchas/deploying.md ("Unified Billing and GLM retirement"). Cloudflare passes provider token rates through without markup but charges a 5% credit-purchase fee; retail credit pricing is unchanged. Product credits: Subscriptions, credits & access.
Rollout status (per #634, operator attestation): production was deployed and verified, and real text and image logs in both staging and production show wholesale: true, byok: null. These are operator-confirmed, not logs collected by the PR task.
Bedrock retirement after Unified Billing (#634, merged)
#634 (merged 2026-10-08 14:56 IDT, yoni-monday, merge 406ce754; refs #593, follows #610) removes the now-unused Bedrock declarations from the shared staging/prod Pulumi program and the secret loader/broker. It is preparation only: merging changed code, nothing was applied and no credential was revoked. The AWS resources stay live until an approved infra apply in each stack.
| Removed in code | Kept |
|---|---|
Pulumi Bedrock component (infra/pulumi/src/bedrock.ts deleted) and its stack config in Pulumi.staging.yaml / Pulumi.prod.yaml | The existing Cloudflare brilliant gateway, CF_AIG_TOKEN, databases, Auth0 |
The brilliant/<env>/bedrock secret add-on in the loader, broker reads and catalog metadata | All other secret bundles, their precedence, and general AWS access |
| The exact developer and side-env reader grants on the Bedrock secret | Vertex metadata, because scripts/gen-design-style-presets.ts still used it (native-route follow-up #635). Since retired by #678 (below) |
Base secret blobs and stored AI Gateway provider-key records are not rewritten. A new test (infra/pulumi/test/bedrock-retirement.test.ts) proves the program declares no Bedrock resources even with stale legacy config, while still declaring the gateway, databases, broker and staging/side-env users.
What an apply would delete, per stack (declared scope, not an observed Pulumi plan; no full previews were produced):
| Resource | Name |
|---|---|
| IAM user, inline invoke/Marketplace policy, access key | brilliant-<env>-bedrock-gateway |
| Two application inference profiles | brilliant-<env>-claude-opus-5-5, brilliant-<env>-claude-sonnet-5 |
| Two Secrets Manager secrets and their versions | brilliant/<env>/bedrock-gateway, brilliant/<env>/bedrock |
One-way once applied
Deleted IAM keys cannot be restored, recreated inference profiles get new ARNs, and secrets in scheduled deletion (provider default 30 days) block recreating the same name. The apply also reverses the usual infra-first order: deploy the #634 commit (or later) to an environment before applying its stack, because older loaders still read the retired secret. After the apply, #634's merge commit is the rollback floor for deploy, candidate and local tooling; older checkouts need the loader fix backported or an approved secret recovery.
Gates before applying (from the PR):
- Land and apply the pending Neon repair #632 with a green staging
infra.ymlon main first, and never combine Neon changes and credential deletes in oneallow-deletesdispatch. #634's own checklist put this before merge; when #634 merged, #632 was still open. Update: #632 merged 2026-10-08 16:07 IDT; its automatic staginginfra.ymlrun stopped at preview (12 deletes or replaces) waiting for an approved allow-deletes dispatch, so this gate is still open (Wave 1 status). - Review complete staging and prod previews by resource name, including the actual recovery windows. Stop on any unrelated database, Aurora/Neon, gateway, Auth0 or general-access replacement or deletion. No prod dispatch just to get a preview.
- The removal gate refuses an automatic staging apply. Only an explicitly approved normal
infra.ymldispatch withallow-deletesapplies it; prod also needs its Environment approval. - After each apply, prove the scoped IAM keys, users and grants are gone, Unified Billing text/tool/image traffic still works, and a fresh preview is clean. Removing any leftover AI Gateway Bedrock provider-key record is a separate, explicitly approved step.
- #593 stays open until both environments are applied and checked. A merged PR, green CI or billing attestation is not revocation evidence.
Runbook in the repo: infra/pulumi/README.md, section "Bedrock retirement after Unified Billing verification". Related doc updates in the same PR: infra/pulumi/BOOTSTRAP.md, gotchas/aws-and-secrets.md, scripts/env/README.md.
Preset generator on managed Anthropic, Vertex metadata retired (#678, merged)
#678 (merged 2026-10-08 21:47 IDT, yoni-monday, merge c5ae5a78; refs #635, follows #610 and #634) finishes the tooling side of the Vertex retirement. No runtime or developer tool needs Vertex metadata any more.
| What | Now |
|---|---|
scripts/gen-design-style-presets.ts transport | Calls the normalized brilliant gateway at <root>/anthropic/v1/messages via the shared gatewayFetch helper (packages/capabilities/src/gateway-fetch.ts), instead of a Vertex rawPredict URL built from VERTEX_PROJECT |
| Auth and headers | Gateway-only: cf-aig-authorization: Bearer $CF_AIG_TOKEN, anthropic-version: 2023-06-01 as a header (no anthropic_version in the body), and cf-aig-skip-cache: true, so cached inference is deliberately refused. No provider key is sent |
| Generation settings | Unchanged: Claude Opus 5.5 (MODEL_IDS.CLAUDE_OPUS_5_5), 8000 max tokens, adaptive thinking with display omitted, low effort, same prompt, corrections, parsing, validation, 3 retries, flags and concurrency 6 |
| Inputs | Only CF_AIG_TOKEN and AI_GATEWAY_BASE_URL from the main checkout's services/conductor/.dev.vars. An old root ending in /google-vertex-ai still normalizes correctly |
| Secrets catalog and dev vars | VERTEX_PROJECT and VERTEX_LOCATION removed from infra/secrets/catalog.ts (a test now asserts no BEDROCK_ or VERTEX_ entries) and from the conductor .dev.vars written by scripts/env/cloud-prep.sh. Values already stored in base secret blobs are not rewritten |
| Tests | The script is import-safe (the CLI only runs under import.meta.main) and exports askStylePreset with an injectable fetch; scripts/gen-design-style-presets.test.ts covers the native route, headers, body, old-root normalization, correction prompt, refusal before network and upstream errors |
Usage: pull a main at or after c5ae5a78 before generating presets (bun scripts/gen-design-style-presets.ts, --force to regenerate all, or a style id for one). Missing gateway auth fails fast with preset_gateway_upstream_auth, and a root that isn't the brilliant gateway fails with preset_gateway_gateway_url_missing, both before any network call. No generated presets, design-style assets or template CSS changed in this PR, and no real generation ran, so live inference and wholesale billing for this exact request are not yet proven; the first approved generation is the end-to-end check.
Staging Vertex record deleted
Separately approved Cloudflare API cleanup deleted the inactive staging AI Gateway Vertex provider-key record (0dee0c49-…); a follow-up list showed zero records. The gateway, its token and production were untouched. That deletion is not undone by reverting the PR. #593 stays open for the remaining production IAM, full-plan and post-check gates, and this PR does not approve any infra apply.
Related
- Secrets & environments · Side environments · Marketing site · Dispatch · Verify & ship · ADR
prod-infra.md
Staging system-email domain (#739, merged)
PR #739, merged 2026-10-10 12:15 IDT, declares a Cloudflare Email Sending subdomain for staging. It is infrastructure only, a prerequisite for the transactional welcome email (code landed in #754, not enabled).
Pulumi.staging.yamlsets the Cloudflare component'sEmailSendingSubdomaintomail.brilliant.rocks(zonebrilliant.rocks, staging account). Pulumi createsbrilliant-staging-cloudflare-email-sending.- Staging identity, validated in YAML: From
Brilliant (staging) <system@mail.brilliant.rocks>. Reply-to was later removed (#772); the single controlled recipientyonibr@monday.comwas dropped when #921 opened recipients (empty allowlist = any valid address). - When unconfigured it creates nothing. Suppression dropping and sent-message body previews are disabled. No email metadata goes into
cloudflare-idsyet; that waits for the runtime consumer. - The Cloudflare provider token needs Email Sending: Edit (documented in BOOTSTRAP/README).
- Cloudflare owns the generated SPF, DKIM and bounce DNS under the subdomain. After apply, check real DNS and authentication status before any send, because
enabledalone is not proof. - Not included in #739: no Worker binding, no template, no sends, no credentials. Production sending was added later by #921. Reverting the staging domain needs a reviewed Pulumi removal.
- Landed (#921, merged 2026-10-14 14:40 IDT): staging no longer sets a controlled recipient (an empty list allows any valid address in every environment); production declares sending on
mail.brilliant.aiassystem@mail.brilliant.aiwithartifactSourceOrigin: https://app.brilliant.rocks. Infra apply + privacy readback still required before any production send. See Transactional email: production sending.
Refreshed infra dispatch for privacy drift (#753, merged)
PR #753, merged 2026-10-10 20:12 IDT (refs #749), adds an opt-in refresh-state boolean to infra.yml. It exists because the staging email domain from #739 drifted: a cached-state preview showed nothing to change while the Cloudflare API still reported preview_enabled=true. A refreshed native preview does detect the drift (one update, previewEnabled: true → false), so no extra settings resource was needed.
refresh-statedefaults to false for pushes and ordinary dispatches. When true, the fullpulumi preview --refresh=trueand both S3 and R2uppaths use the same flag.- Main-tip checks, the production reviewer, the JSON removal gate and the default refusal of deletes are unchanged. A refreshed run can surface unrelated live drift; never set
allow-deletesor target resources just to push this repair through. - Repair runbook: the normal merge apply does not fix the drift. Run a separate, reviewed staging dispatch with
refresh-state=true, then independently confirm bothpreview_enabled=falseanddrop_suppressed_recipients=falseonmail.brilliant.rocksbefore any controlled sending. An ignored update or missing readback keeps the gate closed. - Not claimed by the PR: no live fix yet, no email sent, no welcome email enabled. Production is not authorized here.
Single-resource refresh in infra dispatch (#785, merged)
PR #785, merged 2026-10-11 11:59 IDT (refs #749), adds an opt-in refresh-urn string input to infra.yml. When set, the workflow runs pulumi refresh --target <urn> for that one resource (state only, no cloud writes) before the normal, unchanged full preview, removal gate and apply.
- Why: the full
refresh-state=truestaging plan wanted to fix the email preview flag but also to replacebrilliant-staging-cloudflare-bi-sink(blocked by the removal gate) and update Auth0 database clients, the AI Gateway, the BI stream and D1 metadata, which would revert live settings. A full refresh is the wrong tool for a one-flag repair. - Input defaults to empty, so pushes and ordinary dispatches are unchanged. It is passed via env, and the URN must match
urn:pulumi:<stack>::brilliant-infra::…; prod URNs, whitespace,;and empty values are rejected. - Repair runbook (updated): for the staging email-domain drift, dispatch with
refresh-urn=<email-domain URN>instead ofrefresh-state=true. The plan should show only that resource's diff (previewEnabled: true → false) behind the existing gate. Main-tip check, removal gate and prod reviewer are unchanged. - The unrelated staging drift above is real and is to be triaged separately in a follow-up issue.
AI Gateway settings declared in Pulumi (#794, merged)
PR #794, merged 2026-10-11 14:43 IDT (fixes #791), declares the Cloudflare AI Gateway settings that previously lived only in the dashboard. Values were read from both accounts; staging and prod are identical. This is part of the unrelated staging drift found in #785.
- Log collection on, with
logManagement: 10_000_000andlogManagementStrategy: DELETE_OLDEST. logClassification,logpushandzdrare off. No spend limits and no OTEL, so those stay undeclared.- Authenticated gateway on with unified billing (already declared before).
storeIdpoints at the account's Secrets Store, which holds the BYOK provider keys. Each account has exactly one.ignoreChanges: [modifiedAt, isDefault], since those are read-only outputs.- Expected plan: one in-place update per stack that writes the values the gateway already has.
ai-gateway.test.tsgoes red ifstoreIdis dropped.
Neon HIPAA declared; Composio auth configs retained on delete (#798, merged)
Merged 2026-10-11 18:32 IDT (PR #798).
- Neon HIPAA (closes out #636): the prod Neon project has HIPAA enabled (on since 2026-10-08; staging is off). It's now declared from prod stack config (
brilliant-infra:neon.project.hipaa: true, sent to Neon ashipaa: "yes"), so prod applies no longer plan a perpetualyes → unsetupdate onbrilliant-prod-neon-base-project. Staging is unchanged. - Composio auth configs (#702, step 1 of 2): all 13 Composio auth config resources are now
protect: false+retainOnDelete: true. Step 2 (#799) removes them from Pulumi state without ever deleting the live configs in Composio. - Expected prod plan: an option-only change on the Composio resources, no delete or replace, and the Neon drift gone.
Composio removed from Pulumi (#799, merged)
Merged 2026-10-11 18:50 IDT (PR #799), step 2 of 2 for #702 (step 1 is #798).
- Pulumi no longer manages Composio:
src/composio.ts,src/composio-credentials.ts, their tests, thecomposioAuthConfigIdsoutput, and the threebrilliant-infra:composio*keys inPulumi.prod.yamlare gone. - Composio auth configs are now managed in the Composio dashboard. Their ids still reach Workers through the Secrets Store and admin Config, unchanged. See Integrations.
ci/preview.shmarks a delete of a retained resource as(retained: state-only).- Prod rollout: dispatch prod without allow-deletes first. The guard stops on 13 deletes, and every one must read
(retained: state-only). Only then re-run with allow-deletes. Any unmarked Composio delete means stop, since it would delete the live config. Staging has no Composio, so nothing changes there.
ACUL login screens flag (#944, merged)
PR #944 (merged 2026-10-15 11:16 IDT by yoni-monday, merge 76b2873f) adds infra/pulumi/src/login-screens.ts behind the stack config key brilliant-infra:loginScreens. On that merge the key was still absent on every stack. #951 later turned it on for staging. Since #969 the block also needs enabled: true; prod has a block with enabled: false, so prod is still off.
- Config fields:
manifestUrl(the site's/login-ui/manifest.json, fetched at apply time; the apply fails if it's missing, not https, or lacks sha384 hashes), optionalsenderfor code emails, optionalsmtpProvider(Cloudflare SMTP so Auth0 uses our branded template; see #967, merged; off on every stack), and optionalemailConnectionto adopt an existing passwordless connection. As merged, #944 also had a hand-typedclientslist (Auth0 client ids that get our screens; everyone else on the shared nonprod tenant keeps the standard login). #954 (merged) dropped that list: the renderers now filter on the studio client id of the stack's ownauth0.Clientinstead. - Screens rendered:
login-id,signup-id,login-passwordless-email-code. The renderer only exposesext-prompt,ext-tools, submitted form data, screen texts, and branding to the page. #954 (merged) addedext-screento that context (untrusted_data.authorization_params.ext-screen). - When the flag takes the studio client off the password connection (prod, no e2e users), that change depends on the email-code binding, so a failed apply leaves the old login working.
- Order used to matter: deploy the site (new bundle) before the infra apply. #951 landed the bundle history so the apply and the site deploy can run in any order.
infra.ymlstill starts an apply on login-bundle changes. Stack outputdatabaseConnectionNamefeeds the e2e scripts'connection=hint.
Staging turn-on config (#945 via #951, on main)
PR #945 (by yoni-monday) is the follow-up config PR that turns the screens on for the staging stack. It was merged 2026-10-15 11:17 IDT (merge c678cef0), but into base login-screens, about 25 seconds after #944 had squash-merged into main (76b2873f), so that merge never reached main. #951 re-landed the same block on main (merged 2026-10-15 11:50 IDT).
What the block sets (as it reads on main since #954 landed):
brilliant-infra:loginScreens:
manifestUrl: https://brilliant.rocks/login-ui/manifest.json
sender: system@mail.brilliant.rocksAs landed by #945/#951, the block also had
clients: [k7T4…hTFm], meant as the staging studio client. That id actually named the management app, so the filter matched nothing and Auth0 kept serving the standard page. #954 (merged) removedclients; the renderers now filter on the stack's studio client id (args.studioClientId) instead.
- The apply creates the passwordless email connection, binds it to the studio client, and sets the ACUL renderers for
login-id,signup-id, andlogin-passwordless-email-code. Staging, side envs, and local dev all use the staging studio client, so all of them get the new screens now that the filter names that client (#954; see the note above). Prod is untouched (its stack has nologinScreens). - Identifier First is tenant-wide. It was already on for the nonprod tenant, and the Prompt is
retainOnDelete, so removing the block leaves it as it was. - It was blocked by #949 (a site deploy could delete the bundle files Auth0 pins). #951 fixed that and carried this block to
main. - Rollback: delete the block. The renderers go back to Universal Login, and the email connection stays (
retainOnDelete).
Turn-on order from the PR:
- #944 merged and the staging site deployed. The apply reads
/login-ui/manifest.jsonfrom brilliant.rocks; a missing manifest fails the apply with nothing half-applied. - In the nonprod Auth0 dashboard, set Disable Sign Ups on the
Username-Password-Authenticationdatabase connection. The screens offer only Google and an email code; e2e users keep signing in with their passwords through the nonprodconnection=hint. - Merge the config to
main, andinfra.ymlapplies the staging stack. - Optional: turn on
loginScreens.smtpProviderso codes come fromsystem@mail.brilliant.rockswith the branded template (#967, merged; owner steps there). Without a provider, Auth0's built-in one sends its default template, which is fine for staging.
Evidence in the PR: cd infra/pulumi && bun test (145 pass), bun run typecheck clean, and screens checked against Figma in the mock harness (apps/login, bun run dev, then /login-ui/mock.html?screen=signup|login|code).
Login bundle history and staging turn-on (#951, merged)
PR #951 (merged 2026-10-15 11:50 IDT by yoni-monday, merge da07ac74, head b743fdcd, branch login-ui-retain) closes #949 and re-lands the #945 staging block on main.
What landed:
- Auth0 pins whatever login bundle the infra apply read from
/login-ui/manifest.json. Every site deploy now keeps every login file the site has ever served, so the apply (infra.yml, on push) and the site deploy (deploy.yml, after verify) can run in any order. Before this, a deploy kept only the files of the one previous bundle, and the deploy had to land before the apply. - The served
manifest.jsongains aretainedlist: earlier files the site still serves, oldest first. Each build fetches the deployed manifest, re-serves its own files plus itsretainedlist, then writes the newretained(that history minus the new bundle's files), capped at 300 with the newest kept (MAX_RETAINEDinapps/site/build/login-ui-history.ts). - A deployed manifest that answers 404 means a first deploy, so there's nothing to keep. On a deploy build (
LOGIN_UI_DEPLOY=1, set byscripts/env/lib/site-build.ts), any other failure, or a current-bundle file that won't download, fails the build instead of dropping files Auth0 may pin. A retained file the live site has already lost (404) is dropped with a warning. Local and test builds only warn. Repo gotcha:gotchas/site.md("A site deploy fails with…"). infra/pulumi/Pulumi.staging.yamlgets thebrilliant-infra:loginScreensblock shown above (a hand-typedclientsid,manifestUrlhttps://brilliant.rocks/login-ui/manifest.json,sendersystem@mail.brilliant.rocks). Staging, side envs, and local sign-in all use the staging studio client, so they were meant to get the new ACUL screens onceinfra.ymlapplied. Prod has nologinScreensblock. In practice the hand-typed id named the management app and the screens did not show; #954 (merged) fixed the filter.
Merge order from the PR (preconditions at merge time):
- Staging serves the #944 site:
curl -sI https://brilliant.rocks/login-ui/manifest.jsonreturns 200. If not, the apply on push fails cleanly and nothing changes; re-runinfra.ymlafter the deploy. - "Disable Sign Ups" on the nonprod password connection: the PR marks this done.
- Merge, and
infra.ymlapplies the staging stack: the email connection, the studio binding, and the ACUL renderers.
Risk, per the PR: two-way door, blast radius is staging login. Roll back by deleting the loginScreens block. Identifier First is retainOnDelete and was already on for this tenant. Evidence: apps/site/test/login-ui-history.test.ts (history carried across three deploys, no duplicates on a rebuild, cap keeps the newest), real builds against staging ("nothing to retain") and in deploy mode ("retained 7 earlier file(s)"), infra/pulumi 145 pass, site 227 pass.
Product side: Marketing site — Site and login redesign.
Studio client filter and email-code authorize defaults (#954, merged)
PR #954 (merged 2026-10-15 12:43 IDT by yoni-monday, merge e722b7bc, head 46f6236f, branch login-screens-fix) is the follow-up to the #951 staging turn-on. It fixed two faults.
What landed:
1. Renderers filter on the real studio client
- The ACUL
PromptScreenRendererfilters no longer take a hand-typedloginScreens.clientslist. They filter on the studio client id of this stack's ownauth0.Client(args.studioClientId). - Why: the hand-typed id in the staging block named the management app (
k7T4…), matched nothing, and Auth0 served the standard page. - An empty studio client id is refused, since an empty filter would apply the screens tenant-wide.
Pulumi.staging.yaml:brilliant-infra:loginScreensdropsclients:and keepsmanifestUrlandsender(see the staging block).
2. Email-code logins name the email connection (nonprod)
- With the password and email connections both enabled and password sign-ups disabled,
screen_hint=signupstarts a password sign-up, which fails with "signup is disabled". - New control-plane env
AUTH0_EMAIL_CONNECTION(emailin nonprod wrangler). In nonprod, plain/auth/loginsendsconnection=email, and a signup sendsext-screen=signupinstead ofscreen_hint. An explicitconnection=hint still wins and keepsscreen_hint. Prod render deletes the env, so prod gets no email default. Details: Control plane — email-code login defaults, Secrets & envs — AUTH0_EMAIL_CONNECTION. - The renderer context adds
untrusted_data.authorization_params.ext-screen. Thelogin-idscreen readsext-screen==="signup"for signup copy. Without Auth0's signup link (the email-code flow), the Log in / Sign up switch flips the copy in place instead of opening the passwordsignup-idscreen. Product side: Marketing site — login and sign-up.
After merge (from the PR)
infra.ymlapplies on push, before the site deploy, and pins the bundle that is current at that moment. After the staging site deploy, re-runinfra.ymlonce so Auth0 pins the bundle with theext-screencopy.- Every served bundle stays served (#951), so either order is safe.
Risk, per the PR: two-way door, blast radius is staging login. Prod has no loginScreens block and no email default.
Google restart via ext-google (#957, merged)
PR #957 (opened 2026-10-15 13:20 IDT by yoni-monday, branch login-google-via-studio; merged 2026-10-15 14:31 IDT, merge 0ab3e8d9, head 695bea4e) follows #954. Auth0 refuses a switch to Google inside a connection=email transaction, so Continue with Google on the ACUL screens stayed on the identifier page after the email default landed.
What landed on main:
LOGIN_SCREEN_CONTEXTgainsuntrusted_data.authorization_params.ext-googleso the renderer can hand the restart URL to the bundle.- Control plane puts that URL on the authorize request when defaulting to email; the login bundle only follows it for our studio login routes (
studioLoginEntry). Details: Control plane — Google restart. - Auth0's ext-param rule: Auth0 checks every
ext-*authorize value against^[-\w.*~@+ /:]{1,255}$and returns a 400 ("error parsing ext params") for the whole/authorizewhen one fails. The control plane now sets an ext value only when it matches and drops it otherwise, so a bad value degrades the screens instead of blocking login. See Control plane — ext-param encoding. - The studio host list in the login bundle (
STUDIO_HOSTinapps/login/src/context.tsx) is a hand copy of the studio entries ininfra/pulumi/Pulumi.{staging,prod}.yamlauth0.hosts, now including the oldmonday-vibe-stgworkers until that account is retired (#61). Keep the two in step when a host is added or renamed. - After merge: same as #954. After the staging site deploy, re-run
infra.ymlonce so Auth0 pins the bundle that readsext-google.
Risk, per the PR: two-way door, blast radius is staging login. Nonprod only.
Auth0 login-code email and SMTP provider (#967, merged)
PR #967 (merged 2026-10-15 16:01 IDT by yoni-monday, merge 2a866461, head c357d5ff, branch auth-code-email; opened 15:31 IDT) brands the Auth0 passwordless one-time-code email and declares Cloudflare SMTP as the tenant email provider behind config. The flag is not set in any stack yaml, so the merge only updated the connection template and subject; the branded mail stays invisible until an external provider is on.
Why the template alone never showed: Auth0 only uses a custom passwordless template with an external email provider. On Auth0's built-in provider, staging kept sending Auth0's default ("Welcome to brilliant-studio-staging").
Template pipeline
Auth0 passwordless email connection
template <- infra/pulumi/src/login-code-email.html (committed, generated)
^ apps/control-plane/scripts/render-login-code-email.ts
Maily + withBaseLayout + EMAIL_THEME (same as Welcome / invitations)
site origin is a placeholder; Pulumi swaps in the stack's site origin
(Cloudflare domains.site, via environmentOrigins(...).site -> Auth0Apps / loginScreens)
subject "{{ code }} is your Brilliant code"
provider auth0.EmailProvider("smtp") -> smtp.mx.cloudflare.net:465 [off until config + secret]- Body: heading, one line, Liquid (literal) at 36px / 8px letter-spacing in the recessed well, muted 3-minute expiry line. Footer says someone entered this address to sign in.
- The placeholder
https://site-origin.placeholderis replaced with the stack's site origin from the Cloudflaredomains.siteconfig (environmentOrigins(...).site, passed intoAuth0AppsandloginScreens), not frommanifestUrl. - Shared email footer no longer links
/security(the site 301s it home). Same layout change applies to control-plane transactional mail: Transactional email. - Drift test
email-login-code.test.tsre-renders and compares to the committed HTML.
SMTP provider (flagged off)
- Cloudflare Email Service over SMTP: host
smtp.mx.cloudflare.net, port 465, userapi_token, password =AUTH0_EMAIL_SMTP_TOKEN(Cloudflare API token with Email Sending: Edit). Documented ininfra/pulumi/BOOTSTRAP.md; wired ininfra.yml. - Declared only when
loginScreens.smtpProvider: true(needssendertoo) and the secret is set. Not set in any stack yaml yet. - Management grant scopes: #967 adds
read/create/update/delete:email_providerto both stacks' Auth0 management grant.loginScreens()refusessmtpProviderunless those scopes are already on the grant. - One provider per tenant: enabling it moves every Auth0 email of that tenant (verification, password reset, code) onto Cloudflare SMTP.
- Rejected: Auth0
custom-email-providerAction (more code and a secret in Auth0 for no gain); SES/SendGrid (new vendor and DNS).
Owner steps after merge (from the PR body)
- Merge, then let
infra.ymlapply so the grant gets theemail_providerscopes. A scope added to the grant does not reach the token minted in the same apply, so this has to land in an apply before the one that turns the flag on (the repo'sgotchas/deploying.mdcovers this). - Create an account-owned Cloudflare API token with Email Sending: Edit, then
gh secret set AUTH0_EMAIL_SMTP_TOKEN --env infra-staging(andinfra-production). The sender domainmail.brilliant.rocksmust be onboarded for Email Sending. - Follow-up PR: add
smtpProvider: trueunderloginScreensinPulumi.staging.yaml, preview, apply, then send a real code. Confirm Auth0 accepts port 465 (implicit TLS); fallback is the REST API through acustom-email-providerAction. Neither tenant has an email provider today (owner confirmed), so there is nothing to import. - Prod:
loginScreensneedssenderas well, then the same flag flip.
Rollback: remove smtpProvider. That deletes the provider, so the infra removal gate needs allow-deletes, and the grant needs delete:email_provider (added by #967). Reverting the template is a two-way door; the next apply overwrites it.
Blast radius, per the PR: staging/prod Auth0 code email; with the flag on, every Auth0 email of the tenant.
See Secrets & envs — AUTH0_EMAIL_SMTP_TOKEN.
Staging Cloudflare SMTP provider (#972, merged)
PR #972 (merged 2026-10-15 16:15 IDT; by yoni-monday, merge b865ff45, head 5dae27e5, branch staging-smtp-on; opened 16:02 IDT; 3 files, +8) turns on the #967 SMTP provider for staging.
- Flag flip:
infra/pulumi/Pulumi.staging.yamlsetsloginScreens.smtpProvider: true, which createsauth0.EmailProvider "smtp"(smtp.mx.cloudflare.net:465, userapi_token, passwordAUTH0_EMAIL_SMTP_TOKENfrominfra-staging). - Extra grant scope: adds
update:connections_optionsto the management grant on staging and prod. #967's staging apply failed with 403 "Updating the options property requires the update:connections_options scope" when writing the email connection's template/subject (itsemail_providerscopes did land). - Prerequisites: the #967
read/create/update/delete:email_providergrant scopes are already live from an earlier apply, andAUTH0_EMAIL_SMTP_TOKENis set on theinfra-stagingGitHub Environment (Secrets & envs). - Two applies: a new grant scope reaches the token one apply later. The merge's apply adds the scope and creates the provider, but the connection update fails once more; re-dispatch
infrafor staging to apply the template. - Blast radius: the nonprod Auth0 tenant is shared, so every Auth0 email there (staging, side envs, local dev) moves to Cloudflare SMTP, which is in beta. Prod gets only the scope; its provider waits for the #969 rollout (prod flips
smtpProvidertogether withenabled). - Live check: after the second apply, a real login-code email shows the branded template and the
system@mail.brilliant.rockssender. PR tests:infra/pulumi152 pass; the stack grant test pins the new scope. - Rollback (two-way door): remove
smtpProviderfromPulumi.staging.yamland dispatchinfrawithallow-deletes(the provider is deleted; the grant hasdelete:email_provider).
Prod login screens config and rollout runbook (#969, merged)
PR #969 (merged 2026-10-15 16:59 IDT by yoni-monday, merge 57792ed9, head a6082247, branch login-prod-prep; opened 15:37 IDT; rebased on #967 and #972) prepares the ACUL login screens (Google + email code) for prod, switched off. It also shipped a control-plane fix for lost callback state: Control plane — lost callback state restarts the login.
The merge changed nothing on prod. The prod block says enabled: false. infra.yml applies staging on push; prod only applies when the owner dispatches infra for prod behind the reviewer. While enabled is false nothing is declared and no manifest is fetched, so any prod infra dispatch is unaffected. Prod login screens are not live until the owner runs the rollout below. Update: the flip itself merged in #974 (2026-10-15 21:00 IDT); prod changes when that infra prod dispatch applies.
Config on Pulumi.prod.yaml
brilliant-infra:loginScreens
enabled: false (staging: enabled: true)
manifestUrl: https://brilliant.ai/login-ui/manifest.json
sender: system@mail.brilliant.ai- New
enabledswitch.loginScreensnow does nothing unless the block saysenabled: true(index.ts). Before #969 the block's presence alone turned the screens on; staging gainedenabled: trueso it keeps its screens. The email connection's own template and provider (smtpProvider) are declared only whileenabledis true. - The studio client id is the stack's own Pulumi output. Renderers, the
emailconnection and its clients, and Identifier First reuse the code already live on staging. - The database connection's clients now wait for the email clients, the prompt and the 3 renderers, so a failed manifest leaves the password door open rather than closing it first.
readLoginUiManifesthas a 10-second timeout and HEADs every file the manifest lists before Auth0 pins it (part of #952). Staging's apply does this too (all 200 on 2026-10-15).- Prod still ignores
?connection=Username-Password-Authentication, and its rendered config still dropsAUTH0_DATABASE_CONNECTION/AUTH0_EMAIL_CONNECTION. TheemailConnectionDefaultfrom #954 stays nonprod, so prod sends no connection hint. - Prod's management grant already carries the
email_providerscopes andupdate:connections_options(from #967 and #972), and theinfra-productionsecretAUTH0_EMAIL_SMTP_TOKENis set. - The full runbook lives in the repo at
infra/pulumi/AUTH0_CUSTOM_DOMAINS.md, section "Login screens (ACUL): prod rollout". - PR tests: control-plane 2069 pass,
infra/pulumi149 pass. A new prod test runs the realPulumi.prod.yamlthrough the mocked program: 3 renderers filtered to the prod studio client, theemailconnection enabled for that client only, the database connection's clients[], no e2e users.
State observed from outside on 2026-10-15 (per the PR): login.brilliant.ai is live and the Workers use it; https://brilliant.ai/login-ui/manifest.json returns 404; prod's /auth/login?screen=signup sends no sign-up hint because the prod control plane is older than main.
Read before applying (Auth0, read only)
- Count prod users on
Username-Password-Authentication. The apply takes the studio client off that connection and does not migrate them: they can't sign in afterwards (an email code for the same address is a different identity, and the callback errors). Expected zero; otherwise decide first. GET /api/v2/connections?strategy=email: noemailconnection should exist. If one does, addemailConnection: <id>to the block (adopt it, else a 409) and check its client list, since ours replaces it.GET /api/v2/prompts: experience isnew. Noteidentifier_first: the apply sets it tenant-wide (admin forces Google, so admin is unaffected).- Email prerequisites: #967 merged and its
email_providerscopes applied in prod's grant (a new grant scope needs one apply before it reaches the token; seegotchas/deploying.mdand the 403 in #972);AUTH0_EMAIL_SMTP_TOKENoninfra-production(done);mail.brilliant.aionboarded in Cloudflare Email Sending. Auth0 only uses the custom code template with an external provider. The connection's "Disable Sign Ups" is off.
Order
- Merge #969 (done 2026-10-15 16:59 IDT; nothing changed on prod).
- Prod deploy (
deploy.ymlwith an explicit sha that includes #969). It ships the site bundle and the newer control plane. Check the manifest and every file in it answer 200. - Do the reads above.
- As its own small reviewed change, set
enabled: trueandsmtpProvider: truetogether in the prodloginScreensblock, and preview from a checkout of it:cd infra/pulumi && bun ../../scripts/pulumi.ts preview -s prod --diff. Expect only theemailconnection, itsConnectionClients, prompt settings, theEmailProvider, 3PromptScreenRenderers, and the databaseConnectionClientsgoing from studio to none. Any delete or replace stops the rollout. - Merge that change, then dispatch
infrafor prod (noallow-deletes: the flip deletes nothing). It previews and applies in one job. Until the prod site deploy lands, a dispatch withenabled: truefails on the manifest and changes nothing.
Live check right after (fresh browser, app.brilliant.ai): sign up by code (mail from system@mail.brilliant.ai; a wrong code shows an error; the right code lands in a new workspace); log in with the Google button; a Google address entered for a code gets the "signs in with Google" notice; admin unchanged; /auth/app/login shows our screens; every manifest file returns 200; two logins in one browser land in the studio (the lost-state fix).
Unverified on prod: staging was verified with connection=email, but prod sends no connection hint. With no password connection, Auth0 should offer the code itself, and sign-up rides screen_hint=signup to signup-id. Check this first. If it fails, the fix is a small follow-up letting prod name the email connection.
Rollback: set enabled: false (or delete the block) and dispatch prod again with allow-deletes. Read the diff first: the preview gate counts every delete, retained ones included, 7 here. Five are real (3 renderers, the email clients, the EmailProvider) and 2 are state-only (the connection and the prompt). Renderers go away and studio returns to the password connection; the email connection and Identifier First are kept. Anyone who signed up by email code in the window then has no password, so keep the window short. Fastest by hand: PATCH each screen's rendering_mode to standard, then set enabled: false (that dispatch needs allow-deletes too).
Not done: #952 stays open: the apply now verifies the files it pins, but nothing re-checks them after later deploys beyond the deploy-time retention from #951. Prod password users who try an email code get a raw error, not a notice; they are locked out by design because they aren't migrated.
Risk, per the PR: two-way door, but a rollback strands email-code signups. Blast radius once applied: prod sign-in for every studio and published-app user. The flip is #974.
Prod login screens and Cloudflare SMTP turned on (#974, merged)
PR #974 "Prod: turn on the login screens and the Cloudflare SMTP email provider" (merged 2026-10-15 21:00 IDT by yoni-monday, merge 3e3a6a3f, head f0ac6aaf, branch prod-login-on) is step 4 of the #969 rollout: the small reviewed change that flips prod on.
Status (updated 2026-10-15 21:05 IDT): the prod infra dispatch on the merge commit (run 38782117416) was approved but failed with 403 Insufficient scope, expected any of: create:connections while creating the passwordless email connection. Prod's management grant never had that scope; staging's did. The run did create the Identifier First prompt and the EmailProvider. The email connection, its clients, the 3 renderers and the password connection change were skipped because they wait for the connection, so prod sign-in is unchanged (still passwords). The fix is #978 (merged 21:06 IDT). Once a later apply completes, prod sign-in is our ACUL screens with Google and an email code, with no passwords for the studio client, and the live check results go on the PR.
Config change on Pulumi.prod.yaml
brilliant-infra:loginScreens
enabled: false -> true ACUL screens (Google + email code) for the prod studio client
manifestUrl: https://brilliant.ai/login-ui/manifest.json (unchanged)
sender: system@mail.brilliant.ai (unchanged)
smtpProvider: (none) -> true Auth0 mail via smtp.mx.cloudflare.net:465 with AUTH0_EMAIL_SMTP_TOKEN (infra-production)- The password connection now also waits for the
EmailProvider.loginScreens()returns the provider along with the email clients, the prompt and the 3 renderers, so the database connection'sConnectionClients(-database-clients) depend on it (login-screens.ts, comment inauth0.ts). If the provider fails to create, the studio client keeps the password connection, instead of codes going out through Auth0's default sender and template. A new test ininfra/pulumi/test/login-code-email.test.tspins this; it was red before the fix. - Not covered by that guard: a provider that creates fine with a bad SMTP token still closes the password connection, and codes then fail to send. Step 1 of the live check (a code email actually arriving) covers it.
- Every prod Auth0 email moves to Cloudflare SMTP, which is in beta. Staging has run the same config since #972, where a real code email arrived with the branded template.
- Prod can't be previewed locally. Its Pulumi state passphrase is served only to the prod CI token (
infra/pulumi/BOOTSTRAP.md), so the prodinfrarun is the preview.AUTH0_CUSTOM_DOMAINS.mdstep 4 now says so. The run previews and applies in one job, and its gate stops only a delete or replace, so the plan was to dispatch right after merge with nothing in between. The baseline was green run38759932083(18:23 IDT,same: 120). The expected summary is only theemailconnection and itsConnectionClients, the prompt, theEmailProvider, 3PromptScreenRenderers, and the database connection'sConnectionClientsgoing to none. Dispatch withoutallow-deletes. - Grant scopes and sender were already applied. Run
38753896820attempt 1 (17:44 IDT) applied the management grant'semail_providerandupdate:connections_optionsscopes and created themail.brilliant.aiEmail Sending subdomain, then failed on an unrelated R2 catalog step. All of that run's attempts ended as failures; the green prod run is38759932083. This is why later runs showed no grant diff. - Gate at merge time: the prod manifest and both files it lists returned 200, and the scopes and sender were in place. The three read-only Auth0 checks from the #969 list (password users on
Username-Password-Authentication, no existingemailconnection,GET /api/v2/promptsshowing the new experience) were still unticked in the PR body, with the owner to post them on the PR. - PR tests:
infra/pulumi161 pass. The prod program test runs the real prod config with the grant and the provider.
Still unverified on prod: the first sign-up with no connection=email hint. Staging's client still has the password connection, so it can't show this. See "Unverified on prod" under #969.
Prod grant gets create:connections (#978, merged)
PR #978 "Prod Auth0 grant: create:connections for the login screens' email connection" (merged 2026-10-15 21:06 IDT by yoni-monday, merge ad168cc8, head 119a1472, branch prod-grant-create-connections; opened 21:05 IDT) fixes the failed #974 apply.
Pulumi.prod.yaml managementGrant.scopes + create:connections- Why: prod run
38782117416hit403 Insufficient scope, expected any of: create:connectionscreating theemailconnection. Staging's grant already had the scope, so staging never showed this. Lesson: when the two stacks' grant scope lists drift, prod finds the gap at apply time. - Partial state on prod until then: the Identifier First prompt and the
EmailProviderexist; theemailconnection, its clients, the 3PromptScreenRenderers and the database connection'sConnectionClientschange do not. Prod sign-in is unchanged. - Fastest path, one prod dispatch (a new grant scope reaches the token only one apply later, per
gotchas/deploying.mdand #972):- Add
create:connectionsby hand to the infra management app's grant in the prod Auth0 dashboard (Applications, APIs, Auth0 Management API, Machine to Machine Applications, the infra app). The PR config then matches it and Pulumi sees no grant change. - Merge #978 (done 21:06 IDT).
- Dispatch
infraforprodwithoutallow-deletes.
- Add
- Without step 1 the first dispatch adds the scope and fails the same way; a second dispatch completes.
- Status at merge: the prod
infradispatch that completes the flip had not run yet, so prod sign-in is still passwords. After it applies, run the live check from the #969 runbook. - PR tests:
infra/pulumi161 pass; the prod grant test (infra/pulumi/test/auth0-login-infra.test.ts,PROD_BASE_SCOPES) pins the new scope. Risk per the PR: two-way door, blast radius the prod Auth0 grant (one more management scope on the infra app).
Rollback: set enabled: false and dispatch prod with allow-deletes (details under #969). Anyone who signed up by email code in between has no password.
Risk, per the PR: one-way-ish door; blast radius is prod sign-in.
BI pipeline and admin D1 removed from Pulumi (#971, merged)
#971 (merged 2026-10-15 16:41 IDT by yoni-monday, merge cb7500e1) is step 4 of the PostHog stack. Product events go to PostHog, so the Pulumi program drops the BI resources described in the BI section above.
- Destroyed on the next
infrarun for staging and prod: the Pipelines stream, the data catalog, the sink, the pipeline and the admin D1 database.infra/bi/**and theBIpipelines binding are gone from the code. The Iceberg history is lost. brilliant-bibucket retained withretainOnDelete, because Cloudflare won't delete a bucket that still has objects. Empty and delete it by hand afterinfrahas run on both stacks, then drop its declaration fromcloudflare.tsin a follow-up.- Admin D1 database removed. It only held admin dashboards, saved queries and chats. Its Pulumi resource, the
d1ids, the D1 migration steps inenv:up,deployand CI, and its side-env teardown are gone. Evals is now the only worker with a D1 database, and the generic D1 mechanism stays for it. - Fewer token permissions. Pulumi no longer needs the Pipelines and Account API Token permissions, so
BOOTSTRAP.mddrops them. Trim them from the Pulumi token only after theinfraruns.
Rollout order: deploy the new code first (the live control plane still binds the BI stream and the live admin still binds the D1 database until then). Then run infra on staging, then prod; the removals trip ci/removals.ts, so read the preview and re-run with allow-deletes. Then trim the token permissions and delete the R2 tokens, and finally empty and delete the bucket.
See PostHog — Step 4 (#971, merged) and Secrets & environments.
BI_VISITOR_RATELIMIT leaves the wrangler config (#977, merged)
#977 (step 5 of the PostHog stack, merged 2026-10-15 21:25 IDT, merge 13576e01) removed POST /api/bi, so the BI_VISITOR_RATELIMIT binding is only removed from the wrangler config. The PR makes no infra change. Rollout is to deploy the control plane and the site. See PostHog — Step 5 (#977, merged).
Flagship apps and FLAGS binding removed (#982, merged)
#982 (merged 2026-10-16 05:47 IDT by yoni-monday, merge 94410daa, PostHog 6/6) drops Flagship from Pulumi and wrangler; flags evaluate via PostHog.
Code removed (in the merge):
- Pulumi
FlagshipAppfor staging and prod. - The control-plane
FLAGSbinding. FLAGSHIP_TOKENfrom the secrets catalog; Flagship permission from the infra token (BOOTSTRAP.md).
Rollout order still pending (same shape as the BI teardown in #971):
- Deploy the control plane (staging, then prod) — the new worker must not need the binding.
- Then apply
infrawithallow-deletes— destroys Flagship apps. Not before (an old worker would still read the binding). - Delete
FLAGSHIP_TOKENfrom each Secrets Store and trim the Flagship permission from the infra token.
See PostHog — Step 6 and Secrets — Flagship token.
Stripe portal and PostHog webhook (#1000, merged)
PR #1000 (merged 2026-10-17 09:28 IDT by yoni-monday, branch billing-portal-posthog-infra, merge 6518e3c0, final head b0acea57) changes infra/pulumi (Pulumi.staging.yaml, index.ts, README.md, src/environment.ts, src/stripe.ts and tests), plus the openPortal doc comment in apps/control-plane/src/billing/stripe/checkout.ts and the portal row in docs/plans/billing-contracts.md. There are no IAM, Neon, workflow or prod config changes. Prod has no stripe config.
Stripe (staging sandbox)
├─ Customer Portal ── payment methods only (was: + invoice history)
├─ webhook → studio /stripe/webhook (unchanged)
└─ webhook → PostHog Stripe source (only when posthogWebhookUrl is set; staging sets it)- Portal:
STRIPE_PORTAL_FEATURES.invoiceHistoryisfalse, because customers see receipts in Brilliant, never invoices. See Billing & credits.BillingPortalConfigurationhas noreplaceOnChanges, so this is an in-place update. - PostHog endpoint: a
stripe.WebhookEndpointnamed<env>-stripe-posthog-webhook(metadatabrilliant_catalog_id: posthog_webhook) is created only when the stack config setsbrilliant-infra:stripe.posthogWebhookUrl. That value is the URL on the Webhook tab of PostHog's Stripe source.Pulumi.staging.yamlsets it, because the staging source is connected by OAuth and Stripe doesn't let an OAuth app create webhook endpoints. A non-https URL fails the program. With no URL there is exactly one webhook endpoint and no PostHog output. - Events: it is sent
POSTHOG_WEBHOOK_EVENTS, 36 exact event names across customers, charges, invoices, subscriptions, products and prices. It is never sent*, which would also hand a third party payment methods, payouts, disputes and tax ids. Stripe takes exact names only, so a table enabled in PostHog later needs its events added to that list. - Signing secret: it is a secret stack output that a person pastes into PostHog once:
pulumi stack output posthogStripeWebhookSecret --show-secrets. Until then PostHog rejects deliveries as unsigned; nothing breaks. Tests fail if the output loses itspulumi.secretwrap or the event list widens to*.
Rollout after merge:
- PRs are never previewed (
infra.ymldoesn't run PR code with the Cloudflare/Auth0 tokens and state keys), so the first preview is the staging run on merge to main. It should show exactly two changes: oneupdateof…-stripe-portal(changed keyfeatures) and onecreateof…-stripe-posthog-webhook. - If that run shows a
replace, the plan gate stops before applying. Don't re-dispatch withallow-deleteswithout reading the plan. - Paste the signing secret into the staging PostHog Stripe source.
- Before connecting prod's source, confirm PostHog's data-processing terms cover the customer, card-summary and invoice-link data in these events, and confirm with finance the hosted-invoice exception (
payment_requiredfor 3-D Secure or failed charges).
PR tests: infra/pulumi 164 pass, tsc and Biome clean; pulumi preview was not run before merge. Related: PostHog: Stripe source.
Reversed for staging (#1009, merged 2026-10-18 17:21 IDT): staging no longer syncs to PostHog; only prod will connect, once its live Stripe account exists. Pulumi.staging.yaml no longer sets posthogWebhookUrl, so the staging infra run after the merge stops at the plan gate with one delete, …-stripe-posthog-webhook. Re-dispatch infra.yml for staging with allow-deletes once the plan shows only that delete. Rollout steps 3 and 4 above now apply to prod only. Prod setup steps and the manual staging cleanup are in PostHog: revenue analytics, prod only.
Stripe on prod: catalog, webhook and portal (#1023, merged)
PR #1023 ("Stripe on prod: declare the live account's catalog, webhook and portal") was opened 2026-10-19 13:46 IDT and merged 2026-10-19 13:47 IDT by yoni-monday (branch stripe-prod-enable, head f4abf8f4, merge e8d6d5dc, 1 commit, 3 files). The merge itself changed nothing in prod: the live Stripe objects exist only after the reviewed prod infra run below. docs/plans/billing-contracts.md §8a now reads "steps 1–3 and 6 done; step 4 is Pulumi.prod.yaml's brilliant-infra:stripe block" It is step 4 of the prod rollout in docs/plans/billing-contracts.md §8a: infra/pulumi/Pulumi.prod.yaml gets the same brilliant-infra:stripe: { enabled: true } block staging has. Steps 1 to 3 and 6 are done: the live Stripe account exists, STRIPE_PULUMI_API_KEY is set on the infra-production GitHub Environment, and the runtime's restricted STRIPE_SECRET_KEY is in prod's Secrets Store (never Pulumi-managed, same as staging).
Stripe (live account), created by the prod infra apply
├─ Products and Prices from packages/billing-catalog
├─ webhook → https://app.brilliant.ai/stripe/webhook (the 14 handled events;
│ secret → prod store STRIPE_WEBHOOK_SECRET)
└─ Customer Portal payment methods only, no invoice history (see #1000)- Pre-apply check: PRs get no infra preview, so a new test in
infra/pulumi/test/stripe.test.tsruns the stack program with prod's realPulumi.prod.yamland checks that the webhook URL is exactlyhttps://app.brilliant.ai/stripe/webhook, that the catalog declares prices, and that there is one portal configuration. Removing the block fromPulumi.prod.yamlfails it. - No PostHog endpoint yet: prod still sets no
posthogWebhookUrl. That is §8a step 8, after the data-processing sign-off; see PostHog: revenue analytics, prod only.
Rollout after the merge (from the PR):
- Merging changes nothing by itself. The merge's automatic infra run is staging-only, and staging's plan is unaffected.
- Prod changes only when someone runs
infra.ymlfor stackprodand theinfra-productionreviewer approves. - The prod plan should be creates only: products, prices, the webhook endpoint, the portal configuration and the
STRIPE_WEBHOOK_SECRETstore entry. Any update, delete or replace means stop. - After the apply, run the
secrets-workerworkflow for prod so it binds the newSTRIPE_*names, then deploy prod. Until then prod keeps answeringbilling_not_configured.
Related: Billing & credits: Stripe on prod (#1023, merged), Stripe portal and PostHog webhook (#1000, merged), Troubleshooting: prod answers billing_not_configured.
www redirects to the marketing apex (#997, merged)
PR #997 (merged 2026-10-17 08:32 IDT by yoni-monday, merge 4aef8c6c, final head def4571d) fixes the QA report from 2026-10-16 that https://www.brilliant.ai/ returned Cloudflare 521 while the apex https://brilliant.ai/ returned 200. The live www.brilliant.ai was a hand-made proxied A record pointing at 52.60.87.163, an origin that doesn't answer, and the apex zone had no redirect rule.
DNS and zone rules for this live in Pulumi (infra/pulumi), not Terraform or wrangler. When domains.site is an apex (exactly two labels), wwwToApexRedirect in infra/pulumi/src/domain-redirects.ts adds two resources to the site's zone:
- DNS: a proxied
AAAA 100::record forwww.<site>(resource<env>-www-apex-dns), so the hostname reaches Cloudflare without an origin behind it. - Redirect: a zone ruleset on phase
http_request_dynamic_redirect(resource<env>-www-apex, rulewww_to_apex) that sendswww.<site>tohttps://<site><path>with 301, keeping the query string.
www.brilliant.ai/<path>?q ──301──▶ https://brilliant.ai/<path>?q (apex zone, new)
itsbrilliant.ai hosts ──308──▶ brilliant.ai hosts (itsbrilliant.ai zone, unchanged)- Which stacks: every stack whose
domains.siteis an apex, so both prodbrilliant.aiand stagingbrilliant.rocksget it. A site on a subdomain (likeapp.brilliant.ai) is skipped;wwwHost()returnsnullfor anything that isn't two labels. - Why 301 and not 308:
wwwis a permanent alias of the marketing site, so a 301 is what caches and clients should store. The old-host migration ruleset (domainRedirects) stays 308 on theitsbrilliant.aizone and is unrelated. See Move prod public domains to brilliant.ai (#831). - One ruleset per phase per zone. Cloudflare allows only one
http_request_dynamic_redirectentrypoint per zone. On 2026-10-16 neitherbrilliant.ainorbrilliant.rockshad one (and neither had page rules), so this ruleset doesn't replace a hand-made one. A later redirect on either apex zone has to be added to this ruleset, not as a second one.
Rollout (not applied by the merge; staging and prod applies stay lead-only):
- Staging first.
brilliant.rockshas nowwwrecord, so the staging apply is the rehearsal. Confirmhttps://www.brilliant.rocks/returns 301 tohttps://brilliant.rocks/. - Before the first prod apply, delete the hand-made prod A record for
www.brilliant.ai(record78a97e0f38639cb250716a52727b1003in zonee25d273fc3fda34d0cd839291cfeb47d, content52.60.87.163). Cloudflare rejects a second record on the same name, and an A record can't be imported as this AAAA, so the prod apply fails while it exists. Nothing else uses it. - Apply prod and confirm
https://www.brilliant.ai/returns 301 to the apex.
Status 2026-10-17 (from #1013): staging www.brilliant.rocks already 301s to the apex; prod www.brilliant.ai still returns 521 because the hand-made A record is still there. domain-cutover.test.ts now fails if a www A record is added in code.
PR tests: infra/pulumi/test/domain-cutover.test.ts now expects two rulesets (migration 308 on itsbrilliant.ai, www 301 on brilliant.ai) plus the proxied AAAA; infra/pulumi/test/www-apex.test.ts covers wwwHost(). Related: Marketing site — www host and Troubleshooting — www returns 521.
AI crawlers allowed on the marketing zone (#1013, merged)
PR #1013 (merged 2026-10-17 23:22 IDT by yoni-monday, merge 200c1e27; not applied by the merge) stops Cloudflare from blocking AI crawlers on the marketing site. allowAiCrawlers in infra/pulumi/src/ai-crawlers.ts (wired from cloudflare.ts) declares a cloudflare.BotManagement resource on the zone of domains.site (prod brilliant.ai, staging brilliant.rocks) with aiBotsProtection: "disabled" and isRobotsTxtManaged: false. The published-apps zone isn't touched. Studio and admin share the marketing zone today, so they're covered too, which is the same scope as the block it replaces. The site build then serves its own robots.txt that allows the AI crawlers (Marketing site — crawl metadata (#1013)).
Pulumi now owns these zone bot settings. Things to know before touching them:
- The first apply sends only
ai_bots_protectionandis_robots_txt_managed. Later applies re-send the recorded state (fight_mode,sbfm_*,enable_js,crawler_protectionand the otherUseNonNullStateForUnknownfields), which undoes dashboard edits. Run applies with--refresh, and make bot-setting changes in this code rather than the dashboard. - Deleting the resource does not bring the block back; the provider's delete only drops it from state. To restore the block, set
aiBotsProtection: "block"andisRobotsTxtManaged: truein code (or change the dashboard and refresh before the next apply). botPreferenceSyncEnabled,cfRobotsVariant,ai_search,ai_trainingandai_userare not sent. They exist on the resource in@pulumi/cloudflare6.21.0, but the vendored terraform-provider-cloudflare 5.25.0 never copies them into the API request, so setting them would record a value the API never got. If the liverobots.txtstill has a# BEGIN Cloudflare Managed contentblock after the apply, that's Bot Preference Sync, and it needs a provider that serializes those fields or a dashboard change mirrored in code.
Rollout check (staging first, before any prod apply; applies stay lead-only):
- Save
GET /zones/<brilliant.rocks zone id>/bot_managementbefore the apply. - Run
pulumi preview --diff, then apply with--refresh. GETthe same endpoint again and diff the two bodies. Onlyai_bots_protection(disabled) andis_robots_txt_managed(false) should change.curl https://brilliant.rocks/robots.txtand confirm there's no# BEGIN Cloudflare Managed contentblock and no Bot Preference Sync injection.
Token permission (from PR #1024, merged 2026-10-19, docs only): the stack's Cloudflare API token needs Zone > Bot Management > Edit on the site zone (brilliant.ai, brilliant.rocks). Without it the apply fails with 403 on PUT …/bot_management; staging's apply failed that way. The grant is now in the token list in infra/pulumi/BOOTSTRAP.md. Grant it on staging's token, and on prod's before the prod apply.
Repeat the same read-back on prod only after the hand-made www A record is deleted (see #997 rollout). PR tests: infra/pulumi/test/ai-crawlers.test.ts (new) and domain-cutover.test.ts, which now fails if a www A record is declared.
Company accounts are separate from monday
Brilliant's infra runs on its own, new Cloudflare accounts, but those accounts are still billed to monday (Yoni, 2026-10-13).
For email on the new brilliant.ai domain, Yoni asked other moonshot teams whether to join monday's Google Workspace or open a new one. Their advice was to make everything new and separate: cloud infra, tool subscriptions (Claude, Codex and the like), infrastructure, and payments through Stripe. Yoni said he would open a new Google Workspace for Brilliant, and Matan Lachmish agreed that a new workspace is the right call.
Source: Slack #moonshots-gang, thread from 2026-10-13 13:38 IDT (replies through 2026-10-14).
Apps zone is HTTPS-only with HSTS (#1015, merged)
PR #1015 "Keep app tokens and the evals key off plain HTTP and query strings" (merged 2026-10-18 17:23 IDT by yoni-monday, merge 49dddd9e) gives the published-apps zone (brilliant-app.ai in prod, brilliant-app.rocks on staging) the same zoneHttpsOnly settings the marketing zone already had (infra/pulumi/src/zone-https.ts, called from apps-zone.ts). Live behaviour changes only after pulumi up on each stack.
| Setting | Marketing zone (brilliant.ai / brilliant.rocks) | Apps zone (brilliant-app.ai / brilliant-app.rocks) |
|---|---|---|
| Always Use HTTPS | on | on, so http:// to an app host is redirected |
HSTS max-age | one year | one year |
includeSubDomains | on (its subdomains are platform hosts) | off |
preload | off | off |
nosniff | off | off |
Why includeSubDomains is off on the apps zone. Published apps are the subdomains, and Cloudflare attaches the zone HSTS header to each app host, which pins that host. includeSubDomains would also pin every name under an app host for a year. App code is model-authored and may point at nested hosts this zone doesn't serve (the wildcard certificate covers one label, *.<apps-domain>), so leaving it off avoids breaking those names. zoneHttpsOnly now takes an optional { includeSubdomains } argument that defaults to true; turn it off for any zone whose subdomains are tenant apps. preload stays off everywhere because getting a name off the preload list takes months.
Token permission (from PR #1024, merged 2026-10-19, docs only): the stack's Cloudflare API token needs Zone > Zone Settings > Edit on the apps zone (brilliant-app.ai, brilliant-app.rocks) too, not only on the marketing zone. Staging's token already has it (the same run created both settings); check prod's before the prod apply. It is now in the token list in infra/pulumi/BOOTSTRAP.md.
Rollout check (from the PR). Apply on staging first, then curl an app host over http and https and confirm the redirect and the Strict-Transport-Security header before applying prod.
Rollback. Deleting the HSTS / Always Use HTTPS ZoneSetting doesn't undo HSTS: Cloudflare's delete is a no-op, and a browser that already stored the header keeps it until max-age runs out (one year). To roll back, set maxAge to 0, apply, and only then remove the resource.
Tests: infra/pulumi/test/zone-https.test.ts now expects both zones per stack (includeSubdomains: false on the apps zone). Related: Dispatch — app return_to must be https (#1015), Marketing site — security headers.