Skip to content

fix(redis): fix indentation in getRedisClient#435

Merged
liudmylasovetovs merged 2 commits intodevelopfrom
fix/redis-indent
Mar 29, 2026
Merged

fix(redis): fix indentation in getRedisClient#435
liudmylasovetovs merged 2 commits intodevelopfrom
fix/redis-indent

Conversation

@LesiaUKR
Copy link
Copy Markdown
Collaborator

@LesiaUKR LesiaUKR commented Mar 29, 2026

Summary by CodeRabbit

  • Chores
    • Improved environment/configuration validation for the Redis connection. If the connection URL or token are missing or malformed, Redis will be gracefully disabled to prevent runtime errors and improve stability.

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 29, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
devlovers-net Ignored Ignored Preview Mar 29, 2026 6:55pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 29, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0e8d1c28-21d3-4eb4-9ea3-47c69a32bee2

📥 Commits

Reviewing files that changed from the base of the PR and between 83eee23 and c262b72.

📒 Files selected for processing (1)
  • frontend/lib/redis.ts

📝 Walkthrough

Walkthrough

The Redis client now reads UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN individually via readServerEnv('...'), returns null if either is missing, and additionally validates the URL by attempting new URL(...), returning null when parsing fails. Client creation and caching remain unchanged.

Changes

Cohort / File(s) Summary
Redis Configuration
frontend/lib/redis.ts
Switched env retrieval to readServerEnv('UPSTASH_REDIS_REST_URL') and readServerEnv('UPSTASH_REDIS_REST_TOKEN') instead of destructuring from getServerEnv(). Added null-checks for missing values and URL parsing validation using new URL(...), returning null on parse failure. Redis client creation/caching logic unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 I nibble env vars, one by one,
A tidy hop, a parse well done,
If URL trips, I timeout slow—
Then back to burrow, soft and low. 🥕

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title claims the PR fixes indentation, but the summary shows the actual changes involve refactoring how environment variables are imported and read, from using getServerEnv() to using readServerEnv(). The indentation fix appears to be incidental, not the main change. Update the title to accurately reflect the main change: 'refactor(redis): use readServerEnv for environment variables' or similar to describe the actual refactoring work done.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/redis-indent

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/lib/redis.ts`:
- Around line 10-15: The guard in frontend/lib/redis.ts now only checks that
UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN are non-empty (via
readServerEnv) but no longer validates that UPSTASH_REDIS_REST_URL is a
well-formed URL; update the early-return logic to validate
UPSTASH_REDIS_REST_URL (e.g., using the same URL validation used before or by
constructing new URL(UPSTASH_REDIS_REST_URL) and catching errors) and return
null only if the URL is missing or invalid so callers like redis.get in
frontend/lib/cache/qa.ts fail fast on misconfigured deploys; reference the
constant UPSTASH_REDIS_REST_URL and the readServerEnv call in this file when
making the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 28459843-50c8-4d78-b9f5-f9c60b99a1ab

📥 Commits

Reviewing files that changed from the base of the PR and between ed04413 and 83eee23.

📒 Files selected for processing (1)
  • frontend/lib/redis.ts

Comment thread frontend/lib/redis.ts Outdated
@liudmylasovetovs liudmylasovetovs merged commit 6998f02 into develop Mar 29, 2026
6 of 7 checks passed
@liudmylasovetovs liudmylasovetovs deleted the fix/redis-indent branch March 29, 2026 18:15
@LesiaUKR LesiaUKR restored the fix/redis-indent branch March 29, 2026 18:46
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.

2 participants