Fail fast with an actionable error when a local registry, dependency, template, or policy path does not exist - #1598
Conversation
A relative dependency registry_path in a registry manifest resolves against the process working directory. Running weaver from any other directory failed late with a bare "IO error … No such file or directory" that named neither the base directory used nor the file that declared the path. VirtualDirectory now rejects a nonexistent LocalFolder eagerly: the error names the path as written, the absolute path it resolved to against the current working directory, and explains the resolution semantics. Absolute paths get a plain "does not exist". No behavior change for existing paths.
f4698eb to
1eb4ba1
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1598 +/- ##
=====================================
Coverage 81.2% 81.2%
=====================================
Files 130 130
Lines 11463 11476 +13
=====================================
+ Hits 9309 9321 +12
- Misses 2154 2155 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Pull request dashboard statusWaiting on the author · refreshed 2026-08-04 14:26 UTC Two things need attention:
Status above doesn't look right?
|
There was a problem hiding this comment.
Pull request overview
This PR improves developer ergonomics by failing early when a VirtualDirectoryPath::LocalFolder points at a nonexistent local path, producing an actionable error that explains the CWD-relative resolution semantics (notably for manifest registry_path dependencies).
Changes:
- Add an eager existence check for
LocalFolderinVirtualDirectory::try_new_with_auth, with a richer error message for missing relative paths. - Add a unit test covering relative vs absolute missing local paths.
- Document the behavior change in the Unreleased changelog.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/weaver_common/src/vdir.rs | Adds fail-fast validation for missing local folders and introduces a unit test for the improved error messaging. |
| CHANGELOG.md | Notes the new fail-fast, CWD-explaining error behavior for missing local paths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }), | ||
| LocalFolder { path } => { | ||
| let local_path = Path::new(path); | ||
| if local_path.exists() { |
| let vdir_path = VirtualDirectoryPath::LocalFolder { | ||
| path: "/definitely/does/not/exist".to_owned(), | ||
| }; | ||
| let error = VirtualDirectory::try_new(&vdir_path) | ||
| .expect_err("nonexistent local folder must be rejected") | ||
| .to_string(); | ||
| assert!(error.contains("/definitely/does/not/exist"), "{error}"); | ||
| assert!(!error.contains("current working directory"), "{error}"); |
|
Generally fix looks good - would approve, but I think Co-pilot found the bug in the windows build. Please fix tests and then I think we can merge. |
|
Hi @ANcpLua — just a friendly reminder that this pull request is waiting on you. There are still items that need your attention. See the dashboard status comment for the full list. You don't need to push a code change to hand it back — replying to move each discussion forward is enough, whether that's answering a question, explaining why no change is needed, or asking a follow-up. The dashboard then automatically routes it back to reviewers. If you believe this pull request is incorrectly routed as waiting on the author, comment |
Problem
A relative
registry_pathin a registry manifest dependency resolves against the process working directory. Running weaver from any other directory fails late in resolution with a bare— no mention of which base directory the path was resolved against, or that the CWD is what matters. Hit in practice consuming
semantic-conventions-genai(multi-registry manifest withregistry_path: ./.build/sc-upstream-filtered) from an external codegen pipeline: the main registry resolves fine via-r, then the dependency dies with the message above.Change
VirtualDirectorynow rejects a nonexistentLocalFoldereagerly. The error names the path as written, the absolute path it resolved to against the current working directory, and explains the resolution semantics:Absolute paths get a plain "local path does not exist". No behavior change for existing paths. Because the check lives in the shared
VirtualDirectorylayer, it also covers the main-rregistry path, template and policy paths, and the case where a mistyped URL parses as aLocalFolder.Non-goal
This does not change resolution semantics. Whether a dependency
registry_pathshould (also) resolve relative to the manifest location is a separate design discussion — happy to open an issue laying out the options (resolution fallback order, opt-in field, breaking switch) if there is interest.Testing
./dep-modeldependency fails with the new message from the wrong CWD and resolves unchanged from the correct one.