From 273488f71f7da77fbbbc230cbfe05613e9bb320a Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Nov 2025 06:44:50 -0800 Subject: [PATCH] Fix: Preserve null value for "Never" expiration option (#2605) Fixed reactive block in expirationInput.svelte to check for null before converting to ISO date. When "Never" is selected, value now remains null instead of being converted to '1970-01-01'. This allows the API to correctly handle null expiration dates for API keys and file tokens. --- AGENTS.md | 19 +++++++++++++++++++ src/lib/components/expirationInput.svelte | 5 ++++- .../overview/(components)/create.svelte | 4 ++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 82bcb13c7..38c3f89e3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -101,4 +101,23 @@ src/ 5. Before commit: `pnpm run check && pnpm run format && pnpm run lint && pnpm run test && pnpm run build` 6. **Take screenshots**: For any UI changes, capture screenshots and include them in the PR description or comments before finalizing +## Required Pre-Completion Checklist + +**CRITICAL**: Before finishing any work or marking a task complete, agents MUST run the following commands in order and ensure all pass: + +1. **`pnpm run format`** - Auto-fix all formatting issues +2. **`pnpm run check`** - Verify TypeScript/Svelte types (must show 0 errors, 0 warnings) +3. **`pnpm run lint`** - Check code style (ignore pre-existing issues in files you didn't modify) +4. **`pnpm run test`** - Run all unit tests (all tests must pass) +5. **`pnpm run build`** - Ensure production build succeeds + +If any command fails: + +- **Format/Lint**: Run `pnpm run format` to auto-fix, then re-check +- **Type errors**: Fix all TypeScript errors in files you modified +- **Test failures**: Fix failing tests or ensure failures are unrelated to your changes +- **Build failures**: Debug and resolve build issues before proceeding + +**Never skip these checks** - they are mandatory quality gates before any work is considered complete. + **Trust these instructions** - only search if incomplete/incorrect. See CONTRIBUTING.md for PR conventions. Use `--frozen-lockfile` always. Docker builds: multi-stage, final image is nginx serving static files from `/console` path. diff --git a/src/lib/components/expirationInput.svelte b/src/lib/components/expirationInput.svelte index eff95ba7d..9782dfae5 100644 --- a/src/lib/components/expirationInput.svelte +++ b/src/lib/components/expirationInput.svelte @@ -134,7 +134,10 @@ value = expirationSelect === 'custom' ? expirationCustom : expirationSelect; } - value = toLocaleDateISO(new Date(value).getTime()); + // Only convert to ISO date if value is not null + if (value !== null) { + value = toLocaleDateISO(new Date(value).getTime()); + } } $: helper = diff --git a/src/routes/(console)/project-[region]-[project]/overview/(components)/create.svelte b/src/routes/(console)/project-[region]-[project]/overview/(components)/create.svelte index 84e6a7809..4c9bb8150 100644 --- a/src/routes/(console)/project-[region]-[project]/overview/(components)/create.svelte +++ b/src/routes/(console)/project-[region]-[project]/overview/(components)/create.svelte @@ -24,8 +24,8 @@ let isSubmitting = writable(false); let scopes: string[] = []; - let name = '', - expire = ''; + let name = ''; + let expire: string | null = null; async function create() { try {