Skip to content

[feature] Track skipped entries in InventoryPart #267

@paul-fresquet

Description

@paul-fresquet

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions