-
Notifications
You must be signed in to change notification settings - Fork 22
Adding version control to samples, starting materials and cells #1373
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
Draft
be-smith
wants to merge
14
commits into
main
Choose a base branch
from
bes/revision_history_clean_history
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
… and save the same version. Added better error handling for if an invalid id is used
Adds deepdiff ~= 8.1 to project dependencies to enable proper comparison of nested dictionaries and lists in version control functionality.
Replaces simple dict_diff function with DeepDiff library to properly handle nested dictionaries, lists, type changes, and provide detailed change information for version comparisons.
Adds comprehensive safety checks to restore_version: - Permissions check requiring write access - Protected fields list preventing restoration of critical system fields (refcode, _id, immutable_id, creator_ids, file_ObjectIds, version) - Type consistency check preventing cross-type restoration - Model validation ensuring restored data passes schema validation - Atomic version incrementing using shared counter to prevent collisions The version field now always increments forward to avoid duplicate version numbers when restoring and then making subsequent changes.
Adds action field to track why each version was created: - 'manual_save': User explicitly saved (save-version endpoint or save-item) - 'auto_save': Reserved for future block-triggered auto-saves - 'pre_restore_backup': System backup created before restoring Refactored version saving into _save_version_snapshot() helper function that can be called with different action parameters. The restore_version endpoint also tracks which version was restored to via restored_from_version field.
Changes save_item to update the item BEFORE saving the version snapshot, preventing orphaned versions if the item update fails. Previously: save version → update item (if item update failed, orphaned version) Now: update item → save version (if version save fails, item is still saved) If version save fails after successful item update, the error is logged but the request still succeeds since the user's work has been saved.
Add version field to the HasRevisionControl Pydantic model to support the version control system's snapshot tracking. Fix the save_item endpoint to correctly increment version by adding it to updated_data rather than the discarded item object.
Add 33 tests covering all version control functionality: - Save, list, get, compare, restore, and delete version endpoints - Auto-versioning on save_item - Atomic version counter with race condition prevention - Protected field validation during restore - Permissions enforcement - Error handling and edge cases
- Add action and restored_from_version fields to list_versions endpoint - Change restore to create version snapshot AFTER restoring (not before) - Version snapshot now contains the restored data for clearer audit trail - Update action type from "pre_restore_backup" to "restored"
- Add version control API service methods to server_fetch_utils.js - Create VersionHistoryModal component for viewing and managing versions - Add version history button to EditPage navbar - Support version preview and restore functionality with proper state management
- Add new TestActionFields class with 5 tests validating action values - Test manual_save action from save-version endpoint - Test manual_save action from save-item endpoint (user saves) - Test restored action with restored_from_version reference - Test that restored version snapshots contain the restored data - Test complete audit trail across multiple saves and restore - Rename test_list_versions_action_field to be more descriptive - Update test_restore_version_creates_backup to _creates_snapshot - Remove duplicate action field tests from TestRestoreVersion class - Fix unused variable in test_get_version_success
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1373 +/- ##
==========================================
+ Coverage 80.06% 80.43% +0.37%
==========================================
Files 70 70
Lines 4731 4877 +146
==========================================
+ Hits 3788 3923 +135
- Misses 943 954 +11
🚀 New features to boost your workflow:
|
datalab
|
Project |
datalab
|
Branch Review |
bes/revision_history_clean_history
|
Run status |
|
Run duration | 06m 35s |
Commit |
|
Committer | Ben Smith |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
0
|
|
0
|
|
0
|
|
0
|
|
168
|
View all changes introduced in this branch ↗︎ |
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.
No description provided.