fix(install): arm rollback before legacy sync

This commit is contained in:
haelyra
2026-08-13 18:30:39 -04:00
parent 42d219e0de
commit 0a7d2787c4
4 changed files with 30 additions and 4 deletions
+12 -1
View File
@@ -419,7 +419,18 @@ function runLifecycle(options) {
],
};
} finally {
fs.rmSync(tempRoot, { recursive: true, force: true });
try {
fs.rmSync(tempRoot, {
recursive: true,
force: true,
maxRetries: 10,
retryDelay: 100,
});
} catch (cleanupError) {
process.stderr.write(
`Could not remove lifecycle temp root ${tempRoot}: ${cleanupError.message}\n`
);
}
}
}
@@ -125,6 +125,16 @@ test('public CLI invocations use npm exec instead of internal package paths', ()
assert.ok(!unixInvocation.args.some(argument => argument.includes('node_modules')));
});
test('lifecycle cleanup retries Windows file locks without masking results', () => {
const source = fs.readFileSync(
path.join(__dirname, 'packed-artifact-lifecycle.js'),
'utf8'
);
assert.match(source, /maxRetries:\s*10/);
assert.match(source, /retryDelay:\s*100/);
assert.match(source, /Could not remove lifecycle temp root/);
});
console.log(`\nPassed: ${passed}`);
console.log(`Failed: ${failed}`);
process.exit(failed > 0 ? 1 : 0);
+5
View File
@@ -119,6 +119,11 @@ function runTests() {
assert.match(source, /^set -Eeuo pipefail$/m);
assert.ok(source.includes("trap 'rollback_legacy_sync $?' ERR"));
assert.ok(source.includes('node "$LEGACY_STATE_HELPER" rollback --state "$LEGACY_STATE_PATH"'));
assert.ok(
source.indexOf("trap 'rollback_legacy_sync $?' ERR")
< source.indexOf('record_managed_path "$CONFIG_FILE"'),
'rollback trap must be active before the first ownership record'
);
})) passed++; else failed++;
console.log(`\nResults: Passed: ${passed}, Failed: ${failed}`);