Skip to content

Fail fast with an actionable error when a local registry, dependency, template, or policy path does not exist - #1598

Open
ANcpLua wants to merge 2 commits into
open-telemetry:mainfrom
ANcpLua:fix/vdir-not-found-diagnostics
Open

Fail fast with an actionable error when a local registry, dependency, template, or policy path does not exist#1598
ANcpLua wants to merge 2 commits into
open-telemetry:mainfrom
ANcpLua:fix/vdir-not-found-diagnostics

Conversation

@ANcpLua

@ANcpLua ANcpLua commented Jul 17, 2026

Copy link
Copy Markdown

Problem

A relative registry_path in a registry manifest dependency resolves against the process working directory. Running weaver from any other directory fails late in resolution with a bare

× The following error occurred during the processing of semantic convention
│ file: IO error for operation on ./dep-model: No such file or directory (os error 2)

— 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 with registry_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

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:

× Virtual directory `./dep-model` is invalid: local path does not exist
│ (resolved to `/home/user/somewhere/dep-model` against the current working
│ directory). Relative paths — including `registry_path` entries in a
│ registry manifest — resolve against the current working directory, not the
│ location of the file that declares them; run weaver from the directory the
│ path is relative to, or use an absolute path

Absolute paths get a plain "local path does not exist". No behavior change for existing paths. Because the check lives in the shared VirtualDirectory layer, it also covers the main -r registry path, template and policy paths, and the case where a mistyped URL parses as a LocalFolder.

Non-goal

This does not change resolution semantics. Whether a dependency registry_path should (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

  • New unit test covering both branches (relative path with CWD hint, absolute path without).
  • Full workspace test suite passes.
  • Manually verified end-to-end: a minimal registry with a ./dep-model dependency fails with the new message from the wrong CWD and resolves unchanged from the correct one.

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.
@ANcpLua
ANcpLua force-pushed the fix/vdir-not-found-diagnostics branch from f4698eb to 1eb4ba1 Compare July 17, 2026 07:08
@ANcpLua
ANcpLua marked this pull request as ready for review July 17, 2026 07:12
@ANcpLua
ANcpLua requested a review from a team as a code owner July 17, 2026 07:12
@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.2%. Comparing base (d98fbe0) to head (fe0f25b).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Jul 18, 2026

Copy link
Copy Markdown

Pull request dashboard status

Waiting on the author · refreshed 2026-08-04 14:26 UTC

Two things need attention:

  • Required checks are failing — investigate the failures.
  • 3 review items — respond to each (e.g. link a commit, explain why not, ask a follow-up):
    • Inline threads: 1, 2
    • Top-level threads: 3
Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Should this be with reviewers? Comment /dashboard route:reviewers to route it to them.
  • Anything wrong — including the routing? Report it with what you expected; it helps us improve the dashboard.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 LocalFolder in VirtualDirectory::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() {
Comment on lines +1202 to +1209
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}");
@jsuereth

Copy link
Copy Markdown
Contributor

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.

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Jul 29, 2026

Copy link
Copy Markdown

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 /dashboard route:reviewers to route it from waiting on the author to waiting on reviewers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants