Skip to content

feat(vite_task): gate fspy behind cfg for non-supported OSes#352

Merged
branchseer merged 4 commits intomainfrom
vite-task-fspy-cfg
Apr 24, 2026
Merged

feat(vite_task): gate fspy behind cfg for non-supported OSes#352
branchseer merged 4 commits intomainfrom
vite-task-fspy-cfg

Conversation

@branchseer
Copy link
Copy Markdown
Member

@branchseer branchseer commented Apr 22, 2026

Motivation

vite_task was hard-wired to the fspy (file-access tracing) crate, which only builds on Windows, macOS, and Linux. That made the whole task-runner crate uncompilable on other targets (Android, FreeBSD, etc.) — a blocker for anyone embedding vite_task elsewhere, and for cross-compilation sanity checks. This PR lets vite_task compile on any target: fspy is present on the three supported OSes as before, and absent on others. On the latter, tasks still execute; only input auto-inference is unavailable, and the summary tells the user how to re-enable caching explicitly.

Summary

  • New cfg(fspy) set by vite_task's build.rs when target_os is windows/macos/linux, with a matching [target.'cfg(any(...))'.dependencies] block for the fspy dep (target cfgs and build-script cfgs must stay in sync — documented in build.rs).
  • On cfg(not(fspy)): spawn(cmd, fspy: true, ...) silently takes the tokio path; ChildOutcome.path_accesses and the whole tracked_accesses module are cfg-gated out.
  • spawn() now always builds tokio::process::Command directly; fspy::Command is only constructed inside spawn_fspy. fspy::Command::into_tokio_command became pub(crate).
  • New CacheNotUpdatedReason::FspyUnsupported surfaced in the summary as: → Not cached: \input` auto-inference isn't supported on this OS. Configure `input` manually to enable caching.` Cache lookups and post-run fingerprint validation of existing entries still work on unsupported OSes — only cache creation requiring auto-inferred inputs is refused.
  • PathRead moves from the fspy-gated tracked_accesses.rs to fingerprint.rs (usable on both builds).

Test plan

  • On-path: cargo test -p vite_task, cargo test -p vite_task_bin --test e2e_snapshots, cargo test -p vite_task_plan --test plan_snapshots
  • On-path cross-OS: just lint-linux, just lint-windows
  • Off-path: mise check-android (cross-compiles vite_task to aarch64-linux-android, clippy-checks with --all-targets --all-features -- -D warnings)
  • Off-path dep graph: cargo ndk -t arm64-v8a tree -p vite_task | grep fspy returns nothing
  • just lint, cargo fmt --check

🤖 Generated with Claude Code

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

branchseer and others added 2 commits April 23, 2026 00:05
Introduces a custom cfg(fspy) (set by vite_task's build.rs when target_os
is windows/macos/linux) and moves the fspy dep into a matching target block.
Tasks still run on any target (e.g. android, freebsd); auto-inferred caching
is refused with a new CacheNotUpdatedReason::FspyUnsupported that prints
"Configure `input` manually to enable caching." in the summary.

- spawn() always builds tokio::process::Command directly; fspy::Command
  is only constructed inside spawn_fspy (cfg(fspy) only)
- fspy::Command::into_tokio_command is now pub(crate)
- PathRead moves from tracked_accesses.rs (fspy-gated) to fingerprint.rs
- Off-path verification: `mise check-android` clippy-checks the full
  codebase against aarch64-linux-android

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Consolidates the two nix versions in the dep graph (0.30.1 and 0.31.1)
onto 0.31.2, matching the version already pulled in transitively by
dispatch2.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@socket-security
Copy link
Copy Markdown

socket-security Bot commented Apr 22, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedcargo/​nix@​0.31.1 ⏵ 0.31.2801009310070
Updatedcargo/​libc@​0.2.180 ⏵ 0.2.1858010093100100

View full report

branchseer added a commit that referenced this pull request Apr 24, 2026
## Motivation

The Security Analysis job (which runs `cargo deny check` whenever
`Cargo.lock` changes) fails on every PR that touches `Cargo.lock`
because `serde_yml v0.0.12` trips
[RUSTSEC-2025-0068](https://rustsec.org/advisories/RUSTSEC-2025-0068):
the crate is unsound (`Serializer.emitter` can segfault), the upstream
project has been archived, and the advisory explicitly states "No safe
upgrade is available". The only fix is to move off `serde_yml`. Example
failure: [run 24874266956 on
#352](https://github.com/voidzero-dev/vite-task/actions/runs/24874266956/job/72827299235?pr=352).

## Summary

- Replace `serde_yml = "0.0.12"` with `serde_norway = "0.9.42"` in the
workspace `Cargo.toml` and in `crates/vite_workspace/Cargo.toml`.
- Update `vite_workspace::load_package_graph` to call
`serde_norway::from_slice` for `pnpm-workspace.yaml`.
- Rename the error variant `Error::SerdeYml { serde_yml_error:
serde_yml::Error }` → `Error::SerdeYaml { serde_yaml_error:
serde_norway::Error }` so the type stays generic over the backing crate.
- Regenerate `Cargo.lock` (adds `serde_norway`, `unsafe-libyaml-norway`;
drops `serde_yml`, `libyaml-safer`, and their exclusive transitive
deps).

## Why `serde_norway` over the other forks

`serde_yml`'s RUSTSEC advisory lists four alternatives; both maintained
`serde_yaml` forks (`serde_norway` and `serde_yaml_ng`) are drop-in
compatible. `serde_norway` is more actively maintained (last release Dec
2024 vs May 2024), dual-licensed MIT/Apache-2.0, and ships its own
`unsafe-libyaml-norway` fork of the C bindings so future advisories
against libyaml can be patched without waiting on upstream.

## Test plan

- [x] `cargo deny check --config <oxc security-action deny.toml>` →
`advisories ok, bans ok, licenses ok, sources ok` (was `unsound:
RUSTSEC-2025-0068` before)
- [x] `cargo test -p vite_workspace` → 79 passed
- [x] `cargo clippy -p vite_workspace --all-targets -- -D warnings` →
clean

---------

Co-authored-by: Claude <noreply@anthropic.com>
@branchseer branchseer merged commit d1b8cda into main Apr 24, 2026
13 checks passed
Copy link
Copy Markdown
Member Author

Merge activity

@branchseer branchseer deleted the vite-task-fspy-cfg branch April 24, 2026 06:39
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.

1 participant