Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Changelog

- **Fixed** Vite+ diagnostics now display individual paths and working directories without Rust debug formatting such as quoted paths or escaped Windows backslashes ([#534](https://github.com/voidzero-dev/vite-task/pull/534)).
- **Fixed** Broad workspace globs no longer discover and run package scripts inside `node_modules` ([#539](https://github.com/voidzero-dev/vite-task/pull/539)).
- **Added** Tasks now run with `VP_RUN=1` set, so tools can tell they are running under `vp run` instead of being invoked directly ([#570](https://github.com/voidzero-dev/vite-task/pull/570)).
- **Fixed** The task cache now supports much larger automatically tracked input sets without hitting wincode's default 4 MiB sequence preallocation limit ([#554](https://github.com/voidzero-dev/vite-task/pull/554)).
Expand Down
5 changes: 4 additions & 1 deletion crates/fspy/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ use std::{ffi::OsString, path::PathBuf};
#[derive(thiserror::Error, Debug)]
pub enum SpawnError {
#[error(
"could not resolve the full path of program '{program:?}' with PATH={path:?} under cwd({cwd:?})"
"could not resolve the full path of program '{}' with PATH={} under cwd({})",
.program.display(),
.path.as_deref().unwrap_or_else(|| std::ffi::OsStr::new("<not set>")).display(),
.cwd.display()
)]
Which {
program: OsString,
Expand Down
5 changes: 3 additions & 2 deletions crates/fspy_shared/src/ipc/channel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ pub struct Sender {
impl Drop for Sender {
fn drop(&mut self) {
if let Err(err) = self.lock_file.unlock() {
debug!("Failed to unlock the shared IPC lock {:?}: {}", self.lock_file_path, err);
let lock_file_path = self.lock_file_path.to_cow_os_str();
debug!("Failed to unlock the shared IPC lock {}: {}", lock_file_path.display(), err);
}
}
}
Expand Down Expand Up @@ -147,7 +148,7 @@ unsafe impl Sync for Receiver {}
impl Drop for Receiver {
fn drop(&mut self) {
if let Err(err) = std::fs::remove_file(&self.lock_file_path) {
debug!("Failed to remove IPC lock file {:?}: {}", self.lock_file_path, err);
debug!("Failed to remove IPC lock file {}: {}", self.lock_file_path.display(), err);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/vt/src/session/cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ pub fn cache_schema_dir_name() -> Str {
impl ExecutionCache {
#[tracing::instrument(level = "debug", skip_all)]
pub fn load_from_path(path: &AbsolutePath) -> anyhow::Result<Self> {
tracing::info!("Creating task cache directory at {:?}", path);
tracing::info!("Creating task cache directory at {}", path.as_path().display());
std::fs::create_dir_all(path)?;

// Use file lock to prevent race conditions when multiple processes initialize the database
Expand Down
4 changes: 2 additions & 2 deletions crates/vt/src/session/execute/fingerprint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,8 @@ pub fn fingerprint_path(
}
if err.kind() != io::ErrorKind::NotFound {
tracing::trace!(
"Uncommon error when opening {:?} for fingerprinting: {}",
std_path,
"Uncommon error when opening {} for fingerprinting: {}",
std_path.display(),
err
);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/vt/src/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ impl<'a> Session<'a> {
let path = self.summary_file_path();
Box::new(move |summary: &LastRunSummary| {
if let Err(err) = summary.write_atomic(&path) {
tracing::warn!("Failed to write summary to {path:?}: {err}");
tracing::warn!("Failed to write summary to {}: {err}", path.as_path().display());
}
})
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "invalid-package-json"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name":
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
packages:
- packages/*
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[[e2e]]
name = "invalid_package_json_error"
comment = """
Tests that package parse errors display paths without Rust debug formatting
"""
steps = [
[
"vtt",
"cp",
"packages/broken/package.invalid",
"packages/broken/package.json",
],
[
"vt",
"run",
"build",
],
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# invalid_package_json_error

Tests that package parse errors display paths without Rust debug formatting

## `vtt cp packages/broken/package.invalid packages/broken/package.json`

```
```

## `vt run build`

**Exit code:** 1

```
error: Failed to load task graph
* Failed to load package graph
* Failed to parse JSON file at <workspace>/packages/broken/package.json
* expected value at line 3 column 1
```
2 changes: 1 addition & 1 deletion crates/vt_graph/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub enum TaskGraphLoadError {
#[error("Failed to load package graph")]
PackageGraphLoadError(#[from] vt_workspace::Error),

#[error("Failed to load task config file for package at {package_path:?}")]
#[error("Failed to load task config file for package at {}", .package_path.as_path().display())]
ConfigLoadError {
package_path: Arc<AbsolutePath>,
#[source]
Expand Down
11 changes: 9 additions & 2 deletions crates/vt_plan/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ impl std::fmt::Display for WhichError {

#[derive(Debug, thiserror::Error)]
pub enum PathFingerprintErrorKind {
#[error("Path {path:?} is outside of the workspace {workspace_path:?}")]
#[error(
"Path {} is outside of the workspace {}",
.path.as_path().display(),
.workspace_path.as_path().display()
)]
PathOutsideWorkspace { path: Arc<AbsolutePath>, workspace_path: Arc<AbsolutePath> },
#[error("Path {path:?} contains characters that make it non-portable")]
NonPortableRelativePath {
Expand Down Expand Up @@ -119,7 +123,10 @@ pub enum Error {
#[error(transparent)]
TaskRecursionDetected(#[from] TaskRecursionError),

#[error("Invalid vite task command: {program} with args {args:?} under cwd {cwd:?}")]
#[error(
"Invalid vite task command: {program} with args {args:?} under cwd {}",
.cwd.as_path().display()
)]
ParsePlanRequest {
program: Str,
args: Arc<[Str]>,
Expand Down
2 changes: 1 addition & 1 deletion crates/vt_server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub enum Error {
#[error("invalid message from the task")]
InvalidRequest(#[source] wincode::ReadError),

#[error("non-absolute path from the task: {path:?}")]
#[error("non-absolute path from the task: {}", .path.display())]
NonAbsolutePath { path: OsString },

#[error("invalid glob pattern from the task: {:?}", .0.pattern)]
Expand Down
2 changes: 2 additions & 0 deletions crates/vt_server/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ fn server_returns_error_on_non_absolute_path() {
})
.expect_err("driver should surface the protocol error");

assert_eq!(err.to_string(), "non-absolute path from the task: relative/path");

match err {
Error::NonAbsolutePath { path } => {
assert_eq!(path, OsStr::new("relative/path"));
Expand Down
12 changes: 8 additions & 4 deletions crates/vt_workspace/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ pub enum Error {
#[error("Duplicate package name `{name}` found at `{path1}` and `{path2}`")]
DuplicatedPackageName { name: Str, path1: RelativePathBuf, path2: RelativePathBuf },

#[error("Package not found in workspace: `{0:?}`")]
#[error("Package not found in workspace: `{}`", .0.as_path().display())]
PackageJsonNotFound(AbsolutePathBuf),

#[error("Package at `{package_path:?}` is outside workspace root `{workspace_root:?}`")]
#[error(
"Package at `{}` is outside workspace root `{}`",
.package_path.as_path().display(),
.workspace_root.as_path().display()
)]
PackageOutsideWorkspace { package_path: Arc<AbsolutePath>, workspace_root: Arc<AbsolutePath> },

#[error(
Expand All @@ -35,14 +39,14 @@ pub enum Error {
#[error(transparent)]
Io(#[from] io::Error),

#[error("Failed to parse JSON file at {file_path:?}")]
#[error("Failed to parse JSON file at {}", .file_path.as_path().display())]
SerdeJson {
file_path: Arc<AbsolutePath>,
#[source]
serde_json_error: serde_json::Error,
},

#[error("Failed to parse YAML file at {file_path:?}")]
#[error("Failed to parse YAML file at {}", .file_path.as_path().display())]
SerdeYaml {
file_path: Arc<AbsolutePath>,
#[source]
Expand Down
Loading