Skip to content

Conversation

@i2h3
Copy link
Collaborator

@i2h3 i2h3 commented Oct 9, 2025

Depends on this being integrated first:
nextcloud/NextcloudKit#193

Done.

@i2h3 i2h3 self-assigned this Oct 9, 2025
@i2h3 i2h3 added the bug Something isn't working label Oct 9, 2025
i2h3 added 13 commits October 13, 2025 09:20
- Removed FileProviderLogDetailKey.metadata because it was intended for Realm data models which actually are unsafe to pass across concurrency domains and caused a crash while doing so.
- Removed FileProviderLogDetailKey.ocId because it is the same as "item" which is intended for the primary key of file provider items.

Signed-off-by: Iva Horn <iva.horn@icloud.com>
- It was specific to the SendableItemMetadata implementation before.
- It actually belongs into the common requirements definition of ItemMetadata.

Signed-off-by: Iva Horn <iva.horn@icloud.com>
- Lock tokens are available only once during the LOCK request.
- During every follow up request like PROPFIND, they are not returned for any item.
- The items in the client database are updated atomically with the remote state.
- The remote state does not provide the lock token.
- So, during any metadata update after locking an item, the locally stored lock token is lost because it is overwritten with the new empty value retrieved from the server.

Signed-off-by: Iva Horn <iva.horn@icloud.com>
Signed-off-by: Iva Horn <iva.horn@icloud.com>
- When a file is either locked or unlocked because of a lock file, its metadata must be updated accordingly.

Signed-off-by: Iva Horn <iva.horn@icloud.com>
Signed-off-by: Iva Horn <iva.horn@icloud.com>
Signed-off-by: Iva Horn <iva.horn@icloud.com>
Signed-off-by: Iva Horn <iva.horn@icloud.com>
Signed-off-by: Iva Horn <iva.horn@icloud.com>
Signed-off-by: Iva Horn <iva.horn@icloud.com>
…incorrect error.

Signed-off-by: Iva Horn <iva.horn@icloud.com>
Signed-off-by: Iva Horn <iva.horn@icloud.com>
@i2h3 i2h3 marked this pull request as ready for review October 13, 2025 07:20
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

A comprehensive fix for token-based file locking functionality, updating lock-related APIs, data structures, and logging systems.

  • Removed obsolete lock properties and simplified lock data model
  • Updated logging system to use standardized keys and improved formatting
  • Enhanced lock file management with proper token handling and metadata updates

Reviewed Changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
Tests/NextcloudFileProviderKitTests/RemoteChangeObserverEtagOptimizationTests.swift Consolidated multi-line assertion into single line
Tests/NextcloudFileProviderKitTests/ItemModifyTests.swift Removed version-specific error handling for lock tests
Tests/Interface/MockRemoteItem.swift Simplified lock properties and updated lock initialization
Sources/NextcloudFileProviderKit/Metadata/SendableItemMetadata.swift Removed lockToken assignment and cleaned up comments
Sources/NextcloudFileProviderKit/Metadata/SendableItemMetadata+Array.swift Updated logging keys from .ocId to .item
Sources/NextcloudFileProviderKit/Metadata/ItemMetadata.swift Moved and improved documentation for isLockFileOfLocalOrigin
Sources/NextcloudFileProviderKit/Log/FileProviderLogDetailKey.swift Consolidated logging keys and added Comparable conformance
Sources/NextcloudFileProviderKit/Log/FileProviderLogDetail.swift Added null safety for lock editor field
Sources/NextcloudFileProviderKit/Log/FileProviderLog.swift Enhanced logging with sorted keys and improved type handling
Sources/NextcloudFileProviderKit/Item/Item.swift Updated lock capability logic and file system flags
Sources/NextcloudFileProviderKit/Item/Item+Modify.swift Added lock token header support and improved logging
Sources/NextcloudFileProviderKit/Item/Item+LockFile.swift Enhanced lock/unlock with metadata synchronization
Sources/NextcloudFileProviderKit/Item/Item+Fetch.swift Standardized logging throughout fetch operations
Sources/NextcloudFileProviderKit/Extensions/NKFile+Extensions.swift Updated lock property mappings to use individual fields
Sources/NextcloudFileProviderKit/Enumeration/RemoteChangeObserver.swift Consolidated logging statements
Sources/NextcloudFileProviderKit/Enumeration/MaterialisedEnumerationObserver.swift Updated logging keys for consistency
Sources/NextcloudFileProviderKit/Enumeration/Enumerator.swift Improved error handling and logging standardization
Sources/NextcloudFileProviderKit/Enumeration/Enumerator+Trash.swift Updated logging key usage
Sources/NextcloudFileProviderKit/Enumeration/Enumerator+SyncEngine.swift Added guard clause and lock token preservation
Sources/NextcloudFileProviderKit/Database/FilesDatabaseManager.swift Updated logging keys and improved method formatting
Sources/NextcloudFileProviderKit/Database/FilesDatabaseManager+KeepDownloaded.swift Updated logging keys for consistency
Sources/NextcloudFileProviderKit/Database/FilesDatabaseManager+Directories.swift Updated logging keys throughout directory operations

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Iva Horn <iva.horn@icloud.com>
@i2h3 i2h3 enabled auto-merge (rebase) October 13, 2025 07:34
Signed-off-by: Iva Horn <iva.horn@nextcloud.com>
@i2h3 i2h3 merged commit 3c28f9c into main Oct 13, 2025
2 checks passed
@i2h3 i2h3 deleted the fix/token-locks branch October 13, 2025 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants