Improve path display#469
Conversation
Changes error messages like error: path '/nix/store/v57qvdsi3n14hlzdrxkbv3dxj8781818-source/READMEE.md' does not exist to error: path '«file:///home/eelco/Dev/nix/nixpkgs.tar.gz»/READMEE.md' does not exist In impure mode, the showPath() from the UnionSourceAccessor's first element was preventing the use of the more accurate showPath() from storeFS.
…cessor There may be more informative than the generate "path does not exist". In any case it makes --impure more consistent because the UnionSourceAccessor now produces the same exceptions from storeFS.
This is necessary if the path has an overriden display (e.g. if it's a substituted source tree).
This was actually preventing display of correct paths, since the exception is thrown by PosixSourceAccessor(), so SubstitutedSourceAccessor::showPath() was never called. (This was previously masked in some cases by UnionSourceAccessor.)
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds a mark-last range adaptor, standardizes FileNotFound errors across source accessors, extends UnionSourceAccessor to accept a separate display accessor, updates callers to use the new factory signature, removes the SubstitutedSourceAccessor wrapper, and enables tarball fetch substitution with tests. ChangesSource Accessor Display and Error Handling
Sequence Diagram(s)sequenceDiagram
participant Caller
participant UnionSourceAccessor
participant displayAccessor
participant accessors as accessors vector
Caller->>UnionSourceAccessor: readFile(path)
UnionSourceAccessor->>accessors: iterate with markLast
loop for each accessor until last
accessors->>UnionSourceAccessor: maybeLstat result
end
Note over UnionSourceAccessor: early return on last accessor
Caller->>UnionSourceAccessor: showPath(path)
alt displayAccessor present
UnionSourceAccessor->>displayAccessor: showPath(path)
else
UnionSourceAccessor->>UnionSourceAccessor: fallback SourceAccessor::showPath
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Motivation
This fixes various cases where Nix would show store paths instead of source trees in error messages, e.g.
instead of
It also removes now unnecessary substitution code in
fetchTarballas a followup to #468.Context
Summary by CodeRabbit
Bug Fixes
New Features
Tests