Repository navigation
Conversation
…ualify Signed-off-by: kyteinsky <kyteinsky@gmail.com>
|
noticed we have |
I vaguely remember CacheEntryInserted also covers external storage which others might not, but not sure |
Signed-off-by: kyteinsky <kyteinsky@gmail.com>
|
mmh.
|
|
Signed-off-by: kyteinsky <kyteinsky@gmail.com>
Signed-off-by: kyteinsky <kyteinsky@gmail.com>
4068d1d to
69c5cd7
Compare
Signed-off-by: kyteinsky <kyteinsky@gmail.com>
Signed-off-by: kyteinsky <kyteinsky@gmail.com>
Signed-off-by: kyteinsky <kyteinsky@gmail.com> Assisted-by: Copilot:claude-code-5-5
69c5cd7 to
a5d6c94
Compare
Co-authored-by: Marcel Klehr <mklehr@gmx.net> Signed-off-by: Anupam Kumar <kyteinsky@gmail.com>
Signed-off-by: kyteinsky <kyteinsky@gmail.com>
The path checks for versions and trash assumed the layout of a home or groupfolder storage on every storage, so folders of external storages named trash, versions, files_versions or files_trashbin were never indexed. - classify the storage of the cache event: home (only files/), groupfolder with a separate storage (not trash/ and versions/), root (only __groupfolders/<id>/) and everything else (no restriction) - do not filter removals caused by a move to another storage by layout, the event carries the target storage with the source path - add unit tests with mocked storages and integration tests that run the scanner on the real groupfolders and files_external storages - add a workflow to run them against groupfolders on stable33-35 and master Signed-off-by: kyteinsky <kyteinsky@gmail.com> Assisted-by: Claude Code:claude-sonnet-5-5
… a database - tearDown accessed the uninitialised user when setUp skipped the test, so the generic phpunit workflows (no groupfolders) errored instead of skipping - only delete the actions the test queued, not the whole action queue - correct the comment on jailed storages: groupfolders with encryption fire their cache events through the jail too, those are filtered by mimetype Signed-off-by: kyteinsky <kyteinsky@gmail.com> Assisted-by: Claude Code:claude-sonnet-5-5
Jailed storages were allowed outright. With groupfolders encryption, all groupfolder cache events carry the jail, so files with an indexable name in the groupfolder trash or versions passed the path check; their removal scheduled delete actions. - unjail the storage and path before applying the layout rules - for inserts, read the unjailed path from the filecache row, groupfolders rewrites inserted paths relative to its jail - add a psalm stub for the private Wrapper and Jail classes instead of suppressing them - shorten the comments and link the code they refer to - test jailed mounts in the unit tests, and groupfolders:scan with groupfolders encryption off and on in the integration test Signed-off-by: kyteinsky <kyteinsky@gmail.com> Assisted-by: Claude Code:claude-sonnet-5-5
A scan that finds a file changed on the storage (external storage, data directory) only fires CacheEntryUpdatedEvent, which was not handled, so the file was never re-indexed. - handle CacheEntryUpdatedEvent like an insert, queued as an update - check the extension and the storage layout before any lookup, for inserts and updates alike: most cache events of a scan are folders (#297) - skip the fs event of renames whose target is a non-indexable file - test the updated event, the folder short-cut and renames; integration test an edit on an external storage Signed-off-by: kyteinsky <kyteinsky@gmail.com> Assisted-by: Claude Code:claude-sonnet-5-5
A restore moves a folder's children with one SQL update and no cache events, and the folder itself is dropped by the extension check, so restored files were never indexed again. groupfolders emits no NodeRestoredEvent, only the legacy post_restore hook, which the user trashbin emits too. - listen to the post_restore hook and schedule the restored node; folders re-index their children in the background job - share the cheap indexable-node check with the rename handling - todo: switch to NodeUpdatedEvent once groupfolders emits it for restores - unit tests for the listener; integration tests restoring a folder from the user trash and from a groupfolder trash Signed-off-by: kyteinsky <kyteinsky@gmail.com> Assisted-by: Claude Code:claude-sonnet-5-5
Signed-off-by: kyteinsky <kyteinsky@gmail.com>
The first update of a trash restore still has the octet-stream mimetype of the trashed name; the server's mimetype fix fires another update in the same request. Assisted-by: Claude Code:claude-sonnet-5-5 Signed-off-by: kyteinsky <kyteinsky@gmail.com>
The post_restore hook was connected in boot(), which never runs on WebDAV requests: remote.php loads only authentication/filesystem/logging apps, so restores from the Files UI were not re-indexed. Listen to the typed NodeRestoredEvent instead, registered lazily, which fires on DAV too. A restore is handled like a rename: schedule the target node, filtered by isIndexableNode(). Drop the separate TrashRestoreListener and cover both events in the same unit test. - schedule the event's target node, with the indexable-node filter for files - groupfolders does not dispatch the event yet: its restore test skips until it does; groupfolder restores re-index single files only - psalm stub for the files_trashbin event Assisted-by: Claude Code:claude-sonnet-5-5 Signed-off-by: kyteinsky <kyteinsky@gmail.com>
|
now two more events are listened to groupfolders does not emit |
|
phpunit storages job fails on stable34 due to this not being merged: nextcloud/server#64497 |
| */ | ||
| public function allowedCacheEventPath(ICacheEvent $event): bool { | ||
| $storage = $event->getStorage(); | ||
| if ($storage->getCache()->getNumericStorageId() !== $event->getStorageId()) { |
There was a problem hiding this comment.
Doesn't this mean that files moved between storages, e.g. from home to a groupfolder, would now queue a delete and a re-index? This would be a) unnecessary and b) a race condition, possibly leaving the file unindexed, depending on the order these two are run in.
| // folders are detected as "application/octet-stream" which is fine for this use-case | ||
| // since they are not indexable either, the files inside the folder are received in | ||
| // separate cache entry events | ||
| if (!$this->allowedMimeType($this->mimeTypeDetector->detectPath($event->getPath()))) { |
There was a problem hiding this comment.
And what about README files?
| $fileRefs[] = ProviderConfigService::getSourceId($fileId); | ||
| } | ||
| try { | ||
| $this->actionService->deleteSources($fileRefs); |
There was a problem hiding this comment.
Should we also remove the files from the queue in case they're still queued?
| return; | ||
| } | ||
|
|
||
| $node = $this->rootFolder->getFirstNodeById($storageCacheEntry->getId()); |
There was a problem hiding this comment.
This is quite expensive, I think. CacheEntryUpdatedEvenjt seems to be called multiple times per upload or edit. Should we check if the affected storage is actually an external storage? Otherwise NodeWrittenEvent does the job fine, I think.
|
it seems at the moment each deleted file is deleted 2–3 times in the backend: BeforeNodeDeletedEvent, NodeRemovedFromCache and CacheEntryRemovedEvent each queue their own delete for the same id. A trash restore is queued once by CacheEntryUpdatedEvent and again by NodeRestoredEvent. Renames within one storage are double-queued the same way. |
|
Sorry the review isn't greener :/ |



…ualify
fixes #297
🤖 AI (if applicable)