engine: count pruned directories in the receipt's skip accounting - #84
Merged
Conversation
walkRepo returned filepath.SkipDir before reaching skips.count++, so an ignored directory's files landed in no bucket: not files_seen, not files_skipped. The metric counted only ignored FILES the walker reached -- 9 on a tree with ~67k ignored files, naming none of them. A bad ignore glob, the thing this metric exists to catch, is almost always a directory glob. Count a pruned directory once, in a new dirs_skipped field, rather than walking node_modules/ purely to size it. Each skipped_sample entry now names the glob that matched it, so "why is this file missing?" is a lookup. To get the pattern, matchAnyGlob is split into matchGlob, which returns it; matchAnyGlob wraps it, so both glob lists still share one matcher. Exclude the configured output dir: .enola/** is itself a directory glob, so counting it would make dirs_skipped differ between a repo's first snapshot and every later one, and land as a phantom delta in diff_snapshot. No cacheVersion bump -- facts.jsonl is byte-identical across the fix, so no cachecov entry and no golden regeneration. Adds the tests that were missing: nothing asserted files_skipped and no golden fixture contains an ignored directory, which is how this survived 96 bumps.
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.
walkRepo returned filepath.SkipDir before reaching skips.count++, so an ignored directory's files landed in no bucket: not files_seen, not files_skipped. The metric counted only ignored FILES the walker reached -- 9 on a tree with ~67k ignored files, naming none of them. A bad ignore glob, the thing this metric exists to catch, is almost always a directory glob.
Count a pruned directory once, in a new dirs_skipped field, rather than walking node_modules/ purely to size it. Each skipped_sample entry now names the glob that matched it, so "why is this file missing?" is a lookup. To get the pattern, matchAnyGlob is split into matchGlob, which returns it; matchAnyGlob wraps it, so both glob lists still share one matcher.
Exclude the configured output dir: .enola/** is itself a directory glob, so counting it would make dirs_skipped differ between a repo's first snapshot and every later one, and land as a phantom delta in diff_snapshot.
No cacheVersion bump -- facts.jsonl is byte-identical across the fix, so no cachecov entry and no golden regeneration. Adds the tests that were missing: nothing asserted files_skipped and no golden fixture contains an ignored directory, which is how this survived 96 bumps.