voidzero-dev / voidzero-dev/vite-task
A `tracked` env query is validated against the unfiltered parent environment (broad queries are CI-hostile)
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Rust
- Sterne
- 466
- Forks
- 42
- Ø Merge
- 1 T. 15 Std.
- Gemergte PRs (30 T.)
- 19
Beschreibung
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-plus0.2.2,@voidzero-dev/vite-task-client0.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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Führe die verknüpfte Reproduktion mit pnpm install und ./repro.sh aus und verfolge dann getEnvs({ prefix: "" }, { tracked }) durch @voidzero-dev/vite-task-client und den Einstiegspunkt vp build. Vergleiche das Verhalten für getrackte und nicht getrackte Variablen, wenn sich eine nicht verwandte Umgebungsvariable ändert; als erledigt gilt die Aufgabe, wenn das beabsichtigte Verhalten der Abfrage getrackter Variablen bestätigt ist und die Reproduktion den beschriebenen CI-unfreundlichen Fehler nicht mehr meldet.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- github-actions, rust
- Bereich
- build-system, ci-cd
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Aktiv
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100