voidzero-dev / voidzero-dev/vite-task

A `tracked` env query is validated against the unfiltered parent environment (broad queries are CI-hostile)

Open
#505 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
466
Forks
42
Avg merge
1d 15h
Merged PRs (30d)
19

Description

Summary

A tracked env query is validated against the full unfiltered parent process environment. A broad query (empty prefix, matching every variable) therefore cache-misses whenever any ambient variable changes, even one the build never reads. In CI, per-run variables (e.g. ACTIONS_ORCHESTRATION_ID) change every run, so such a build never cache-hits.

Reproduction

https://github.com/why-reproductions-are-required/vite-task-tracked-env-query-unfiltered-parent-env

pnpm install
./repro.sh

Two tasks call getEnvs({ prefix: "" }, { tracked }) via @voidzero-dev/vite-task-client and read no variable in particular. Run 3 sets one unrelated ambient variable before running.

task tracked run 3 (one unrelated ambient var set)
untracked-bulk-env false HIT (control)
tracked-bulk-env true MISS: TrackedEnvQueryChanged { Prefix "", Added ... }

Where this bites a real build

vp build loads env via Vite's loader, which issues getEnvs({ prefix }, { tracked: true }) for each configured envPrefix (@voidzero-dev/vite-plus-core, chunks/node.js). In a Vite + void app one of those queries is empty-prefix (Prefix "", all variables), so on GitHub Actions vp run build misses every run:

$ vp build ○ cache miss: env 'ACTIONS_ORCHESTRATION_ID' changed, executing

Note env: [] on the task does not help (that controls value-fingerprinting, not the bulk query). The only workaround found is to run the build under a sanitized environment, e.g. env -i PATH="$PATH" HOME="$HOME" vp run build.

Question for maintainers

Is validating a tracked query against the unfiltered parent env intended? A broad tracked query is unavoidably CI-hostile this way. Options might include validating against the filtered env the task received, an ignore-list for ambient/volatile variables, or scoping/untracking broad reads on the consumer side (Vite env loader / void). Filing here to confirm where the fix belongs.

Environment

  • vite-plus 0.2.2, @voidzero-dev/vite-task-client 0.2.0
  • Reproduced on macOS (darwin 25.x) and GitHub Actions ubuntu-latest

Found alongside #504 while enabling the GitHub Actions cache for a real Vite + void app.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run the linked reproduction with pnpm install and ./repro.sh, then trace getEnvs({ prefix: "" }, { tracked }) through @voidzero-dev/vite-task-client and the vp build entry point. Compare tracked and untracked behavior when an unrelated ambient variable changes; done means the intended tracked-query behavior is established and the reproduction no longer reports the described CI-hostile miss.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, rust
Domain
build-system, ci-cd
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.