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

- **Changed** When automatic file-access tracking cannot record everything a task did, the "Not cached" summary line now includes the reason (for example, that the tracking channel ran out of capacity) ([#1054](https://github.com/voidzero-dev/vite-task/pull/1054)).
- **Changed** Invalid remote cache endpoint URLs in `cache.remote.url` or `VP_REMOTE_CACHE_URL` (such as missing schemes, non-`http`/`https` schemes, or missing hosts) now fail upfront during configuration and planning instead of warning per task during execution, and `vp run --help` now documents `VP_REMOTE_CACHE`, `VP_REMOTE_CACHE_URL`, and `VP_REMOTE_CACHE_HEADER_<NAME>` ([#1048](https://github.com/voidzero-dev/vite-task/pull/1048)).
- **Changed** Removed `NEXT_*`, `VERCEL`, `VERCEL_*`, `USE_OUTPUT_FOR_EDGE_FUNCTIONS`, `NOW_BUILDER`, `VC_MICROFRONTENDS_CONFIG_FILE_NAME`, `GITHUB_*`, `ACTIONS_ID_TOKEN_REQUEST_URL`, `DOCKER_*`, `BUILDKIT_*`, `COMPOSE_*`, and `*_TOKEN` from the default untracked environment variables passed to cached tasks. Tasks that need any of these variables should declare them explicitly in `cache.env` or `cache.untrackedEnv` ([#1044](https://github.com/voidzero-dev/vite-task/pull/1044)).
- **Changed** `VP_*` environment variables (including `VP_REMOTE_CACHE*` and `VP_RUN_*`) are no longer passed through to cached tasks by default; embedders can opt specific variables into default untracked passthrough via `SessionConfig::extra_untracked_env` ([#1043](https://github.com/voidzero-dev/vite-task/pull/1043)).
Expand Down
18 changes: 12 additions & 6 deletions crates/fspy/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,19 @@ pub enum SpawnError {
/// so the accesses collected for the run are a subset of what it really
/// touched.
///
/// The tracking channel can be full, or a process can continue untracked
/// because the seccomp filter could not be installed.
///
/// The run itself is unaffected: recording must never stop the program
/// doing the work. What cannot be done is anything that needs every
/// access, caching above all, which has to treat the run as untracked
/// rather than as having touched only the paths that fit.
#[derive(thiserror::Error, Clone, Copy, PartialEq, Eq, Debug)]
#[error("automatic file tracking could not record every file access")]
pub struct TrackingIncomplete;
#[derive(thiserror::Error, Clone, PartialEq, Eq, Debug)]
pub enum TrackingIncomplete {
/// The shared-memory tracking channel ran out of capacity (buffer space,
/// descriptor slots, or the single-record length limit).
#[error("the tracking channel ran out of capacity")]
ChannelCapacityExceeded,

/// A tracked process reported that it could not record an operation it
/// went on to perform.
#[error("a tracked process could not record an operation")]
Reported,
}
8 changes: 6 additions & 2 deletions crates/fspy/src/ipc.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use allocator_api2::alloc::Global;
use fspy_shared::ipc::{AccessReader, AccessReceiver, PathAccess};
use fspy_shared::ipc::{AccessCloseError, AccessReader, AccessReceiver, PathAccess};

use crate::error::TrackingIncomplete;

Expand Down Expand Up @@ -51,7 +51,11 @@ impl TryFrom<AccessReceiver<Global>> for ChannelAccesses {
/// something it went on to do. What did arrive is then a subset of
/// what the run really touched, so none of it is handed back.
fn try_from(receiver: AccessReceiver<Global>) -> Result<Self, TrackingIncomplete> {
Ok(Self { reader: receiver.close().map_err(|_| TrackingIncomplete)? })
match receiver.close() {
Ok(reader) => Ok(Self { reader }),
Err(AccessCloseError::Capacity) => Err(TrackingIncomplete::ChannelCapacityExceeded),
Err(AccessCloseError::Reported) => Err(TrackingIncomplete::Reported),
}
}
}

Expand Down
7 changes: 4 additions & 3 deletions crates/vt/src/session/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,10 @@ pub enum CacheNotUpdatedReason {
/// the seccomp filter could not be installed and an exec continued
/// untracked. The accesses that did arrive are a subset of what the
/// task touched, so caching from them would bake in inputs and outputs
/// that are not all of them.
#[cfg_attr(not(fspy), expect(dead_code, reason = "only fspy tracking can be incomplete"))]
TrackingIncomplete,
/// that are not all of them. Carries the underlying reason for
/// user-facing reporting.
#[cfg(fspy)]
TrackingIncomplete(fspy::TrackingIncomplete),
}

/// Outcome of the post-run cache update after a spawned process exited with
Expand Down
10 changes: 8 additions & 2 deletions crates/vt/src/session/execute/cache_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,14 @@ pub(super) async fn update_cache(
// arrived is a subset of what it touched, and an entry
// built from a subset would replay with inputs and outputs missing.
#[cfg(fspy)]
let Ok(path_accesses) = path_accesses.map(Result::as_ref).transpose() else {
return CacheUpdateOutcome::NotUpdated(CacheNotUpdatedReason::TrackingIncomplete);
let path_accesses = match path_accesses {
Some(Ok(accesses)) => Some(accesses),
Some(Err(reason)) => {
return CacheUpdateOutcome::NotUpdated(CacheNotUpdatedReason::TrackingIncomplete(
reason.clone(),
));
}
None => None,
};

// Every schema version's folder is in the task cache, not only this one.
Expand Down
32 changes: 20 additions & 12 deletions crates/vt/src/session/reporter/summary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ pub enum SavedCacheNotUpdatedReason {
IpcServerError(SavedError),
/// Automatic file tracking could not record everything the task did, so
/// the inferred inputs and outputs were a subset of what it touched.
TrackingIncomplete,
TrackingIncomplete(SavedError),
/// A runner-aware tool called `disableCache()`, skipping cache update.
ToolRequested,
}
Expand Down Expand Up @@ -334,7 +334,10 @@ impl SavedCacheNotUpdatedReason {
Self::IpcServerError(SavedError::new(err))
}
CacheNotUpdatedReason::ToolRequested => Self::ToolRequested,
CacheNotUpdatedReason::TrackingIncomplete => Self::TrackingIncomplete,
#[cfg(fspy)]
CacheNotUpdatedReason::TrackingIncomplete(reason) => {
Self::TrackingIncomplete(SavedError::new(reason))
}
}
}
}
Expand Down Expand Up @@ -579,12 +582,13 @@ impl TaskResult {
SavedCacheNotUpdatedReason::ToolRequested => {
(Str::from("β†’ Not cached: the task opted out of caching"), Vec::new(), &[])
}
SavedCacheNotUpdatedReason::TrackingIncomplete => (
Str::from(
"β†’ Not cached: automatic file tracking couldn't record everything this task did. Configure `input` and `output` manually to enable caching.",
SavedCacheNotUpdatedReason::TrackingIncomplete(error) => (
vt_str::format!(
"β†’ Not cached: automatic file tracking couldn't record everything this task did: {}. Configure `input` and `output` manually to enable caching.",
error.message,
),
Vec::new(),
&[],
&error.causes,
),
SavedCacheNotUpdatedReason::FspyUnsupported => (
Str::from(
Expand Down Expand Up @@ -1892,7 +1896,13 @@ mod tests {

let summary = full_summary(vec![
not_updated("opt-out", SavedCacheNotUpdatedReason::ToolRequested),
not_updated("incomplete", SavedCacheNotUpdatedReason::TrackingIncomplete),
not_updated(
"incomplete",
SavedCacheNotUpdatedReason::TrackingIncomplete(saved_error(
"the tracking channel ran out of capacity",
&[],
)),
),
not_updated("no-fspy", SavedCacheNotUpdatedReason::FspyUnsupported),
not_updated(
"ipc",
Expand All @@ -1917,11 +1927,9 @@ mod tests {
]);

assert!(summary.as_str().contains("β†’ Not cached: the task opted out of caching"));
assert!(
summary
.as_str()
.contains("β†’ Not cached: automatic file tracking couldn't record everything")
);
assert!(summary.as_str().contains(
"β†’ Not cached: automatic file tracking couldn't record everything this task did: the tracking channel ran out of capacity. Configure `input` and `output` manually to enable caching."
));
assert!(
summary
.as_str()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Performance: 0% cache hit rate
Task Details:
────────────────────────────────────────────────
[1] fspy-shm-capacity#stat: $ vtt stat-many 20000 βœ“
β†’ Not cached: automatic file tracking couldn't record everything this task did. Configure `input` and `output` manually to enable caching.
β†’ Not cached: automatic file tracking couldn't record everything this task did: the tracking channel ran out of capacity. Configure `input` and `output` manually to enable caching.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```

Expand All @@ -46,6 +46,6 @@ Performance: 0% cache hit rate
Task Details:
────────────────────────────────────────────────
[1] fspy-shm-capacity#stat: $ vtt stat-many 20000 βœ“
β†’ Not cached: automatic file tracking couldn't record everything this task did. Configure `input` and `output` manually to enable caching.
β†’ Not cached: automatic file tracking couldn't record everything this task did: the tracking channel ran out of capacity. Configure `input` and `output` manually to enable caching.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
Loading