Skip to content

Conversation

@bmartel
Copy link
Contributor

@bmartel bmartel commented Nov 26, 2025

This pull request updates the caching mechanism used by the FSM (Finite State Machine) state management in label_studio/fsm/state_manager.py. The main goal is to ensure that FSM operations use the correct cache backend, especially in environments where the default cache may be a dummy cache (e.g., for testing or specific deployments), and to support using a dedicated Redis cache if configured. The changes also update tests to ensure cache isolation.

Caching backend improvements:

  • Introduced the get_fsm_cache() function to select the appropriate cache backend for FSM operations, preferring a Redis cache if specified via REDIS_CACHE_ALIAS in settings, and falling back to the default cache otherwise. This ensures FSM caching works correctly even if the default cache is a dummy backend. The cache backend is memoized for efficiency.
  • Replaced all direct uses of cache in FSM state management methods with get_fsm_cache(), ensuring consistent use of the selected cache backend for all FSM cache operations, including get, set, add, delete, and set_many. [1] [2] [3] [4] [5] [6] [7]

Testing improvements:

  • Updated the FSM test fixture to clear both the default cache and the FSM-specific cache after each test, ensuring proper test isolation regardless of which cache backend is in use. [1] [2]

Imports and setup:

  • Updated imports to include caches from django.core.cache and import get_fsm_cache in tests. [1] [2]

@bmartel bmartel requested a review from mcanu November 26, 2025 20:41
@netlify
Copy link

netlify bot commented Nov 26, 2025

Deploy Preview for heartex-docs canceled.

Name Link
🔨 Latest commit dac1a19
🔍 Latest deploy log https://app.netlify.com/projects/heartex-docs/deploys/69286418ae96260008f4feb2

@netlify
Copy link

netlify bot commented Nov 26, 2025

Deploy Preview for label-studio-playground ready!

Name Link
🔨 Latest commit dac1a19
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-playground/deploys/69286418f65a220007547ac1
😎 Deploy Preview https://deploy-preview-8896--label-studio-playground.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Nov 26, 2025

Deploy Preview for label-studio-storybook ready!

Name Link
🔨 Latest commit dac1a19
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-storybook/deploys/69286418f1e45500080f6a54
😎 Deploy Preview https://deploy-preview-8896--label-studio-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added the fix label Nov 26, 2025
@netlify
Copy link

netlify bot commented Nov 26, 2025

Deploy Preview for label-studio-docs-new-theme canceled.

Name Link
🔨 Latest commit dac1a19
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-docs-new-theme/deploys/6928641858a4100008843b9c

@codecov
Copy link

codecov bot commented Nov 26, 2025

Codecov Report

❌ Patch coverage is 93.75000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.03%. Comparing base (a2f4b57) to head (dac1a19).
⚠️ Report is 1 commits behind head on develop.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
label_studio/fsm/state_manager.py 93.33% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           develop    #8896       +/-   ##
============================================
+ Coverage    66.10%   81.03%   +14.92%     
============================================
  Files          820      259      -561     
  Lines        64416    23561    -40855     
  Branches     11041        0    -11041     
============================================
- Hits         42581    19092    -23489     
+ Misses       21831     4469    -17362     
+ Partials         4        0        -4     
Flag Coverage Δ
lsf-e2e ?
lsf-integration ?
lsf-unit ?
pytests 81.03% <93.75%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@robot-ci-heartex robot-ci-heartex merged commit 7502391 into develop Nov 27, 2025
53 checks passed
@robot-ci-heartex robot-ci-heartex deleted the fb-fit-1054 branch November 27, 2025 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants