-
Notifications
You must be signed in to change notification settings - Fork 32
✨ Is1647/collaboration feature - 1. iteration (OPS ⚠️) #8140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sanderegg
merged 45 commits into
ITISFoundation:master
from
matusdrobuliak66:is1647/collaboration-features-1
Jul 24, 2025
Merged
Changes from 18 commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
8ae2c70
Adds project document versioning and live update notifications
matusdrobuliak66 04af57e
Removes await from non-async socket.io enter_room calls
matusdrobuliak66 58519f3
Refactors project patching to centralize versioned updates
matusdrobuliak66 25f6e97
Clarifies progress field deprecation status in comment
matusdrobuliak66 6befcd9
Adds atomic project workbench updates with Redis locking and notifica…
matusdrobuliak66 3d7c505
refactor duplication
matusdrobuliak66 21b41c6
Merge branch 'master' into is1647/collaboration-features-1
matusdrobuliak66 7956f60
fix relative import
matusdrobuliak66 72bdab8
fix failing tests
matusdrobuliak66 d4beeed
minor
matusdrobuliak66 dbf088f
minor
matusdrobuliak66 dddb7ce
minor
matusdrobuliak66 bfbc285
minor
matusdrobuliak66 5004858
add tests
matusdrobuliak66 714404c
add tests
matusdrobuliak66 47fa937
add tests
matusdrobuliak66 50a40f4
Merge branch 'master' into is1647/collaboration-features-1
matusdrobuliak66 30b8d19
add back function that is being used
matusdrobuliak66 82d6d17
review @GitHK @pcrespov
matusdrobuliak66 8ba5ce7
fix failing tests
matusdrobuliak66 92af830
Fix test_open_project_more_than_limitation_of_max_studies_open_per_us…
matusdrobuliak66 cc9db9a
fix failing tests
matusdrobuliak66 44b4f36
Merge branch 'master' into is1647/collaboration-features-1
matusdrobuliak66 e9b432a
fix issues after resolving conflicts
matusdrobuliak66 5aba0d9
Merge branch 'master' into is1647/collaboration-features-1
matusdrobuliak66 4b845df
Refactors socket connection setup in project state tests
matusdrobuliak66 f2067d5
Merge branch 'is1647/collaboration-features-1' of github.com:matusdro…
matusdrobuliak66 369d6d7
generate open api specs
matusdrobuliak66 88c88fb
review @pcrespov
matusdrobuliak66 2f2af77
minor
matusdrobuliak66 e43e858
review @sanderegg
matusdrobuliak66 22df4d8
Improves logging and test debug visibility
matusdrobuliak66 5af7426
Revert "Improves logging and test debug visibility"
matusdrobuliak66 9c5d319
Merge branch 'master' into is1647/collaboration-features-1
matusdrobuliak66 75a0f7f
Merge branch 'master' into is1647/collaboration-features-1
sanderegg 5d8196c
Merge remote-tracking branch 'upstream/master' into pr/matusdrobuliak…
sanderegg 61e784c
Merge branch 'master' into is1647/collaboration-features-1
sanderegg 4d20c09
removed uv locks and pyproject
sanderegg c5e7bbe
increase delay
sanderegg e0d6282
fix test createing/deleteing nodes in high throuput conditions
sanderegg 186d976
ensure task is not dereferenced
sanderegg 1a2adc7
Merge remote-tracking branch 'upstream/master' into pr/matusdrobuliak…
sanderegg d9d11a9
wait a bit for cleanup
sanderegg 56ce920
private function
sanderegg e7c645e
ruff
sanderegg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
57 changes: 57 additions & 0 deletions
57
packages/service-library/src/servicelib/redis/_project_document_version.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| """Project document versioning utilities. | ||
| This module provides utilities for managing project document versions using Redis. | ||
| The versioning system ensures that all users working on a project are synchronized | ||
| with the latest changes through atomic version incrementing. | ||
| """ | ||
|
|
||
| from typing import Final | ||
|
|
||
| from models_library.projects import ProjectID | ||
|
|
||
| from ._client import RedisClientSDK | ||
|
|
||
| # Redis key patterns | ||
| PROJECT_DOCUMENT_VERSION_KEY: Final[str] = "projects:{}:version" | ||
| PROJECT_DB_UPDATE_REDIS_LOCK_KEY: Final[str] = "project_db_update:{}" | ||
|
|
||
|
|
||
| async def get_and_increment_project_document_version( | ||
matusdrobuliak66 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| redis_client: RedisClientSDK, project_uuid: ProjectID | ||
| ) -> int: | ||
| """ | ||
| Atomically gets and increments the project document version using Redis. | ||
matusdrobuliak66 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Returns the incremented version number. | ||
| This function ensures thread-safe version incrementing by using Redis INCR command | ||
| which is atomic. The version starts at 1 for the first call. | ||
| Args: | ||
| redis_client: The Redis client SDK instance | ||
| project_uuid: The project UUID to get/increment version for | ||
| Returns: | ||
| The new (incremented) version number | ||
| """ | ||
| version_key = PROJECT_DOCUMENT_VERSION_KEY.format(project_uuid) | ||
| # If key doesn't exist, it's created with value 0 and then incremented to 1 | ||
| output = await redis_client.redis.incr(version_key) | ||
| return int(output) | ||
|
|
||
|
|
||
| async def get_project_document_version( | ||
| redis_client: RedisClientSDK, project_uuid: ProjectID | ||
| ) -> int: | ||
| """ | ||
| Gets the current project document version without incrementing it. | ||
| Args: | ||
| redis_client: The Redis client SDK instance | ||
| project_uuid: The project UUID to get version for | ||
| Returns: | ||
| The current version number (0 if no version exists yet) | ||
| """ | ||
| version_key = PROJECT_DOCUMENT_VERSION_KEY.format(project_uuid) | ||
| version = await redis_client.redis.get(version_key) | ||
| return int(version) if version is not None else 0 | ||
matusdrobuliak66 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
68 changes: 68 additions & 0 deletions
68
packages/service-library/tests/redis/test_project_document_version.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| # pylint: disable=redefined-outer-name | ||
| # pylint: disable=unused-argument | ||
|
|
||
| from typing import cast | ||
| from uuid import UUID | ||
|
|
||
| import pytest | ||
| from faker import Faker | ||
| from models_library.projects import ProjectID | ||
| from servicelib.redis import RedisClientSDK | ||
| from servicelib.redis._project_document_version import ( | ||
| get_and_increment_project_document_version, | ||
| get_project_document_version, | ||
| ) | ||
|
|
||
| pytest_simcore_core_services_selection = [ | ||
| "redis", | ||
| ] | ||
| pytest_simcore_ops_services_selection = [ | ||
| "redis-commander", | ||
| ] | ||
|
|
||
|
|
||
| @pytest.fixture() | ||
| def project_uuid(faker: Faker) -> ProjectID: | ||
| return cast(UUID, faker.uuid4(cast_to=None)) | ||
|
|
||
|
|
||
| async def test_project_document_version_workflow( | ||
| redis_client_sdk: RedisClientSDK, project_uuid: ProjectID | ||
| ): | ||
| """Test the complete workflow of getting and incrementing project document versions.""" | ||
|
|
||
| # Initially, version should be 0 (no version exists yet) | ||
| current_version = await get_project_document_version(redis_client_sdk, project_uuid) | ||
| assert current_version == 0 | ||
|
|
||
| # First increment should return 1 | ||
| new_version = await get_and_increment_project_document_version( | ||
| redis_client_sdk, project_uuid | ||
| ) | ||
| assert new_version == 1 | ||
|
|
||
| # Getting current version should now return 1 | ||
| current_version = await get_project_document_version(redis_client_sdk, project_uuid) | ||
| assert current_version == 1 | ||
|
|
||
| # Second increment should return 2 | ||
| new_version = await get_and_increment_project_document_version( | ||
| redis_client_sdk, project_uuid | ||
| ) | ||
| assert new_version == 2 | ||
|
|
||
| # Getting current version should now return 2 | ||
| current_version = await get_project_document_version(redis_client_sdk, project_uuid) | ||
| assert current_version == 2 | ||
|
|
||
| # Multiple increments should work correctly | ||
| for expected_version in range(3, 6): | ||
| new_version = await get_and_increment_project_document_version( | ||
| redis_client_sdk, project_uuid | ||
| ) | ||
| assert new_version == expected_version | ||
|
|
||
| current_version = await get_project_document_version( | ||
| redis_client_sdk, project_uuid | ||
| ) | ||
| assert current_version == expected_version |
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.