Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

fix(cache): miss when a file the task reads and reports with ignoreOutput is deleted - #1025

Open
hyfdev wants to merge 1 commit into
mainfrom
fix/ignore-output-read-input
Open

hyfdev wants to merge 1 commit into
mainfrom
fix/ignore-output-read-input

Conversation

@hyfdev

@hyfdev hyfdev commented Nov 26, 2026

Copy link
Copy Markdown

A task that reads a file, writes it back, and reports it with ignoreOutput still hits the cache after the file is deleted.

The hit replays outputs computed from the deleted content.

With this change that file must be present, so deleting it misses and the task runs again.

// task.mjs, run as the package script "task": "node task.mjs"
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
import { ignoreOutput } from '@voidzero-dev/vite-task-client';

const state = existsSync('state.json')
  ? JSON.parse(readFileSync('state.json', 'utf8'))
  : { value: 'missing' };
ignoreOutput('state.json');
writeFileSync('state.json', JSON.stringify(state));
writeFileSync('result.json', JSON.stringify({ read: state.value }));

With state.json holding {"value":"original"}, run vp run --cache task, delete state.json, and run it again.

Before, the second run hits and result.json keeps {"read":"original"}:

$ node task.mjs ◉ cache hit, replaying

After, it misses and writes {"read":"missing"}:

$ node task.mjs ○ cache miss: 'state.json' removed from workspace root, executing

Changes

The files a hit may find missing were taken from every write, before ignoreOutput was applied.

A write now stays out of that set when ignoreOutput covers it and the task's read of it is still tracked.

Paths also reported with ignoreInput, such as Vite's dep optimizer cache, and files the task only writes behave as before.

A tool that reads its own cache file and reports it only with ignoreOutput now misses on a clean checkout instead of hitting.

The cache schema moves to v25, because v24 entries mark a file the task reads and reports with ignoreOutput as allowed to be missing, and would keep hitting after the upgrade.

Fixes #1023.

@hyfdev
hyfdev force-pushed the fix/ignore-output-read-input branch from 837da53 to 16e3fa7 Compare November 26, 2026 13:21
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

fspy benchmark

linux

dynamic/launch             change  -0.20%  [ -3.66% ..  +3.24%]  overhead   +59.52%
dynamic/access             change  +0.84%  [ -4.11% ..  +4.92%]  overhead   +21.47%
dynamic/access-relative    change  -0.28%  [ -3.59% ..  +4.05%]  overhead   +71.36%
dynamic/access-contended   change  +1.75%  [-10.92% .. +11.94%]  overhead    +4.99%
static/launch              change  +0.78%  [ -4.14% ..  +4.82%]  overhead  +202.79%
static/access              change  +0.17%  [ -1.86% ..  +1.30%]  overhead +1462.40%
static/access-relative     change  +0.81%  [ -1.28% ..  +4.54%]  overhead +1963.99%
static/access-contended    change  +0.34%  [ -1.15% ..  +1.70%]  overhead +1536.41%

macos

dynamic/launch             change  -0.37%  [ -3.24% ..  +3.10%]  overhead  +222.29%
dynamic/access             change  +0.37%  [ -2.28% ..  +2.81%]  overhead    +9.31%
dynamic/access-relative    change  -0.73%  [ -4.30% ..  +2.36%]  overhead  +253.12%
dynamic/access-contended   change  -0.48%  [ -2.92% ..  +1.99%]  overhead    +2.57%

windows

dynamic/launch             change  +0.11%  [ -2.74% ..  +3.68%]  overhead   +27.14%
dynamic/access             change  +0.00%  [ -8.19% ..  +3.21%]  overhead    +1.24%
dynamic/access-relative    change  -0.18%  [ -1.58% ..  +1.97%]  overhead    +1.31%
dynamic/access-contended   change  +0.20%  [ -0.84% ..  +1.27%]  overhead    +1.64%

@hyfdev
hyfdev force-pushed the fix/ignore-output-read-input branch from 16e3fa7 to 4cef857 Compare November 26, 2026 15:52
@hyfdev
hyfdev marked this pull request as ready for review November 26, 2026 15:56
Copilot AI balanced review requested due to automatic review settings November 26, 2026 15:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@hyfdev
hyfdev force-pushed the fix/ignore-output-read-input branch from 4cef857 to a0fa5cd Compare December 3, 2026 06:28
@hyfdev
hyfdev requested a review from wan9chi December 3, 2026 06:34
A path reported through ignoreOutput remains a required input when the task reads and writes it and the read survives input filtering. Cache schema v25 starts a fresh cache because v24 entries can replay stale outputs when one of these inputs is missing.

Co-authored-by: GPT-6.2 Sol <noreply@openai.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@hyfdev
hyfdev force-pushed the fix/ignore-output-read-input branch from a0fa5cd to 718435a Compare December 3, 2026 07:05

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ignoreOutput on a file a task reads and writes lets a hit replay outputs no run can produce

2 participants