feat: runner-aware tools#346
Draft
branchseer wants to merge 1 commit intofeat/output-restorationfrom
Draft
Conversation
4ba6a19 to
64f1651
Compare
Member
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
7 tasks
64f1651 to
f6605e3
Compare
0008bd7 to
994624a
Compare
cpojer
reviewed
Apr 20, 2026
| * @param {string} name | ||
| * @param {{ tracked?: boolean }} [options] | ||
| */ | ||
| export function fetchEnv(name, { tracked = true } = {}) { |
Member
There was a problem hiding this comment.
Since this is synchronous, and doesn't fetch anything, I recommend calling it getEnv instead.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
e18c21a to
09a310f
Compare
589a626 to
9df3054
Compare
09a310f to
87d8c32
Compare
9df3054 to
3a8b605
Compare
4edcd12 to
cfa4282
Compare
3a8b605 to
6198f6b
Compare
ae11247 to
24f5889
Compare
Squashed rebase of 51 commits from runner-aware-tools branch onto feat/output-restoration. Original commit history preserved on the ras-backup ref for reference. Key features bundled: - vite_task_ipc_shared: shared protocol (Request/GetEnvResponse, NativeStr) - vite_task_server: per-task IPC server (Handler trait + Recorder) - vite_task_client: sync Rust client - vite_task_client_napi + @voidzero-dev/vite-task-client: node addon + JS wrapper - vite_task: wire IPC server into spawn; inject VP_IPC + VP_RUN_NODE_CLIENT_PATH; bundle with fspy via Tracking struct; materialize .node addon on first use - consume runner-aware tool reports for cache decisions: * disableCache() short-circuits via ToolRequested * ignoreInput / ignoreOutput filter fspy reads/writes * tracked: true env / env-glob records folded into PostRunFingerprint - IPC server failure surfaces via IpcServerError; cache update is skipped - schema bumped to user_version = 13 (CacheEntryKey carries output_config, CacheEntryValue carries output_archive + tracked envs) Conflicts resolved against post-rebase main (#352 cfg(fspy) gating, #321 output archiving, input-negative reads-only filter): TrackingOutcome post-run summary preserved alongside Tracking pre-run handle; auto-input reads gated on input_config.includes_auto and filtered by input negatives + ignoreInput; auto-output writes filtered by negatives + ignoreOutput. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
24f5889 to
ffca388
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Set up a IPC channel between vite-task and the processes it spawns, so the spawned tools can declare at runtime what they actually read, wrote, or cared about, and then vite-task uses that to decide what to fingerprint in the cache.
Design notes:
docs/runner-task-ipc/.Problems this PR solves
Every example below is exercised by
patches/vite.patch, which wiresvite buildinto the IPC through@voidzero-dev/vite-task-client.1. Dynamic tracked envs
Before: the user had to declare every relevant env in
vite-task.json, statically:{ "tasks": { "build": { "env": ["NODE_ENV", "VITE_*"], "cache": true } } }This duplicates knowledge the tool already has. Forgetting
NODE_ENVsilently skips cache invalidation on mode change.envPrefix-matching envs (VITE_*by default) get inlined into the bundle throughimport.meta.env.*— so changingenvPrefix: 'MYAPP_'invite.config.jswithout updatingvite-task.jsondrifts: the runner still tracksVITE_*while the build output is driven byMYAPP_*.After: the tool declares its envs at runtime, driven by its own config.
The
buildtask invite-task.jsonneeds noenv:at all. ChangingenvPrefixinvite.config.jsdynamically changes the set of envs the runner tracks, with zero config edits on the runner side.2. Exclude tool's cache dir from input/output
Vite stores pre-bundled deps under
node_modules/.vite/and bundled configs undernode_modules/.vite-temp/. Every build reads the cache metadata (to check staleness) and writes fresh entries when it isn't stale. Without intervention the runner sees:There is a workaround already in vite-plus: voidzero-dev/vite-plus#1096 plus its follow-up #1198 hardcode
!node_modules/.vite-temp/**,!node_modules/.vite/**/results.json, and!dist/**as negative input globs on everyvpsubcommand (build,test,pack). That's not good enough:.vite/, moved temp dir, new subcommand with its own transient files), vp has to ship a matching glob update. It's a lockstep coupling that design-wise shouldn't exist..nuxt/, SvelteKit's.svelte-kit/, Next's.next/), needs its own hand-maintained list — vp can't ship it generically.After:
The declaration lives with the tool that owns the directory. The dep cache is vite's private concern.
3. Exclude output from input when a tool clears the folder before writing it
vite buildcallsemptyDir(outDir)before writingdist/.emptyDirhas to read the directory entries to know what to delete — those reads look identical to genuine input reads. Sincedist/is also where vite writes its final output, the runner sees a read-write overlap on the same paths and refuses to cache.After:
Only the writes count. The pattern generalizes: any tool that wipes-then-writes the same directory needs to tell the runner "my enumeration reads aren't inputs."
What's in this PR
vite_task_ipc_shared): message types + serialization shared by both ends.vite_task_server+vite_task_client): async server, sync blocking client, tested Rust-to-Rust.fspyfor dylib embedding. (Landed onmainvia refactor: extract materialized_artifact crate out of fspy #344 asmaterialized_artifact.)vite_task_client_napi+@voidzero-dev/vite-task-clientJS wrapper (fetchEnvsingle-name +fetchEnvsglob, with dedupe against already-setprocess.env).serve()'s returned iterator.Test plan
vite_task_server/tests/integration.rs)ignore_input,ignore_output,fetch_env,fetch_envs_glob,disable_cachevite buildviapatches/vite.patch(vite_build_cachefixture): NODE_ENV-change invalidation,envPrefix-driven tracked-env set change,dist/write restoration on cache hit