Open source CapCut alternative.
TypeScript
refactor(site): describe overrides, blog writes and offers without naming su
David Le4ad11f2eb286
diff --git a/site/.env.example b/site/.env.exampleindex ca04d44a..a988856f 100644--- a/site/.env.example+++ b/site/.env.example@@ -11,9 +11,8 @@ CHATGPT_OIDC_PRIVATE_KEY="replace-with-private-key-pem"# (analytics run, cut-cloud gc) reject requests without it.CRON_SECRET="replace-with-a-long-random-secret"-# Bearer token the internal su app sends to /api/blog/revalidate after a blog-# write, so this app clears and re-renders its cached blog pages. The su-# deployment holds the same value.+# Bearer token /api/blog/revalidate requires before it clears and re-renders+# the cached blog pages. Whatever writes blog posts sends the same value.BLOG_REVALIDATE_SECRET=GOOGLE_CLIENT_ID="replace-with-google-web-client-id"GOOGLE_CLIENT_SECRET="replace-with-google-web-client-secret"diff --git a/site/packages/abexp/src/results.ts b/site/packages/abexp/src/results.tsindex a8f936f5..2253acf7 100644--- a/site/packages/abexp/src/results.ts+++ b/site/packages/abexp/src/results.ts@@ -2,8 +2,8 @@ import type { ExperimentMetric } from "./experiment";import { probabilityBeats, sampleSizePerArm, twoProportionTest } from "./stats";// An experiment's read, computed from exposure and conversion counts by the-// results job and stored on the row. The verdict answers the one question su-// asks: roll it out, stop it, or keep running — and how much longer.+// results job and stored on the row. The verdict answers one question: roll+// it out, stop it, or keep running — and how much longer.// Exposures each arm needs, and conversions across the pair, before a// positive result is believed.diff --git a/site/prisma/Credits.prisma b/site/prisma/Credits.prismaindex 374782ac..39c1e0f0 100644--- a/site/prisma/Credits.prisma+++ b/site/prisma/Credits.prisma@@ -51,7 +51,7 @@ model CreditOffer {id String @id @default(cuid())userId Stringuser User @relation(fields: [userId], references: [id], onDelete: Cascade)- // What made the offer: "manual" from su, or the promotion's key.+ // What made the offer: "manual" by hand, or the promotion's key.kind String @default("manual")amountMicros BigInt// The credit's life once claimed: a fixed moment, or days from the claim;diff --git a/site/prisma/Experiments.prisma b/site/prisma/Experiments.prismaindex 686da9e2..afa5907d 100644--- a/site/prisma/Experiments.prisma+++ b/site/prisma/Experiments.prisma@@ -1,6 +1,6 @@// Runtime configuration and experiments. Every tunable is declared in code// (src/lib/config/registry.ts) with a default and a schema; a row here exists-// only for a key a super user changed from su.donkeycut.com.+// only for a key a super user overrode.model SettingOverride {key String @id@@ -41,7 +41,7 @@ model Experiment {// Sticky: once a user is assigned, the row is what they read, whatever the// audience says later. A null variant holds the user out of this experiment.-// A manual row was written from su and stands in place of the hash.+// A manual row was written by hand and stands in place of the hash.model ExperimentAssignment {id String @id @default(cuid())experimentId Stringdiff --git a/site/prisma/Marketing.prisma b/site/prisma/Marketing.prismaindex 54438343..d423140a 100644--- a/site/prisma/Marketing.prisma+++ b/site/prisma/Marketing.prisma@@ -1,8 +1,8 @@// Founder outreach: one row per account per campaign, seeded by the nightly-// outreach-scan job (src/lib/jobs/outreach-scan.ts) and worked by hand from the-// super-user Outreach tab. The row is a marker, not a mailbox — it carries-// status, timestamps, and the scan's credit snapshot, never a subject or a message-// body. The conversation itself lives in the operator's inbox.+// outreach-scan job (src/lib/jobs/outreach-scan.ts) and worked by hand. The+// row is a marker, not a mailbox — it carries status, timestamps, and the+// scan's credit snapshot, never a subject or a message body. The conversation+// itself lives in the operator's inbox.model UserOutreach {id String @id @default(cuid())@@ -18,7 +18,7 @@ model UserOutreach {lastSentAt DateTime?repliedAt DateTime?ignoredAt DateTime?- // The super user whose click sent or filed the row.+ // The super user who sent or filed the row.actorUserId String?// The scan's snapshot, so the list renders from this table alone.spentMicros BigInt @default(0)@@ -63,7 +63,7 @@ model OutreachTemplate {updatedAt DateTime @updatedAt}-// A promotion is one email written on su and sent to a segment: an audience+// A promotion is one email sent to a segment: an audience// (the experiment rules, minus country) and, optionally, everyone who already// received earlier promotions left out. The words live here so a draft can be// edited, test-sent and counted before anything goes out. Sending resolves thediff --git a/site/scripts/backfill-signup-credit-expiry.ts b/site/scripts/backfill-signup-credit-expiry.tsindex e5865e73..432a9258 100644--- a/site/scripts/backfill-signup-credit-expiry.ts+++ b/site/scripts/backfill-signup-credit-expiry.ts@@ -23,7 +23,7 @@ const apply = process.argv.includes("--apply");const setting = await getGlobalSetting("signupCredits");const expiresAt = creditGrantExpiry(setting.expiresAfterDays);if (!expiresAt) {- console.error("signupCredits grants never expire; set a lifetime on su first");+ console.error("signupCredits grants never expire; set the signupCredits lifetime override first");process.exit(1);}diff --git a/site/scripts/backfill-signup-credit.ts b/site/scripts/backfill-signup-credit.tsindex 5208cb72..59356c5a 100644--- a/site/scripts/backfill-signup-credit.ts+++ b/site/scripts/backfill-signup-credit.ts@@ -23,7 +23,7 @@ if (userIds.length === 0) {const setting = await getGlobalSetting("signupCredits");if (setting.dollars <= 0) {- console.error("signupCredits grants nothing; set the amount on su first");+ console.error("signupCredits grants nothing; set the signupCredits amount override first");process.exit(1);}diff --git a/site/src/app/api/analytics/run/route.ts b/site/src/app/api/analytics/run/route.tsindex 77cadfe7..e75220c6 100644--- a/site/src/app/api/analytics/run/route.ts+++ b/site/src/app/api/analytics/run/route.ts@@ -8,7 +8,7 @@ import { enqueueJob } from "@/lib/jobs/queue";export const maxDuration = 300;// The nightly analytics run. Vercel's cron authenticates with the CRON_SECRET-// bearer token; manual runs start from su.+// bearer token; a manual run enqueues the same job.export const GET = async (request: NextRequest) => {if (!(await isVercelCron(request))) return notFoundResponse();return NextResponse.json(await enqueueJob("analytics-daily", {}, "vercel-cron"));diff --git a/site/src/app/api/blog/preview/route.ts b/site/src/app/api/blog/preview/route.tsindex 8d5ebe3f..f4149982 100644--- a/site/src/app/api/blog/preview/route.ts+++ b/site/src/app/api/blog/preview/route.ts@@ -8,8 +8,8 @@ import { prisma } from "@/lib/prisma";const idSchema = z.string().trim().min(1);-// The su editor's Preview button lands here on the apex host, because the-// Draft Mode cookie is host-only. Draft Mode makes the blog's cached reads run+// A super user previews a draft here on the apex host, because the Draft Mode+// cookie is host-only. Draft Mode makes the blog's cached reads run// fresh for this browser and include drafts; everyone else keeps the cache.export const GET = withSuperUser(async (request) => {const id = idSchema.safeParse(request.nextUrl.searchParams.get("id"));diff --git a/site/src/app/api/blog/revalidate/route.ts b/site/src/app/api/blog/revalidate/route.tsindex f66bf0b0..5a8e97a9 100644--- a/site/src/app/api/blog/revalidate/route.ts+++ b/site/src/app/api/blog/revalidate/route.ts@@ -5,9 +5,9 @@ import { z } from "zod";import { revalidateBlogLater, revalidateBlogNow } from "@/lib/blog/revalidate";-// The blog editor runs in the internal su app, a separate deployment. Its-// writes change rows this app's blog pages have cached, and a cache clears only-// from inside the app that holds it, so the editor posts here after each write.+// Blog posts are written by a separate deployment. Its writes change rows this+// app's blog pages have cached, and a cache clears only from inside the app+// that holds it, so the writer posts here after each write.// Deliberately not wrapped in withDonkeyAuth — the caller is a machine, not a// session — and gated by a shared secret, like the job worker's callback.diff --git a/site/src/app/api/credits/expire/route.ts b/site/src/app/api/credits/expire/route.tsindex 6efe084c..d6d0b015 100644--- a/site/src/app/api/credits/expire/route.ts+++ b/site/src/app/api/credits/expire/route.ts@@ -8,7 +8,7 @@ import { enqueueJob } from "@/lib/jobs/queue";export const maxDuration = 300;// The nightly credit-expiry sweep. Vercel's cron authenticates with the-// CRON_SECRET bearer token; a manual run starts from su.+// CRON_SECRET bearer token; a manual run enqueues the same job.export const GET = async (request: NextRequest) => {if (!(await isVercelCron(request))) return notFoundResponse();return NextResponse.json(await enqueueJob("credit-expiry", {}, "vercel-cron"));diff --git a/site/src/app/api/credits/expiry-notices/route.ts b/site/src/app/api/credits/expiry-notices/route.tsindex 844144d9..82a51c07 100644--- a/site/src/app/api/credits/expiry-notices/route.ts+++ b/site/src/app/api/credits/expiry-notices/route.ts@@ -8,7 +8,7 @@ import { enqueueJob } from "@/lib/jobs/queue";export const maxDuration = 300;// The daily credit-expiry notice. Vercel's cron authenticates with the-// CRON_SECRET bearer token; a manual run starts from su.+// CRON_SECRET bearer token; a manual run enqueues the same job.export const GET = async (request: NextRequest) => {if (!(await isVercelCron(request))) return notFoundResponse();return NextResponse.json(await enqueueJob("credit-expiry-notice", {}, "vercel-cron"));diff --git a/site/src/app/api/experiments/results/route.ts b/site/src/app/api/experiments/results/route.tsindex 4061a8ae..1fc21943 100644--- a/site/src/app/api/experiments/results/route.ts+++ b/site/src/app/api/experiments/results/route.ts@@ -9,7 +9,7 @@ export const maxDuration = 300;// The nightly results run for every live experiment. Vercel's cron// authenticates with the CRON_SECRET bearer token; a run for one experiment-// starts from su.+// enqueues the same job with its id.export const GET = async (request: NextRequest) => {if (!(await isVercelCron(request))) return notFoundResponse();return NextResponse.json(await enqueueJob("experiment-results", {}, "vercel-cron"));diff --git a/site/src/app/api/marketing/outreach/scan/route.ts b/site/src/app/api/marketing/outreach/scan/route.tsindex 6cba4c2a..e22452bc 100644--- a/site/src/app/api/marketing/outreach/scan/route.ts+++ b/site/src/app/api/marketing/outreach/scan/route.ts@@ -8,7 +8,7 @@ import { enqueueJob } from "@/lib/jobs/queue";export const maxDuration = 300;// The nightly outreach scan. Vercel's cron authenticates with the CRON_SECRET-// bearer token; a manual scan starts from su.+// bearer token; a manual scan enqueues the same job.export const GET = async (request: NextRequest) => {if (!(await isVercelCron(request))) return notFoundResponse();return NextResponse.json(await enqueueJob("outreach-scan", {}, "vercel-cron"));diff --git a/site/src/app/cut/blog/page.tsx b/site/src/app/cut/blog/page.tsxindex 43d29e0d..d98d893d 100644--- a/site/src/app/cut/blog/page.tsx+++ b/site/src/app/cut/blog/page.tsx@@ -30,7 +30,7 @@ export const instant = true;// The blog index, served at /blog by the proxy's "/…" → "/cut/…" rewrite. The// list is a cached read, so it joins the static shell and refreshes when a-// post is saved on su.+// save calls the revalidate route.export default function BlogIndexPage() {return (<BlogShell>diff --git a/site/src/app/cut/sitemap.ts b/site/src/app/cut/sitemap.tsindex 7fc2b608..dd396de7 100644--- a/site/src/app/cut/sitemap.ts+++ b/site/src/app/cut/sitemap.ts@@ -7,7 +7,7 @@ import { listPublishedPosts } from "@/lib/blog/read";// Served at donkeycut.com/sitemap.xml via the proxy rewrite (src/proxy.ts).// The legal pages are canonical on this host, since they describe Donkey Cut.// The blog entries come from the same cached read the index uses, so a-// publish on su refreshes them; the dates are the rows' own, never the clock,+// publish refreshes them; the dates are the rows' own, never the clock,// which keeps the route prerenderable.export default async function sitemap(): Promise<MetadataRoute.Sitemap> {const posts = await listPublishedPosts();diff --git a/site/src/cut/lib/hosts.ts b/site/src/cut/lib/hosts.tsindex b8c3600b..5c117420 100644--- a/site/src/cut/lib/hosts.ts+++ b/site/src/cut/lib/hosts.ts@@ -4,9 +4,8 @@// donkeycut.com at the edge (Cloudflare) and never reach this app.//// The set below is the product host and its aliases, and it is what the-// www-to-apex canonicalization keys off. Sibling subdomains — media, worker,-// reply, su — are deliberately outside it: each is its own surface with its-// own routing.+// www-to-apex canonicalization keys off. Sibling subdomains are deliberately+// outside it: each is its own surface with its own routing.//// Local dev is deliberately absent from the set: the proxy serves localhost// the same mapping, keeping the session cookie same-origin on the one dev@@ -40,8 +39,7 @@ export const OUTREACH_REPLY_HOST = "reply.donkeycut.com";export const CUT_WORKER_HOST = "worker.donkeycut.com";export const CUT_WORKER_WAKE_URL = `https://${CUT_WORKER_HOST}/wake`;-// The super-user app lives in a private repo on its own host and signs in-// through donkeycut.com, which trusts it as a callback origin (src/lib/auth.ts).+// An internal admin app on su.donkeycut.com signs in through this host.export const SU_HOST = "su.donkeycut.com";export const SU_ORIGIN = `https://${SU_HOST}`;diff --git a/site/src/emails/promotion.tsx b/site/src/emails/promotion.tsxindex 5c1d5929..801e6478 100644--- a/site/src/emails/promotion.tsx+++ b/site/src/emails/promotion.tsx@@ -15,7 +15,7 @@ import { Fragment } from "react";import { DonkeyMark } from "./_components/DonkeyMark";-// A promotion written on su: its paragraphs, an optional button, and the+// A promotion: its paragraphs, an optional button, and the// opt-out footer. Sent by src/lib/marketing/promotions.ts; preview with// `npm run email:dev`. This module stays pure — the react-email preview server// bundles it on its own, so everything it needs comes in as props.diff --git a/site/src/lib/analytics/pipeline.ts b/site/src/lib/analytics/pipeline.tsindex 594623b2..4e6f8e9b 100644--- a/site/src/lib/analytics/pipeline.ts+++ b/site/src/lib/analytics/pipeline.ts@@ -1,7 +1,7 @@// Nightly analytics pipeline. Extraction writes one small JSON file per day// per source to R2, a snapshot of users and balances is rewritten every run,// and consolidation folds the window into the single rollup.json the-// superuser dashboard reads. Idempotency is per day: a day file is *final*+// analytics routes read. Idempotency is per day: a day file is *final*// once it was written after its UTC day closed, and final files are skipped// unless forced — so a premature run of today, a per-day retrigger, and the// regular nightly run all compose without redoing finished work.diff --git a/site/src/lib/analytics/summarize.ts b/site/src/lib/analytics/summarize.tsindex f68af0ff..34fe3346 100644--- a/site/src/lib/analytics/summarize.ts+++ b/site/src/lib/analytics/summarize.ts@@ -1,7 +1,7 @@// The rollup folded to what a dashboard draws: one point per day plus the-// headline numbers. Pure, and the only place those numbers are computed — the-// su charts and the phone both read the result, so neither walks the user-// list to draw a line.+// headline numbers. Pure, and the only place those numbers are computed —+// every dashboard reads the result, so none walks the user list to draw a+// line.import type { AnalyticsRollup } from "@/lib/analytics/schema";/** Activity is null for a day the pipeline never extracted: nothing was read,diff --git a/site/src/lib/auth.ts b/site/src/lib/auth.tsindex 45c2adfb..5644824d 100644--- a/site/src/lib/auth.ts+++ b/site/src/lib/auth.ts@@ -16,8 +16,9 @@ import { sendVerificationEmail } from "@/lib/email/send-verification";// it from the localhost request.const baseURL = process.env.VERCEL ? DONKEYCUT_CANONICAL : undefined;-// The session is shared with the apex's subdomains: the super-user app (a-// private repo) is its own host, and a host-only cookie would never reach it.+// The session is shared with the apex's subdomains: an internal admin app on+// su.donkeycut.com signs in through this host, and a host-only cookie would+// never reach it.// Scoping the auth cookies to the registrable host lets the session ride// across, and listing the subdomain as a trusted origin lets a sign-in started// there name its own address as the post-auth callback. Hosted only —diff --git a/site/src/lib/billing/webhook-events.ts b/site/src/lib/billing/webhook-events.tsindex a5ad5d83..bc203c3d 100644--- a/site/src/lib/billing/webhook-events.ts+++ b/site/src/lib/billing/webhook-events.ts@@ -1,4 +1,4 @@-// Stripe events that change what the super-user analytics show: money moving+// Stripe events that change what the analytics show: money moving// or failing to, a subscription changing state, a checkout walked away from.// The webhook queues a billing refresh for each; the ones without a handler// of their own exist only for that. This list, plus the handled events, isdiff --git a/site/src/lib/blog/keys.ts b/site/src/lib/blog/keys.tsindex 14707014..c81f4a0b 100644--- a/site/src/lib/blog/keys.ts+++ b/site/src/lib/blog/keys.ts@@ -1,6 +1,6 @@// Where a blog post lives: the key scheme in R2, the public addresses on-// donkeycut.com, and the list's page size. Client-safe, so the su editor and-// the public pages build the same paths.+// donkeycut.com, and the list's page size. Client-safe, so any page builds+// the same paths.import { CUT_MEDIA_ORIGIN } from "@/cut/lib/hosts";// Everything a post owns sits under this prefix, so a delete sweeps it whole.diff --git a/site/src/lib/blog/read.ts b/site/src/lib/blog/read.tsindex b1fe7fe6..86b36181 100644--- a/site/src/lib/blog/read.ts+++ b/site/src/lib/blog/read.ts@@ -1,7 +1,7 @@// The public read path. Every function here is a cache scope tagged so a save-// on su clears exactly the pages that showed the post. Draft Mode (the su-// Preview button) re-runs these per request without storing the result, and-// is the only way a draft reaches a page.+// clears exactly the pages that showed the post. Draft Mode (the preview+// route) re-runs these per request without storing the result, and is the+// only way a draft reaches a page.import { cacheLife, cacheTag } from "next/cache";import { draftMode } from "next/headers";diff --git a/site/src/lib/blog/revalidate.ts b/site/src/lib/blog/revalidate.tsindex ab55e9e2..74527cdd 100644--- a/site/src/lib/blog/revalidate.ts+++ b/site/src/lib/blog/revalidate.ts@@ -1,4 +1,4 @@-// Every write on su ends here, so the list, the sitemap and the post's own+// Every blog write ends here, so the list, the sitemap and the post's own// page drop their copies at once. Expired outright: a route handler cannot use// updateTag, and the stale-while-revalidate profile would show the first// visitor after a publish the page from before it.diff --git a/site/src/lib/config/effective.ts b/site/src/lib/config/effective.tsindex ed93e6ad..f2ef5700 100644--- a/site/src/lib/config/effective.ts+++ b/site/src/lib/config/effective.ts@@ -8,9 +8,9 @@ import { resolveSettings } from "@/lib/config/resolve";import type { DonkeyAuthenticatedRequest } from "@/lib/donkey-api-auth";import { configureDatabasePool, prisma } from "@/lib/prisma";-// What one user's configuration is right now: overrides from su, plus the-// variants of every running experiment they are assigned to. Assignment-// happens here, on first read, and sticks.+// What one user's configuration is right now: overrides from the database,+// plus the variants of every running experiment they are assigned to.+// Assignment happens here, on first read, and sticks.export type ConfigContext = {userId: string;diff --git a/site/src/lib/config/experiment.ts b/site/src/lib/config/experiment.tsindex c696087c..3b0fc476 100644--- a/site/src/lib/config/experiment.ts+++ b/site/src/lib/config/experiment.ts@@ -2,8 +2,8 @@ import { experimentSchemas } from "@donkeycut/abexp";import { SETTINGS } from "@/lib/config/registry";-// The experiment schemas bound to this product's registry, so the su form and-// the route validate variant settings against the same declarations.+// The experiment schemas bound to this product's registry, so every writer and+// reader validates variant settings against the same declarations.export {EXPERIMENT_STATUSES,diff --git a/site/src/lib/config/registry.ts b/site/src/lib/config/registry.tsindex 248ed100..a48f30ad 100644--- a/site/src/lib/config/registry.ts+++ b/site/src/lib/config/registry.ts@@ -16,9 +16,9 @@ import { maxCreditGrantDollars, maxCreditGrantExpiryDays } from "@/lib/credits/t// The settings registry: every runtime tunable the product has, declared once// with a schema and a default. A value resolves default < override < variant-// (src/lib/config/resolve.ts); su edits the override, an experiment supplies-// the variant. Client-safe: zod only, so the su forms read the same-// declarations the server validates against. A feature that people might+// (src/lib/config/resolve.ts); a database row holds the override, an+// experiment supplies the variant. Client-safe: zod only, so a form reads the+// same declarations the server validates against. A feature that people might// tune ships its setting here in the same change.function validTimeZone(zone: string): boolean {@@ -506,10 +506,6 @@ export const SETTINGS = defineSettings({},});-// The settings su shows on its Product tab: what an account gets. The-// settings tab under Experiments still lists every key.-export const PRODUCT_SETTING_KEYS = ["signupCredits", "creditExpiryNotice", "manualCreditOffer", "promotionCreditOffer", "subscribeBonus", "proAllowancePromotion", "proEndingNotice"] as const satisfies readonly SettingKey[];-export type SettingKey = keyof typeof SETTINGS;export type Settings = SettingsOf<typeof SETTINGS>;export type PublicSettingKey = PublicKeyOf<typeof SETTINGS>;diff --git a/site/src/lib/credits/offerKinds.ts b/site/src/lib/credits/offerKinds.tsindex 4123dd6c..755c87ab 100644--- a/site/src/lib/credits/offerKinds.ts+++ b/site/src/lib/credits/offerKinds.ts@@ -3,7 +3,7 @@ import type { OfferClaim } from "@/lib/credits/offerTerms";// The kinds of credit offer, and what lands each. A leaf module, so the// modules that make and claim offers can share the names without a cycle.-// The kind su makes by hand, claimed from its email link.+// The kind made by hand, claimed from its email link.export const MANUAL_OFFER_KIND = "manual";// The kinds an email with offer terms makes, one per claim: the link in the// email, or a Pro subscription started inside the window. An id is the@@ -17,7 +17,7 @@ export function promotionOfferKind(claim: OfferClaim): string {return claim === "subscribe" ? PROMOTION_SUBSCRIBE_OFFER_KIND : PROMOTION_OFFER_KIND;}-// The kinds a claim link lands: the ones su sends by hand and the ones a+// The kinds a claim link lands: the ones sent by hand and the ones a// promotion mails with a link. Every other kind lands from the act it rewards.export const LINK_CLAIMED_KINDS = [MANUAL_OFFER_KIND, PROMOTION_OFFER_KIND] as const;diff --git a/site/src/lib/credits/offerTerms.ts b/site/src/lib/credits/offerTerms.tsindex 79eb0e1d..821533ac 100644--- a/site/src/lib/credits/offerTerms.ts+++ b/site/src/lib/credits/offerTerms.ts@@ -1,6 +1,6 @@import { z } from "zod";-// The terms of a credit offer an email carries, as su writes them: how much,+// The terms of a credit offer an email carries: how much,// what lands it, how long the person has to take it up, and how long the// credit lives once it lands. A promotion to a segment and an outreach note// to one person share these terms and the placeholders that name the offer indiff --git a/site/src/lib/credits/top-up.ts b/site/src/lib/credits/top-up.tsindex 4b8f5ab1..a178f0f5 100644--- a/site/src/lib/credits/top-up.ts+++ b/site/src/lib/credits/top-up.ts@@ -11,17 +11,17 @@ export const creditTopUpMinDollars = 5;export const creditTopUpMaxDollars = 2_000;// The default pay-as-you-go amount: the value we pre-fill / fall back to when no-// other amount is chosen (auto-reload default, the "buy once to save a card"-// nudge, and the super user grant default all key off this so they stay in sync).+// other amount is chosen (the auto-reload default and the "buy once to save a+// card" nudge both key off this so they stay in sync).export const creditTopUpDefaultDollars = 25;// Stripe metadata "kind" tags that route a completed payment to a credit grant.export const creditTopUpKind = "credit_topup";export const creditAutoReloadKind = "credit_topup_autoreload";-// Ceiling on a single super-user credit grant (whole dollars), enforced both by-// the grant API's schema and the settings form so the two never drift. Kept low-// as a typo guard — grants above this are rejected.+// Ceiling on a single credit grant a setting names (whole dollars), enforced+// by the registry's schema. Kept low as a typo guard — grants above this are+// rejected.export const maxCreditGrantDollars = 100;export function dollarsToStripeCents(amountDollars: number): number {diff --git a/site/src/lib/email/kindIds.ts b/site/src/lib/email/kindIds.tsindex 39cad64a..d6ba316f 100644--- a/site/src/lib/email/kindIds.ts+++ b/site/src/lib/email/kindIds.ts@@ -1,7 +1,7 @@// The kinds of email the site sends, and where each stands in the queue. The// server side of a kind (what it builds, whose quota it spends) is in// src/lib/email/kinds.ts; this file is client-safe so the settings registry-// can offer the priorities to su.+// can declare the priorities.export const EMAIL_KIND_IDS = ["reply-forward","credit-offer",diff --git a/site/src/lib/email/outbox.ts b/site/src/lib/email/outbox.tsindex c775985b..197661e0 100644--- a/site/src/lib/email/outbox.ts+++ b/site/src/lib/email/outbox.ts@@ -330,7 +330,7 @@ export type OutboxOverview = {const ITEMS = 60;-/** The outbox as su sees it: the cycle's budget, every kind's standing, and the+/** The outbox at a glance: the cycle's budget, every kind's standing, and the* rows worth a look. */export async function outboxOverview(now = new Date()): Promise<OutboxOverview> {await skipUnsubscribedFailures();diff --git a/site/src/lib/jobs/experiment-results.ts b/site/src/lib/jobs/experiment-results.tsindex 85bc4d29..016711f2 100644--- a/site/src/lib/jobs/experiment-results.ts+++ b/site/src/lib/jobs/experiment-results.ts@@ -13,7 +13,7 @@ import { prisma } from "@/lib/prisma";// Computes each experiment's read and stores it on the row: for every metric,// how many exposed accounts in each variant converted after their exposure,// and the verdict that follows. Runs nightly for every experiment that is-// running, paused, or recently ended, and on demand from su for one.+// running, paused, or recently ended, and on demand for one.type Exposure = { userId: string; variant: string; exposedAt: Date };@@ -61,8 +61,8 @@ export async function computeExperimentResults(experimentId: string): Promise<{const metrics = metricSchema.array().safeParse(experiment.metrics);if (!metrics.success) throw new JobFailure(`Experiment ${experiment.key} has metrics that no longer parse.`);- // Only what the hash assigned and the app showed counts; a row written from- // su, a held-out account, and an unexposed assignment are left out.+ // Only what the hash assigned and the app showed counts; a row written by+ // hand, a held-out account, and an unexposed assignment are left out.const [rows, holdouts] = await Promise.all([prisma.experimentAssignment.findMany({where: { experimentId, manual: false, variant: { not: null }, exposedAt: { not: null } },diff --git a/site/src/lib/jobs/outreach-scan.ts b/site/src/lib/jobs/outreach-scan.tsindex 464ae165..f8e78421 100644--- a/site/src/lib/jobs/outreach-scan.ts+++ b/site/src/lib/jobs/outreach-scan.ts@@ -42,9 +42,9 @@ function newest(...dates: (Date | null | undefined)[]): Date | null {}// Rolls product usage and billing state into the outreach list. Runs nightly-// from /api/marketing/outreach/scan and by hand from the Outreach tab's Scan-// now button. Everything the Outreach tab shows is written here or read-// alongside it, so the page itself never touches the credit tables.+// from /api/marketing/outreach/scan, or by hand as the same job. Everything+// the list shows is written here or read alongside it, so a reader never+// touches the credit tables.//// Two kinds of people make the list. Free accounts using the product well —// spending credits or holding media, and warm — are the ones worth a personaldiff --git a/site/src/lib/marketing/campaigns.ts b/site/src/lib/marketing/campaigns.tsindex f9f6af32..12f5e9e1 100644--- a/site/src/lib/marketing/campaigns.ts+++ b/site/src/lib/marketing/campaigns.ts@@ -1,4 +1,4 @@-// The outreach campaigns the scan and the super-user surface know about. Ids are+// The outreach campaigns the scan knows about. Ids are// code, not data: adding one here is what makes it scannable and listable./** Free accounts that spent real credits recently, or that are holding a realdiff --git a/site/src/lib/onboarding/signup-grants.ts b/site/src/lib/onboarding/signup-grants.tsindex 5f71a0cf..08645d39 100644--- a/site/src/lib/onboarding/signup-grants.ts+++ b/site/src/lib/onboarding/signup-grants.ts@@ -13,7 +13,7 @@ import { isDeletedAddress } from "@/lib/onboarding/deleted-account";// idempotent and keyed to the user, so provisioning can run more than once// (e.g. a retried signup) without double-granting, double-seeding, or// double-sending. The grant amount and its lifetime are the signupCredits-// setting, edited on su; the welcome email names the amount that landed.+// setting; the welcome email names the amount that landed.export async function provisionSignupGrants(user: EmailUser): Promise<void> {const setting = await getGlobalSetting("signupCredits");// An address that was deleted already had its signup credits once. The