From 7bea1bb7531e6bf7c8b8593e9bb4e1d59f264236 Mon Sep 17 00:00:00 2001 From: Brian Love Date: Mon, 25 May 2026 07:58:42 -0700 Subject: [PATCH] chore(minting): drop unused LICENSE_DEFAULT_TTL_DAYS Under subscriptions, every license's expiresAt comes from the subscription's item.current_period_end. There is no fallback fixed TTL anywhere in the codepath, so the env var and the deps field were dead code. - env.ts: drop LICENSE_DEFAULT_TTL_DAYS from Env type + loadEnv - handlers.ts: drop defaultTtlDays from HandlerDeps - stripe-webhook.ts: drop defaultTtlDays from the deps wiring - env.spec / handlers.spec: drop the assertion / fixture Operational follow-up: LICENSE_DEFAULT_TTL_DAYS can be removed from the Vercel minting-service project env vars (no runtime effect since nothing reads it). Co-Authored-By: Claude Opus 4.7 (1M context) --- apps/minting-service/handlers/stripe-webhook.ts | 1 - apps/minting-service/src/lib/env.spec.ts | 8 +------- apps/minting-service/src/lib/env.ts | 2 -- apps/minting-service/src/lib/handlers.spec.ts | 1 - apps/minting-service/src/lib/handlers.ts | 1 - 5 files changed, 1 insertion(+), 12 deletions(-) diff --git a/apps/minting-service/handlers/stripe-webhook.ts b/apps/minting-service/handlers/stripe-webhook.ts index dd0985ad8..6e61e5d72 100644 --- a/apps/minting-service/handlers/stripe-webhook.ts +++ b/apps/minting-service/handlers/stripe-webhook.ts @@ -67,7 +67,6 @@ export default async function handler(req: VercelRequest, res: VercelResponse): privateKeyHex: env.LICENSE_SIGNING_PRIVATE_KEY_HEX, resendApiKey: env.RESEND_API_KEY, emailFrom: env.EMAIL_FROM, - defaultTtlDays: env.LICENSE_DEFAULT_TTL_DAYS, }; try { diff --git a/apps/minting-service/src/lib/env.spec.ts b/apps/minting-service/src/lib/env.spec.ts index e3d7021c6..9be4b071b 100644 --- a/apps/minting-service/src/lib/env.spec.ts +++ b/apps/minting-service/src/lib/env.spec.ts @@ -27,7 +27,7 @@ describe('loadEnv', () => { const { loadEnv } = await import('./env.js'); const env = loadEnv(); expect(env.STRIPE_SECRET_KEY).toBe('sk_test_xxx'); - expect(env.LICENSE_DEFAULT_TTL_DAYS).toBe(365); + expect(env.LICENSE_SIGNING_PRIVATE_KEY_HEX).toHaveLength(64); }); it('throws with a list of all missing vars', async () => { @@ -48,10 +48,4 @@ describe('loadEnv', () => { expect(() => loadEnv()).toThrow(/64 hex chars/); }); - it('accepts a custom LICENSE_DEFAULT_TTL_DAYS', async () => { - setEnv({ ...REQUIRED, LICENSE_DEFAULT_TTL_DAYS: '30' }); - const { loadEnv } = await import('./env.js'); - const env = loadEnv(); - expect(env.LICENSE_DEFAULT_TTL_DAYS).toBe(30); - }); }); diff --git a/apps/minting-service/src/lib/env.ts b/apps/minting-service/src/lib/env.ts index 842251274..f9db7fd2d 100644 --- a/apps/minting-service/src/lib/env.ts +++ b/apps/minting-service/src/lib/env.ts @@ -15,7 +15,6 @@ export interface Env { RESEND_API_KEY: string; EMAIL_FROM: string; LICENSE_SIGNING_PRIVATE_KEY_HEX: string; - LICENSE_DEFAULT_TTL_DAYS: number; } export function loadEnv(): Env { @@ -36,6 +35,5 @@ export function loadEnv(): Env { RESEND_API_KEY: process.env['RESEND_API_KEY']!, EMAIL_FROM: process.env['EMAIL_FROM']!, LICENSE_SIGNING_PRIVATE_KEY_HEX: keyHex, - LICENSE_DEFAULT_TTL_DAYS: Number(process.env['LICENSE_DEFAULT_TTL_DAYS'] ?? 365), }; } diff --git a/apps/minting-service/src/lib/handlers.spec.ts b/apps/minting-service/src/lib/handlers.spec.ts index 4b2161f5c..ef962ebc6 100644 --- a/apps/minting-service/src/lib/handlers.spec.ts +++ b/apps/minting-service/src/lib/handlers.spec.ts @@ -26,7 +26,6 @@ function makeDeps(overrides: Partial = {}): HandlerDeps { privateKeyHex: 'a'.repeat(64), resendApiKey: 're_test', emailFrom: 'noreply@example.com', - defaultTtlDays: 365, ...overrides, }; } diff --git a/apps/minting-service/src/lib/handlers.ts b/apps/minting-service/src/lib/handlers.ts index e25456797..57097c3bb 100644 --- a/apps/minting-service/src/lib/handlers.ts +++ b/apps/minting-service/src/lib/handlers.ts @@ -37,7 +37,6 @@ export interface HandlerDeps { privateKeyHex: string; resendApiKey: string; emailFrom: string; - defaultTtlDays: number; } export async function handleEvent(event: Stripe.Event, deps: HandlerDeps): Promise {