Skip to content
GitHubBlueskydev.toRSS
Blog

When an input moves mid-run, vx keeps the result and skips the save

Save a file while a build runs and vx keeps the result but caches nothing, so a later hit never brings back output built from the wrong source.

Save a file while a build runs, and vx keeps the result but caches nothing. A later hit can never bring back output built from the wrong source.

Terminal window
$ (sleep 0.5; echo "// saved mid-build" >> packages/a/src/index.ts) &
$ vx run packages/a#slow
┌─ packages/a#slow > $ sleep 1 && mkdir -p gen && cp src/index.ts gen/copy.ts
[vx] packages/a#slow: `packages/a/src/index.ts` changed after its key was taken — the result stands, but is not saved under a key that no longer describes it; if the task generates it, declare it in outputs; if it rewrites it in place, set inputs.stability: { strategy: 'mutable' }
└─ packages/a#slow ── (1.01s) success
tasks 1 success · 1 total
cache 1 not saved
$ vx run packages/a#slow
└─ packages/a#slow ── (1.01s) success
cache local 1↑

Demo workspace · vx 69617eb · 2026-10-23

The run is green and the output stays. The next run builds again.

The key named the old bytes, and the output came from new ones. Saved under that key, a later hit would bring back the wrong output. The check costs one lstat per input, only on a miss that saves.

You save an edit mid-build, then undo it. The bytes match again, but the output was built from the edit. So any write after the key counts, whatever it holds.

The check is the same on CI, where another task can do the same thing.

tsdown rewrites package.json with the same bytes every build. Tell vx to compare bytes for that task:

build: {
exec: { command: 'tsdown' },
inputs: { files: ['src/**', 'package.json'], stability: { strategy: 'mutable' } },
outputs: { files: ['dist/**'] },
cache: true,
},
Setting Does
strategy: 'mutable' compares bytes, not write times
strategy: 'unchecked' no check
severity: 'error' fails the task instead of warning

The env vars VX_INPUTS_STABILITY_STRATEGY and VX_INPUTS_STABILITY_SEVERITY set the default.

A failed task’s line names the file, and vx last --failed --format json reports inputMoved. If the file is generated, declare it as an output.

Every task that ran over those outputs saves nothing either. You pay one rebuild, and every saved entry means what its inputs say. Details: Caching.

More at vznjs.github.io/vx.

Turborepo, Nx and other product names are trademarks of their owners. vx is not affiliated with or endorsed by them.