Cache duplicateGroups + verifiedDuplicateGroups per scanFinishedAt#79
Merged
Conversation
Both computed properties currently recompute on every view transition. Mirrors the cachedCleanupCandidates pattern (key + value pair, nil'd together in invalidateDerivedCaches) so Duplicate Review navigation between views no longer re-walks size-group / verified-group aggregation. Cache fields: - cachedDuplicateGroupsKey / cachedDuplicateGroups: [DuplicateSizeGroup] - cachedVerifiedDuplicateGroupsKey / cachedVerifiedDuplicateGroups: [VerifiedDuplicateGroup] Keyed on currentDerivedCacheKey which folds scanFinishedAt, query, sizeFilter, sortOption, cleanupLaneFilter, and ignoredCleanupCandidateIDs — matches the existing cleanup-candidates cache identity so any selection / filter mutation drops the cache. Co-Authored-By: NCode <noreply@noumena.com>
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
duplicateGroupsandverifiedDuplicateGroupson ScanStore previously recomputed on every property access. For users switching between Duplicate Review and other views, this re-walked size-group / verified-group aggregation each time. v0.4.5 already cachedcleanupCandidatesthis way — this PR applies the same pattern to the two remaining duplicate-side derived properties.Changes
Adds four cached fields mirroring
cachedCleanupCandidates/cachedCleanupCandidatesKey:cachedDuplicateGroupsKey: DerivedCacheKey?+cachedDuplicateGroups: [DuplicateSizeGroup]cachedVerifiedDuplicateGroupsKey: DerivedCacheKey?+cachedVerifiedDuplicateGroups: [VerifiedDuplicateGroup]Each property checks the key against
currentDerivedCacheKey; on miss it recomputes, populates, and returns.invalidateDerivedCaches()now nils all four new cached vars alongside the existing ones.The cache key already folds
scanFinishedAt,query,sizeFilter,sortOption,cleanupLaneFilter, andignoredCleanupCandidateIDs— selection / filter / scan mutations drop the cache, exactly likecleanupCandidates.Test plan
swift test(54 tests in 5 suites pass)swift buildsucceeds./script/public_upload_audit.shpasses🤖 Generated with NCode