Skip to content

fix: redix should be loaded - #71

Merged
zoedsoupe merged 1 commit into
mainfrom
fix/compile-warning-redix
Dec 9, 2025
Merged

zoedsoupe merged 1 commit into
mainfrom
fix/compile-warning-redix

Conversation

@zoedsoupe

@zoedsoupe zoedsoupe commented Dec 9, 2025 •

Copy link
Copy Markdown
Owner

Problem

Solution

Rationale

Summary by CodeRabbit

  • Chores
    • Improved conditional dependency handling for session storage to ensure graceful operation when optional libraries are unavailable. No behavioral changes for existing deployments.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Dec 9, 2025 •

Copy link
Copy Markdown

Walkthrough

The Redis session store module is now conditionally defined using Code.ensure_loaded?(Redix) rather than being unconditionally loaded. If Redix is not available, the module itself won't be defined at compile time. The module's public API, internal logic, and behavioral contracts remain identical—this is purely a structural guard preventing compilation when the optional dependency is missing.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

  • Single file affected with minimal surface area for issues
  • No logic changes, refactoring, or functional alterations—purely conditional wrapping
  • Straightforward pattern for optional dependencies in Elixir
  • Low cognitive load; main task is verification

Potential focus areas:

  • Verify that the conditional guard doesn't leave dangling references elsewhere (e.g., in router configs, supervision trees, or other modules assuming Redis availability)
  • Confirm proper indentation and syntax within the guard block
  • Ensure compile-time behavior matches intent (module simply absent if Redix unavailable, no silent failures)

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning PR description is entirely empty—all template sections contain only placeholder comments with no actual content about the problem, solution, or rationale. Fill in all three template sections: explain the compilation warning that was occurring, describe the conditional loading fix applied, and justify why this approach is appropriate for optional dependencies.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed Title accurately summarizes the main change: making the Redis session store module conditionally loaded based on Redix availability, which directly addresses the compilation warning issue.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/compile-warning-redix

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a268ae7 and fc6acff.

📒 Files selected for processing (1)
  • lib/anubis/server/session/store/redis.ex (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
lib/anubis/server/session/store/redis.ex (1)
lib/anubis/server/session/supervisor.ex (2)
  • start_link (25-39)
  • init (104-106)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: test (1.18, 26)
  • GitHub Check: test (1.18, 28)
🔇 Additional comments (2)
lib/anubis/server/session/store/redis.ex (2)

2-428: ✅ Module implementation looks solid

The Redis store logic itself is well-structured with proper:

  • GenServer patterns
  • Connection pooling
  • Error handling & logging
  • Behaviour implementation

The indentation changes are purely mechanical due to the wrapper. No behavioral issues detected in the core logic.


1-1: This review comment is incorrect. The code already implements graceful error handling for missing Redix.

The get_session_store_adapter() function in lib/anubis.ex includes a runtime check Code.ensure_loaded?(adapter) that returns nil when the Redis module is not available. The restore_sessions() function in the supervisor explicitly handles this nil case and skips session restoration gracefully. This is the intended validation layer—not in start_link/1.

The current approach (compile-time conditional module definition + runtime adapter check) is sound for optional dependencies. If Redix is not included and the adapter is configured, the system will simply skip session restoration rather than crash.

A potential minor improvement would be to log a warning when an adapter is explicitly configured but not available, but the current silent no-op is reasonable for truly optional functionality.

Likely an incorrect or invalid review comment.

Comment on lines +3 to +42
@moduledoc """
Redis-based session store implementation.

Uses Redix for Redis communication and provides persistent session storage
with automatic expiration and connection pooling.

## Configuration

config :anubis_mcp, :session_store,
adapter: Anubis.Server.Session.Store.Redis,
redis_url: "redis://localhost:6379/0",
pool_size: 10,
ttl: 1_800_000, # 30 minutes in milliseconds
namespace: "anubis:sessions",
connection_name: :anubis_redis,
redix_opts: [] # Optional Redix connection options

## SSL/TLS Configuration

For Redis servers requiring TLS (like Upstash), pass SSL options via `:redix_opts`:

config :anubis_mcp, :session_store,
adapter: Anubis.Server.Session.Store.Redis,
redis_url: "rediss://default:password@host.upstash.io:6379",
redix_opts: [
ssl: true,
socket_opts: [
customize_hostname_check: [
match_fun: :public_key.pkix_verify_hostname_match_fun(:https)
]
]
]
]

## Features
## Features

- Automatic session expiration using Redis TTL
- Last-write-wins semantics for session updates
- Connection pooling for high concurrency
- Namespace support for multi-tenant deployments
"""
- Automatic session expiration using Redis TTL
- Last-write-wins semantics for session updates
- Connection pooling for high concurrency
- Namespace support for multi-tenant deployments
"""

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

📝 P3: Document Redix as a required dependency

The moduledoc should explicitly state that Redix must be added to dependencies. Users reading the docs won't know they need to install it.

Suggest adding this section after line 4:

 @moduledoc """
 Redis-based session store implementation.

+## Dependencies
+
+Requires the `:redix` package:
+
+    # mix.exs
+    def deps do
+      [
+        {:redix, "~> 1.5"}
+      ]
+    end
+
 Uses Redix for Redis communication and provides persistent session storage
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@moduledoc """
Redis-based session store implementation.
Uses Redix for Redis communication and provides persistent session storage
with automatic expiration and connection pooling.
## Configuration
config :anubis_mcp, :session_store,
adapter: Anubis.Server.Session.Store.Redis,
redis_url: "redis://localhost:6379/0",
pool_size: 10,
ttl: 1_800_000, # 30 minutes in milliseconds
namespace: "anubis:sessions",
connection_name: :anubis_redis,
redix_opts: [] # Optional Redix connection options
## SSL/TLS Configuration
For Redis servers requiring TLS (like Upstash), pass SSL options via `:redix_opts`:
config :anubis_mcp, :session_store,
adapter: Anubis.Server.Session.Store.Redis,
redis_url: "rediss://default:password@host.upstash.io:6379",
redix_opts: [
ssl: true,
socket_opts: [
customize_hostname_check: [
match_fun: :public_key.pkix_verify_hostname_match_fun(:https)
]
]
]
]
## Features
## Features
- Automatic session expiration using Redis TTL
- Last-write-wins semantics for session updates
- Connection pooling for high concurrency
- Namespace support for multi-tenant deployments
"""
- Automatic session expiration using Redis TTL
- Last-write-wins semantics for session updates
- Connection pooling for high concurrency
- Namespace support for multi-tenant deployments
"""
@moduledoc """
Redis-based session store implementation.
## Dependencies
Requires the `:redix` package:
# mix.exs
def deps do
[
{:redix, "~> 1.5"}
]
end
Uses Redix for Redis communication and provides persistent session storage
with automatic expiration and connection pooling.
## Configuration
config :anubis_mcp, :session_store,
adapter: Anubis.Server.Session.Store.Redis,
redis_url: "redis://localhost:6379/0",
pool_size: 10,
ttl: 1_800_000, # 30 minutes in milliseconds
namespace: "anubis:sessions",
connection_name: :anubis_redis,
redix_opts: [] # Optional Redix connection options
## SSL/TLS Configuration
For Redis servers requiring TLS (like Upstash), pass SSL options via `:redix_opts`:
config :anubis_mcp, :session_store,
adapter: Anubis.Server.Session.Store.Redis,
redis_url: "rediss://default:password@host.upstash.io:6379",
redix_opts: [
ssl: true,
socket_opts: [
customize_hostname_check: [
match_fun: :public_key.pkix_verify_hostname_match_fun(:https)
]
]
]
## Features
- Automatic session expiration using Redis TTL
- Last-write-wins semantics for session updates
- Connection pooling for high concurrency
- Namespace support for multi-tenant deployments
"""
🤖 Prompt for AI Agents
In lib/anubis/server/session/store/redis.ex around lines 3–42 (add after line
4), update the moduledoc to explicitly state that the Redix library must be
added to the project dependencies (mix.exs) and recommend specifying a minimum
compatible version; also note that Redix connection options (including
SSL/socket options for services like Upstash) should be provided via the
redix_opts config entry and, optionally, mention adding the named connection if
using connection pooling.

@zoedsoupe
zoedsoupe merged commit 09b872f into main Dec 9, 2025
10 checks passed
@zoedsoupe
zoedsoupe deleted the fix/compile-warning-redix branch December 9, 2025 00:46
@zoedsoupe zoedsoupe mentioned this pull request Dec 8, 2025
zoedsoupe added a commit that referenced this pull request Dec 9, 2025
🚀 Want to release this?
---


##
[0.17.0](v0.16.0...v0.17.0)
(2025-12-09)


### Features

* **redis:** add redix_opts for SSL/TLS support
([#59](#59))
([33658ab](33658ab))


### Bug Fixes

* added server component description/0 callback
([#58](#58))
([a094473](a094473))
* redix should be loaded
([#71](#71))
([09b872f](09b872f))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
  * Added Redis SSL/TLS support via redix options.

* **Bug Fixes**
  * Fixed server component description callback issue.
  * Fixed redix loading issue.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
zoedsoupe added a commit that referenced this pull request Jul 16, 2026
## Problem

<!-- what problem is the PR is trying to solve? -->

## Solution

<!-- how is the PR solving the problem? -->

## Rationale

<!-- why was it implemented the way it was? -->


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Chores**
* Improved conditional dependency handling for session storage to ensure
graceful operation when optional libraries are unavailable. No
behavioral changes for existing deployments.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
zoedsoupe added a commit that referenced this pull request Jul 16, 2026
🚀 Want to release this?
---


##
[0.17.0](v0.16.0...v0.17.0)
(2025-12-09)


### Features

* **redis:** add redix_opts for SSL/TLS support
([#59](#59))
([3fd674a](3fd674a))


### Bug Fixes

* added server component description/0 callback
([#58](#58))
([a094473](a094473))
* redix should be loaded
([#71](#71))
([c352414](c352414))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
  * Added Redis SSL/TLS support via redix options.

* **Bug Fixes**
  * Fixed server component description callback issue.
  * Fixed redix loading issue.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This was referenced Jul 16, 2026
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