voidzero-dev / voidzero-dev/vite-task

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

Aperta
#505 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Rust
Stelle
466
Fork
42
Merge medio
1g 15h
PR unite (30g)
19

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Esegui la riproduzione collegata con pnpm install e ./repro.sh, quindi segui getEnvs({ prefix: "" }, { tracked }) attraverso @voidzero-dev/vite-task-client e l’entry point vp build. Confronta il comportamento delle variabili tracciate e non tracciate quando cambia una variabile ambientale non correlata; il lavoro è completato quando il comportamento previsto della query delle variabili tracciate è stabilito e la riproduzione non segnala più il problema descritto, incompatibile con la CI.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
github-actions, rust
Ambito
build-system, ci-cd
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Attiva
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.