memfs: Reject ReadDir calls on regular files #247
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 235 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
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.327
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #247"
general
weight: 0.35
pjbgf
memfs.ReadDircurrently returns an empty result and no error for a regular file. Callers cannot distinguish that invalid directory path from an empty directory, unlike the OS-backed filesystem and the documentedbilly.Dircontract.Return a
*os.PathErrorwrappingsyscall.ENOTDIRafter resolving symlinks. The shared directory-conformance test compares the same call through memfs and osfs. A memfs regression also checks that a link to a file is rejected while a link to a directory remains readable.Minimal reproduction:
Before: empty entries, nil error. After: nil entries and a non-nil path error. The OS-backed regression passed before the change; the memfs and symlink-to-file regressions failed before and pass after.
Validation on Windows / Go 1.26.8:
go test ./memfs -count=1go test ./test -run '^TestDir_' -count=1go vet ./memfs ./test, gofmt andgit diff --check--new-from-rev=eae82c9f2d37fb502d080eef0ab6bc1655501985.Full-suite limitations were checked against a separate clean snapshot of the same upstream revision: both runs hit existing Windows symlink-privilege failures and the 45-second bound in the large TempFileMany stress test. Full lint reports unrelated findings in unchanged files on both snapshots; full vet flags the existing osfs.WriteTo signature. A full-suite pass or race-test pass is not claimed; the local C compiler could not start.
AI assistance: OpenAI Codex (GPT-6) assisted with investigation, implementation, regression tests, validation and this description. The commit includes an Assisted-by trailer and DCO sign-off.