voidzero-dev / voidzero-dev/vite-task

Define precise disableCache trigger points for uncacheable operations

Đang mở
#482 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Rust
Star
466
Fork
42
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
19

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Truy vết đường dẫn khởi động/lắng nghe của máy chủ HTTP Vite, đường dẫn khởi động watcher, các đường dẫn tạo/cấu hình máy chủ chung và vite_task_client::Client::disable_cache(). Xác minh rằng chế độ chạy cacheable của Vitest không thực hiện listening cũng như watching, trong khi các chế độ API/server và watch opt out tại ranh giới hoạt động của chúng. Sau khi đã bao quát ngữ nghĩa, hoàn tác workaround no-op từ PR #481 và khôi phục client request có hiệu lực.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript, rust
Lĩnh vực
build-system, tooling
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
52/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.