voidzero-dev / voidzero-dev/vite-task

Define precise disableCache trigger points for uncacheable operations

Offen
#482 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Rust
Sterne
466
Forks
42
Ø Merge
1 T. 15 Std.
Gemergte PRs (30 T.)
19

Beschreibung

Problem

disableCache() currently has an imprecise contract in practice. Tool integrations can call it while configuring a server because the configuration may later lead to an uncacheable operation. That is too early.

The observed failure mode is Vite/Vitest: a task can create a Vite server for transforms or test execution without actually listening on a port or watching the filesystem. If disableCache() fires during server/config setup, cacheable tasks such as vitest run are reported as Not cached: the task opted out of caching even though no uncacheable operation happened.

Principle

disableCache() should be called immediately before the concrete operation that makes the task uncacheable, not when reading configuration that might eventually lead to such an operation.

Concrete examples:

  • Listening on a port should disable caching immediately before the listen/bind operation.
  • Observing the filesystem should disable caching immediately before the watcher starts observing paths.
  • Creating/configuring an object that might later listen or watch should not disable caching by itself.

Temporary workaround

PR #481 makes vite_task_client::Client::disable_cache() a no-op so false opt-outs stop affecting downstream task caching while the real fix is designed and shipped.

Real solution

Move the Vite/Vitest integration points to operation boundaries:

  • In Vite, call disableCache() from the HTTP server start/listen path immediately before binding a port.
  • In Vite, call disableCache() from the watcher start path immediately before filesystem observation begins.
  • Do not call disableCache() from generic server creation/config resolution paths.
  • Verify Vitest run without watch/API does not listen or watch and therefore remains cacheable.
  • Verify Vitest API/server mode and watch mode still opt out because they perform uncacheable operations.

After those semantics are implemented and covered, revert the vite-task client no-op workaround and restore disableCache() as an effective client request.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Verfolge den Start-/Listen-Pfad des Vite-HTTP-Servers, den Start-Pfad des Watchers, die allgemeinen Pfade zur Servererstellung/-konfiguration sowie vite_task_client::Client::disable_cache(). Überprüfe, dass der cache-fähige Vitest-Ausführungsmodus weder Listening noch Watching durchführt, während API-/Server- und Watch-Modi an ihren Operationsgrenzen auf die Nutzung verzichten. Nachdem die Semantik abgedeckt ist, mache den No-op-Workaround aus PR #481 rückgängig und stelle die effektive Client-Anfrage wieder her.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, rust
Bereich
build-system, tooling
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
52/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.