Skip to content

fix(flags): accept rediss:// URLs for flag_fallback_cache_url - #1080

Merged
dustinbyrne merged 1 commit into
PostHog:mainfrom
auraseb:fix/flag-cache-rediss-scheme
Oct 19, 2026
Merged

dustinbyrne merged 1 commit into
PostHog:mainfrom
auraseb:fix/flag-cache-rediss-scheme

Conversation

@auraseb

@auraseb auraseb commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

flag_fallback_cache_url only accepted the redis scheme. A TLS URL such as rediss://user:pass@host:6380/0?ttl=300 was rejected as an unknown scheme, a warning was logged and the flag fallback cache was disabled. Managed Redis services often require TLS, so the fallback cache could not be used there at all.

_initialize_flag_cache already rebuilds the connection URL from parsed.scheme and hands it to redis.from_url, which supports rediss://. This change lets rediss into the same branch, lists it in the error message, and adds it to the docstring examples.

💚 How did you test it?

  • Added test_flag_fallback_cache_url_accepts_redis_schemes in posthog/test/test_client.py. It replaces the redis module with a mock and checks that both a redis:// and a rediss:// URL produce a RedisFlagCache with the requested TTL and that redis.from_url receives the URL with the scheme, credentials, port and db preserved and the query string removed.
  • The rediss case fails on main (from_url is never called) and passes with the fix. The redis case passes on both.
  • Full suite: pytest --timeout=30 passes. ruff format --check ., ruff check . and the mypy baseline check are clean.

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran sampo add to generate a changeset file

🤖 Agent context

Autonomy: Fully autonomous

  • An agent found the bug, wrote the fix and the regression test, and drafted this description. Separate agent reviews reproduced the failure on main and ran the tests with the fix.
  • Kept the change to the scheme check only. Rewriting the URL reconstruction (for example to preserve extra query parameters) was considered and left out to keep the diff small.

Fixes #1079

@auraseb
auraseb requested a review from a team as a code owner October 19, 2026 00:06

@dustinbyrne dustinbyrne left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thank you @auraseb!

@dustinbyrne
dustinbyrne merged commit 20dabaa into PostHog:main Oct 19, 2026
44 of 45 checks passed
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.

flag_fallback_cache_url rejects rediss:// URLs, so the flag fallback cache cannot use Redis over TLS

2 participants