improvement(storage): add inline defaults for storage limits by plan#1685
Merged
icecrasher321 merged 1 commit intostagingfrom Oct 18, 2025
Merged
improvement(storage): add inline defaults for storage limits by plan#1685icecrasher321 merged 1 commit intostagingfrom
icecrasher321 merged 1 commit intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
💡 Enable Vercel Agent with $100 free credit for automated AI reviews |
Contributor
There was a problem hiding this comment.
Greptile Overview
Summary
Added inline .default() values to Zod schema definitions for storage limit environment variables across all subscription tiers (FREE_STORAGE_LIMIT_GB=5, PRO_STORAGE_LIMIT_GB=50, TEAM_STORAGE_LIMIT_GB=500, ENTERPRISE_STORAGE_LIMIT_GB=500). This ensures consistent fallback values when environment variables are not set, eliminating potential NaN issues in apps/sim/lib/billing/storage/limits.ts:34-46 where these values are parsed.
- Standardizes default storage limits across the codebase by moving them from comments to actual Zod defaults
- Aligns with existing pattern used for
OVERAGE_THRESHOLD_DOLLARS(line 56) which already uses.default(50) - Simplifies the fallback logic in
getStorageLimits()function by providing guaranteed numeric defaults
Confidence Score: 5/5
- This PR is safe to merge with minimal risk
- The changes are purely additive defaults for environment variables with no logic changes. The default values (5/50/500/500 GB) match existing constants in
packages/db/consts.ts:15-18and align with the established pattern for other env vars likeOVERAGE_THRESHOLD_DOLLARS. The implementation properly uses Zod's.optional().default()chain, ensuring type safety while providing sensible fallbacks. - No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/lib/env.ts | 5/5 | Added inline .default() values for storage limits across all subscription tiers (free: 5GB, pro: 50GB, team: 500GB, enterprise: 500GB) |
Sequence Diagram
sequenceDiagram
participant App as Application
participant Env as env.ts (createEnv)
participant Zod as Zod Schema
participant Runtime as Runtime/Process
App->>Env: Request storage limit env var
Env->>Runtime: Check environment variable
alt Variable exists in env
Runtime-->>Env: Return env value
Env->>Zod: Validate value
Zod-->>Env: Validated value
else Variable not set
Runtime-->>Env: undefined
Env->>Zod: Apply .default() value
Zod-->>Env: Default value (5/50/500)
end
Env-->>App: Storage limit value
1 file reviewed, no comments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add inline defaults for storage limits by plan
Testing
N/A
Checklist