Enforce cache key is a string - #8019
Open
Steve-Mcl wants to merge 2 commits into
Open
Conversation
Steve-Mcl
requested review from
Copilot and
hardillb
and removed request for
Copilot
July 31, 2026 15:35
hardillb
approved these changes
Jul 31, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8019 +/- ##
==========================================
+ Coverage 76.13% 76.14% +0.01%
==========================================
Files 439 440 +1
Lines 23548 23560 +12
Branches 6272 6273 +1
==========================================
+ Hits 17928 17940 +12
Misses 5620 5620
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Description
What does this PR do?
Makes the app's cache system reject non-string keys instead of silently misbehaving.
Why was this needed?
The app can store its short-lived cache data in one of two ways: an in-memory cache (used locally and in some environments) or a Redis/Valkey cache (used in production). These two behave differently if you accidentally use something other than a plain string as a cache key, e.g. a number instead of a string. The in-memory cache will quietly accept it and appear to work fine, but Redis handles keys differently and can fail in confusing ways.
This mismatch already caused a hard-to-track-down bug: something worked fine locally but broke in an environment using Redis, and it took a long time to figure out why, because the local setup didn't use Redis and couldn't have caught it.
What changed?
Both cache drivers now check that a key is a string before using it, and immediately throw a clear, descriptive error if it isn't. This means:
Testing
Added tests to confirm both cache drivers reject non-string keys consistently.
Related Issue(s)
closes #7666
Checklist
flowforge.yml?FlowFuse/helmto update ConfigMap TemplateFlowFuse/CloudProjectto update values for Staging/ProductionLabels
area:migrationlabel