Description
Current State
Various timeout values, limits, and configuration numbers are hardcoded throughout the codebase. This makes it difficult to adjust settings and understand what values are used.
Examples found
// lib/permission-checker.ts:31
const CACHE_TTL = 5 * 60 * 1000; // 5 minutes
// lib/config.ts:35
windowMs: 15 * 60 * 1000, // 15 minutes
// lib/permission-toast.ts:10
const TOAST_COOLDOWN = 30000; // 30 seconds
// lib/supabase-server.ts:6
const FETCH_TIMEOUT = 30000; // 30 seconds
Desired Outcome
Create lib/constants.ts:
// Time constants (in milliseconds)
export const CACHE_TTL_MS = 5 * 60 * 1000; // 5 minutes
export const RATE_LIMIT_WINDOW_MS = 15 * 60 * 1000; // 15 minutes
export const TOAST_COOLDOWN_MS = 30 * 1000; // 30 seconds
export const FETCH_TIMEOUT_MS = 30 * 1000; // 30 seconds
export const AUTO_CLOCK_OUT_HOURS = 16;
// Limits
export const MAX_TIME_ENTRY_HOURS = 24;
export const MAX_WEEKLY_AVAILABILITY_HOURS = 168;
export const TIME_ENTRY_EDIT_WINDOW_DAYS = 14;
How to get started
- Search for number literals:
grep -rn "\d\+\s*\*\s*\d" lib/
- Create
lib/constants.ts with categorized exports
- Replace hardcoded values with constants
- Update imports in affected files
Acceptance Criteria
Description
Current State
Various timeout values, limits, and configuration numbers are hardcoded throughout the codebase. This makes it difficult to adjust settings and understand what values are used.
Examples found
Desired Outcome
Create
lib/constants.ts:How to get started
grep -rn "\d\+\s*\*\s*\d" lib/lib/constants.tswith categorized exportsAcceptance Criteria
lib/constants.tsexists with all timing and limit constants