fix(files): report new files as new in the files:scan summary - #62024
fix(files): report new files as new in the files:scan summary#62024seenickcode wants to merge 2 commits into
Conversation
956ee9d to
15c006f
Compare
The addToCache listener decides between NodeAddedToCache and FileCacheUpdated by checking `if ($fileId)`, but Cache\Scanner emits $fileId = -1 for newly inserted entries, which is truthy. As a result the NodeAddedToCache branch was unreachable and `occ files:scan` has reported every new file as "Updated" (never "New") since the summary was introduced in 292c0e5. Check for the actual -1 sentinel instead, and add a regression test asserting that a first scan dispatches NodeAddedToCache and a re-scan of a modified file dispatches FileCacheUpdated. Assisted-by: ClaudeCode:claude-fable-5 Signed-off-by: Nick Manning <nicholas.manning@gmail.com>
15c006f to
68c4740
Compare
SGTM Co-authored-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com> Signed-off-by: Nick Manning <75833+seenickcode@users.noreply.github.com>
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
Summary
occ files:scanhas reported every new file as "Updated" (never "New")since the summary table was introduced in 292c0e5.
Root cause: the addToCache listener decides between
NodeAddedToCacheandFileCacheUpdatedby checkingif ($fileId), butCache\Scanneremits$fileId = -1for newly inserted entries, which is truthy. As a result,the
NodeAddedToCachebranch was unreachable.What it does
-1sentinel instead, so newly inserted entriesdispatch
NodeAddedToCacheand existing entries dispatchFileCacheUpdatedNodeAddedToCacheand a re-scan of a modified file dispatchesFileCacheUpdatedHow I verified
Setup: Nextcloud master, MariaDB, an S3 (MinIO) external storage mount with
100 files in 35 folders, mounted at
/legacyfor userdemo01.Before each scan I cleared the mount's rows from the file cache so every
entry the scan finds is guaranteed new:
On master — all 135 entries were just deleted, so all of them are new,
yet the summary reports none:
On this branch — identical steps:
The included regression test also fails against master and passes with the
fix (first scan must dispatch
NodeAddedToCache, re-scan of a modifiedfile must dispatch
FileCacheUpdated).Checklist
3. to review, feature component)stable32)AI (if applicable)