Skip to content

improvement(storage): add inline defaults for storage limits by plan#1685

Merged
icecrasher321 merged 1 commit intostagingfrom
improvement/add-inline-defaults
Oct 18, 2025
Merged

improvement(storage): add inline defaults for storage limits by plan#1685
icecrasher321 merged 1 commit intostagingfrom
improvement/add-inline-defaults

Conversation

@icecrasher321
Copy link
Copy Markdown
Collaborator

Summary

Add inline defaults for storage limits by plan

Testing

N/A

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link
Copy Markdown

vercel bot commented Oct 18, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Oct 18, 2025 5:49pm

💡 Enable Vercel Agent with $100 free credit for automated AI reviews

@icecrasher321 icecrasher321 merged commit 728a4c8 into staging Oct 18, 2025
9 checks passed
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-18 and align with the established pattern for other env vars like OVERAGE_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
Loading

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant