ByteSync icon indicating copy to clipboard operation
ByteSync copied to clipboard

[feature] Track skipped entries in InventoryPart

Open paul-fresquet opened this issue 10 months ago • 0 comments

Summary

Add tracking of skipped entries to InventoryPart so that the system can report how many entries were excluded during inventory building and why.

Background

Currently, InventoryPart tracks:

  • FileDescriptions — files included in inventory
  • DirectoryDescriptions — directories included in inventory
  • IsIncompleteDueToAccess — flag for access errors

There is no tracking of entries that were intentionally skipped (hidden files, noise files, symlinks, etc.).

Proposed Changes

Add to InventoryPart

public class InventoryPart
{
    // Existing properties...
    
    /// <summary>
    /// Entries that were skipped during inventory building.
    /// </summary>
    public List<SkippedEntry> SkippedEntries { get; } = new();
    
    /// <summary>
    /// Total count of skipped entries.
    /// </summary>
    public int SkippedCount => SkippedEntries.Count;
    
    /// <summary>
    /// Count of entries skipped for a specific reason.
    /// </summary>
    public int GetSkippedCountByReason(SkipReason reason) 
        => SkippedEntries.Count(e => e.Reason == reason);
}

Integration in InventoryBuilder

Add a helper method to record skipped entries:

private void RecordSkippedEntry(InventoryPart part, FileSystemInfo fsi, SkipReason reason, FileSystemEntryKind? kind = null)
{
    var skipped = new SkippedEntry
    {
        FullPath = fsi.FullName,
        RelativePath = BuildRelativePath(part, fsi),
        Name = fsi.Name,
        Reason = reason,
        DetectedKind = kind
    };
    part.SkippedEntries.Add(skipped);
}

Update Skip Points

Modify all skip points in InventoryBuilder to call RecordSkippedEntry:

  • ShouldIgnoreHiddenFile() → SkipReason.Hidden
  • ShouldIgnoreHiddenDirectory() → SkipReason.Hidden
  • ShouldIgnoreSystemFile() → SkipReason.NoiseFile or SkipReason.SystemAttribute
  • IsReparsePoint() → SkipReason.Symlink
  • POSIX special file detection → SkipReason.SpecialPosixFile
  • IsOffline() / IsRecallOnDataAccess() → SkipReason.Offline
  • Access exceptions → SkipReason.Inaccessible

Acceptance Criteria

  • [ ] Add SkippedEntries list to InventoryPart
  • [ ] Add SkippedCount property
  • [ ] Add GetSkippedCountByReason() method
  • [ ] Create RecordSkippedEntry() helper in InventoryBuilder
  • [ ] Update all skip points to record entries
  • [ ] Integration tests verifying skipped entries are tracked
  • [ ] Verify no performance regression with large directories

Technical Notes

  • SkippedEntries is NOT serialized to inventory files (runtime only)
  • Consider memory impact for directories with many excluded files
  • May want to add a cap or sampling for extreme cases (future enhancement)

Dependencies

  • Requires: SkippedEntry model and SkipReason enum (issue #X)

Priority

Standard — Foundation for UI reporting of skipped entries.

paul-fresquet avatar Feb 01 '26 19:02 paul-fresquet