Skip to content

Conversation

@matusdrobuliak66
Copy link
Collaborator

@matusdrobuliak66 matusdrobuliak66 commented Jul 22, 2025

What do these changes do?

What am I trying to solve?

How does it work?

  • Any change to a project or node resource on the frontend is sent via WebSocket to all users subscribed to the corresponding project room. (When a user opens a project, they are automatically subscribed.)
  • A new ProjectDocument model is used, which is always fully transmitted to the frontend along with a new version. This allows the frontend client to compute a diff and understand what has changed.
  • To handle concurrency issues, a new PROJECT_DB_UPDATE_REDIS_LOCK_KEY has been introduced in Redis.
  • The ProjectDocument version is also stored in Redis in the documents table.

Bonus identified issues with @pcrespov @sanderegg

  • scheduled deleted task was not referenced anywhere and could be deleted by the python garbage collector --> use fire_and_forget_task function to fix this
  • long running task cancellation was waiting only 1 second to let the cancelled task cleanup its mess, that is way too short, especially since it then deletes the task that might never complete its cleanup phase (2 issues in tests)
  • locking timeout used with PROJECT_DB_UPDATE_REDIS_LOCK_KEY was set to arbitrary value of 30 seconds, this was set to None such that we wait forever for the lock instead of failing (issue with creating/deleting 150 nodes concurrently)
  • removed unnecessary protected calls from the locked functions (such as getting a user primary group ID)

Related issue/s

How to test

Dev-ops

⚠️ New Redis table documents

Introduces a project document model with versioning, stored in Redis, and emits real-time update notifications to project rooms via socket.io when a project is patched. Updates Redis and docker-compose configs to support a dedicated documents database. Improves collaboration features by allowing clients to receive live project document changes.

Relates to collaborative editing and project state synchronization features.
Updates socket.io room joining to reflect non-awaitable enter_room
method, preparing for upcoming dependency upgrade. Also adds
DOCUMENTS to Redis database setup and improves type casting
for project types. Improves code clarity and ensures future
compatibility.
Introduces a unified function for patching projects with versioning
and notification, ensuring atomic updates and consistent user alerts.
Removes legacy methods, simplifies project API, and updates usages
across modules for better maintainability and reduced duplication.
Updates the comment to note that the progress field, while marked
deprecated, is still actively used by the frontend file picker.
Helps prevent confusion for future maintainers about its current usage.
…tions

Introduces a locked and versioned update mechanism for project workbench modifications, ensuring atomic operations using Redis distributed locks and version increments. Notifies users of project document updates after each successful change, reducing race conditions and improving consistency in collaborative environments.
@matusdrobuliak66 matusdrobuliak66 self-assigned this Jul 22, 2025
@matusdrobuliak66 matusdrobuliak66 added the a:webserver webserver's codebase. Assigning the area is particularly useful for bugs label Jul 22, 2025
@matusdrobuliak66 matusdrobuliak66 added this to the Engage milestone Jul 22, 2025
@codecov
Copy link

codecov bot commented Jul 22, 2025

Codecov Report

Attention: Patch coverage is 95.42484% with 7 lines in your changes missing coverage. Please review.

Project coverage is 88.12%. Comparing base (233031b) to head (e7c645e).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8140      +/-   ##
==========================================
- Coverage   89.72%   88.12%   -1.61%     
==========================================
  Files        1701     1893     +192     
  Lines       66249    72916    +6667     
  Branches      824     1279     +455     
==========================================
+ Hits        59443    64257    +4814     
- Misses       6590     8279    +1689     
- Partials      216      380     +164     
Flag Coverage Δ
integrationtests 64.27% <67.79%> (+0.15%) ⬆️
unittests 86.74% <95.42%> (-1.48%) ⬇️
Components Coverage Δ
pkg_aws_library 93.93% <ø> (ø)
pkg_celery_library 87.34% <ø> (ø)
pkg_dask_task_models_library 79.62% <ø> (ø)
pkg_models_library 93.12% <95.45%> (+<0.01%) ⬆️
pkg_notifications_library 85.26% <ø> (ø)
pkg_postgres_database 88.02% <ø> (ø)
pkg_service_integration 70.19% <ø> (ø)
pkg_service_library 71.53% <100.00%> (∅)
pkg_settings_library 90.46% <100.00%> (+0.01%) ⬆️
pkg_simcore_sdk 85.05% <ø> (ø)
agent 93.81% <ø> (ø)
api_server 93.02% <ø> (ø)
autoscaling 95.88% <ø> (ø)
catalog 92.34% <ø> (ø)
clusters_keeper 99.13% <ø> (ø)
dask_sidecar 92.37% <ø> (ø)
datcore_adapter 97.94% <ø> (ø)
director 76.14% <ø> (ø)
director_v2 91.13% <ø> (+0.09%) ⬆️
dynamic_scheduler 96.27% <ø> (ø)
dynamic_sidecar 90.07% <ø> (ø)
efs_guardian 89.76% <ø> (ø)
invitations 91.44% <ø> (ø)
payments 92.60% <ø> (ø)
resource_usage_tracker 92.50% <ø> (-0.06%) ⬇️
storage 86.73% <ø> (+0.25%) ⬆️
webclient ∅ <ø> (∅)
webserver 88.23% <94.91%> (+0.09%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 233031b...e7c645e. Read the comment docs.

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

@matusdrobuliak66 matusdrobuliak66 requested a review from Copilot July 22, 2025 17:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces the first iteration of a collaboration feature that enables real-time project document updates and user notifications. The implementation adds a comprehensive system for tracking project document versions and notifying users when changes occur through WebSocket connections.

  • Implements Redis-based document versioning for collaborative editing
  • Adds real-time notification system using SocketIO for project updates
  • Refactors project update methods to include user notification and version control

Reviewed Changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
services/docker-compose*.yml Increases Redis database count to 11 and adds documents database configuration
packages/settings-library/src/settings_library/redis.py Adds DOCUMENTS Redis database enum
packages/service-library/src/servicelib/redis/* Implements project document versioning utilities with Redis
packages/models-library/src/models_library/api_schemas_webserver/* Adds ProjectDocument model and SocketIO project room support
services/web/server/src/simcore_service_webserver/redis.py Adds Redis document manager client
services/web/server/src/simcore_service_webserver/socketio/messages.py Implements project room messaging
services/web/server/src/simcore_service_webserver/projects/* Refactors project services to support collaboration with notifications
services/web/server/tests/unit/* Updates tests and removes unused test methods
Comments suppressed due to low confidence (1)

services/web/server/src/simcore_service_webserver/projects/_controller/projects_states_rest.py:115

  • [nitpick] The error message 'Cannot open project without a socket_id, please refresh the page' may be confusing to users. Consider a more specific message about WebSocket connection requirements
            raise web.HTTPBadRequest(

@matusdrobuliak66 matusdrobuliak66 changed the title ✨ Is1647/collaboration feature - 1. iteration ✨ Is1647/collaboration feature - 1. iteration (OPS ⚠️) Jul 22, 2025
@matusdrobuliak66 matusdrobuliak66 enabled auto-merge (squash) July 23, 2025 13:51
matusdrobuliak66 and others added 3 commits July 23, 2025 17:54
Adds detailed debug logging to lock acquisition,
enhances pytest output with DEBUG logs for CI,
and clarifies mock subsystem setup for test reliability.
Facilitates easier diagnosis of concurrency and storage issues.
@sanderegg sanderegg disabled auto-merge July 24, 2025 06:50
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a:webserver webserver's codebase. Assigning the area is particularly useful for bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants