Avoid per-entry stats when listing in-memory directories #32063
All Vouch review confidence checks passed
Residual risk 0.05 = Change Risk (0.46) × (1 − Review Confidence (0.89)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.46 · 155 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.90 · 5 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.302
Real PR Conversation Timeline
6 items
Are children expected to contain . and ..? If so, would presizing with -2 be better?
Is it worth pulling this out with a size check?
Yes. newRootInode inserts both entries for the root, and insertChildDirectory inserts both before publishing every other directory. I changed the capacity to children.size() - 2 in ad82a753a4.
Done in ad82a753a4: childCount > 0 && !dirInfo.isExecutable() is now checked once before the loop. On that error case I use FileSystem.readdir so the exception still names the first real child; an empty readable directory still succeeds without execute permission. The ordinary NOFOLLOW loop no longer checks permissions per entry.
CI fails in a way that may be related
fmeum
dzbarsky
InMemoryFileSystem.readdirobtainsDirenttypes directly from child inodes for NOFOLLOW, avoiding a stat and inode lookup per entry.readdirsizes the result list from the directory’s child count and checks search permission once for nonempty directories. Unreadable and non-executable directories retainFileSystem.readdirerrors. FOLLOW still usesFileSystem.readdir. The existingInMemoryFileSystemTestregression covers unreadable, empty non-executable, and nonempty non-executable directories.In the original fixture restoring 256 cached repositories and 131,072 files, median analysis time improved from 3.356 to 2.923 s and command time from 9.258 to 8.807 s. These measurements precede the review changes to list capacity and permission checking. The complete PR diff passes
git diff --check.@fmeum