Skip to content

The agent that grows with you

fix(desktop): batch-sign must skip the shipped uv-cache tree

ethernet7707d9c32cfe
diff --git a/apps/desktop/scripts/batch-sign-binaries.mjs b/apps/desktop/scripts/batch-sign-binaries.mjs
index 789af4df9f2..a57994ec61e 100644
--- a/apps/desktop/scripts/batch-sign-binaries.mjs
+++ b/apps/desktop/scripts/batch-sign-binaries.mjs
@@ -460,8 +460,15 @@ export async function batchSignAppTree(appOutDir, productExePath, opts = {}) {
return { signed: 0, chunks: 0, skipped: true }
}
const productExe = productExePath ? path.resolve(productExePath) : null
+ // uv-cache/ is the pm bundle's deliberately-shipped build cache (inert
+ // sdist/archive artifacts, never loaded at runtime — the arch audit
+ // exempts it for the same reason). Signing it wastes Azure round-trips
+ // on dead weight and can FAIL: locally the cache may hold files that
+ // were removed between pm bundle staging and the afterPack walk.
+ const inCache = (file) => /(^|[\\/])uv-cache[\\/]/.test(path.resolve(file))
const binaries = getBinaries(appOutDir, {
- skip: (file) => (productExe ? path.resolve(file) === productExe : false)
+ skip: (file) =>
+ inCache(file) || (productExe ? path.resolve(file) === productExe : false)
})
if (binaries.length === 0) return { signed: 0, chunks: 0, skipped: false }
const result = await batchSignBinaries(binaries, opts)
diff --git a/apps/desktop/scripts/batch-sign-binaries.test.mjs b/apps/desktop/scripts/batch-sign-binaries.test.mjs
index 8cf539fbe2f..4166c0cbf2f 100644
--- a/apps/desktop/scripts/batch-sign-binaries.test.mjs
+++ b/apps/desktop/scripts/batch-sign-binaries.test.mjs
@@ -172,6 +172,11 @@ test('batchSignAppTree is a no-op (skipped=true) without the Azure env, and sign
fs.writeFileSync(exe, 'x')
fs.writeFileSync(path.join(root, 'tools', 'node.exe'), 'x')
fs.writeFileSync(path.join(root, 'tools', 'ffmpeg.dll'), 'x')
+ // The shipped uv-cache holds inert sdist/archive artifacts — the arch
+ // audit exempts it and batch-sign must never sign it (wasted Azure
+ // round-trips; locally it can even reference files since removed).
+ fs.mkdirSync(path.join(root, 'uv-cache', 'archive-v0', 'setuptools'), { recursive: true })
+ fs.writeFileSync(path.join(root, 'uv-cache', 'archive-v0', 'setuptools', 'cli.exe'), 'x')
// Unsigned lane: loud no-op, nothing invoked.
const skipped = await batchSignAppTree(root, exe, { env: {} })