Personal accounts
All checks were successful
Build and Push / build (push) Successful in 1m30s

This commit is contained in:
2026-04-26 22:26:33 +02:00
parent 2c85bf8597
commit 3521a0ff4f
14 changed files with 292 additions and 64 deletions

View File

@@ -63,10 +63,10 @@ export async function POST(
const isReApproval = tenantRequest.status === "rejected";
// Build the CR name: see `lib/tenant-naming.ts` for the format spec.
// For now all approvals are kind="company" — the personal branch is
// wired but unused until Slice 4 introduces the `is_personal` column.
// Slice 4: for personal accounts the slug is replaced by the literal
// "p-" prefix so no PII is embedded in the K8s namespace name.
const tenantName = deriveTenantName(
"company",
tenantRequest.isPersonal ? "personal" : "company",
tenantRequest.companyName,
tenantRequest.id
);
@@ -101,13 +101,17 @@ export async function POST(
};
// Step 4: Create the PiecedTenant CR.
// displayName: prefer the customer-chosen instance name; fall back to
// the company name. With multi-tenant per org, instanceName is what
// distinguishes "Acme Production" from "Acme Dev" on the dashboard.
// displayName precedence:
// 1. customer-chosen instance name (Slice 3 multi-tenant)
// 2. for personal accounts, the contact name (avoids exposing the
// synthetic "{name} (Personal)" company name in the OpenClaw UI)
// 3. company name otherwise
const displayName =
tenantRequest.instanceName && tenantRequest.instanceName.trim().length > 0
? tenantRequest.instanceName.trim()
: tenantRequest.companyName;
: tenantRequest.isPersonal
? tenantRequest.contactName || "Assistant"
: tenantRequest.companyName;
await createTenant(
tenantName,