fix: use literal envPrefix queries for Vite Task#22706
Conversation
e47428a to
a99d301
Compare
Co-authored-by: GPT-5 Codex <codex@openai.com>
a99d301 to
cd22bde
Compare
| // the runner record each glob in the build's cache key. | ||
| // the runner record each prefix in the build's cache key. | ||
| for (const prefix of prefixes) { | ||
| Object.assign(env, getEnvs(`${prefix}*`)) |
There was a problem hiding this comment.
Instead of using prefix, should we escape * like FOO\*BAR* (prefix is FOO*BAR in this case)?
That would be more expressive and can support suffix or wildcard in the middle.
There was a problem hiding this comment.
I considered escaping on the Vite side, but that would require Vite to be aware of the full glob syntax supported by Vite Task (currently it's https://docs.rs/globset/0.4.18/globset/#syntax) and escape all the metacharacters correctly.
I think it's better to just let Vite express the intent here ("getting envs with this prefix"). Then Vite Task can handle the escaping internally alongside the glob implementation. That also leaves room for Vite Task to change the underlying matcher later, for example escaping to regex instead of glob, without breaking anything.
Problem
The Vite Task integration reports
envPrefixvalues togetEnvsas glob patterns like${prefix}*. That creates a corner case where anenvPrefixcontaining*is treated as a wildcard by the task client, while Vite itself treatsenvPrefixas a literal string prefix.Solution
Use the literal prefix query form from
@voidzero-dev/vite-task-client@0.2.0, added in voidzero-dev/vite-task#472, and callgetEnvs({ prefix })for each configuredenvPrefix.Compatibility
This can move to the
0.2.0client query form without released-compatibility fallout because no Vite Task release withvite-task-clientclient support has shipped yet. There is no released Vite Task version depending on the previous client query contract.