fix(files): report new files as new in the files:scan summary#62024
Open
seenickcode wants to merge 1 commit into
Open
fix(files): report new files as new in the files:scan summary#62024seenickcode wants to merge 1 commit into
seenickcode wants to merge 1 commit into
Conversation
fd27d32 to
ae89b55
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>
956ee9d to
15c006f
Compare
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
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.
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)