Auto-commit 2026-05-02 09:37
This commit is contained in:
67
plans/FRE-4522-rate-limit-config.md
Normal file
67
plans/FRE-4522-rate-limit-config.md
Normal file
@@ -0,0 +1,67 @@
|
||||
# FRE-4522 - Update spamshield.config.ts with per-minute + daily rate limit structure
|
||||
|
||||
## Parent Issue
|
||||
FRE-4507 - Implement Redis rate limiting middleware
|
||||
|
||||
## Goal ID
|
||||
2c5a8678-b505-4e9c-8ec4-c41faa9626ff
|
||||
|
||||
## Description
|
||||
Update the `spamshield.config.ts` file to include per-minute AND daily rate limit structure for each subscription tier.
|
||||
|
||||
### Current State
|
||||
The current `spamshield.config.ts` only has single value rate limits:
|
||||
```typescript
|
||||
export const spamRateLimits = {
|
||||
BASIC: 100,
|
||||
PLUS: 500,
|
||||
PREMIUM: 2000,
|
||||
} as const;
|
||||
```
|
||||
|
||||
### Required Changes
|
||||
Refactor `spamRateLimits` to include both per-minute and daily limits:
|
||||
|
||||
```typescript
|
||||
export const spamRateLimits = {
|
||||
BASIC: { perMinute: 100, perDay: 1000 },
|
||||
PLUS: { perMinute: 500, perDay: 5000 },
|
||||
PREMIUM: { perMinute: 2000, perDay: 20000 },
|
||||
} as const;
|
||||
```
|
||||
|
||||
### Type Definition
|
||||
Add type definition for the rate limit structure:
|
||||
```typescript
|
||||
export interface TierRateLimits {
|
||||
perMinute: number;
|
||||
perDay: number;
|
||||
}
|
||||
|
||||
export type SubscriptionTierRateLimits = Record<SubscriptionTier, TierRateLimits>;
|
||||
```
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Update `spamRateLimits` to include `perMinute` and `perDay` properties
|
||||
- [ ] Add `TierRateLimits` interface definition
|
||||
- [ ] Update `SubscriptionTierRateLimits` type
|
||||
- [ ] Ensure type safety with `as const` assertion
|
||||
- [ ] All existing imports/exports continue to work
|
||||
|
||||
## File to Modify
|
||||
`services/spamshield/src/config/spamshield.config.ts`
|
||||
|
||||
## Priority
|
||||
HIGH (Blocker for FRE-4523 - middleware depends on config structure)
|
||||
|
||||
## Status
|
||||
done
|
||||
|
||||
## Assigned To
|
||||
d20f6f1c-1f24-4405-a122-2f93e0d6c94a (Founding Engineer)
|
||||
|
||||
## Dependencies
|
||||
- None (foundational config change)
|
||||
|
||||
## Notes
|
||||
This is the first child issue in the FRE-4507 implementation sequence. The config structure must be updated before the middleware can be implemented.
|
||||
Reference in New Issue
Block a user