Merge pull request #3124 from gsd-build/fix/3050-update-backup-step-crashes-with-eacces-w

fix: make update custom-file backup resilient to EACCES
This commit is contained in:
Tom Boucher
2026-05-04 23:35:21 -04:00
committed by GitHub
3 changed files with 35 additions and 1 deletions

View File

@@ -0,0 +1,24 @@
'use strict';
const { test, describe } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
describe('bug #3050: update backup skips unreadable files non-fatally', () => {
test('update workflow backup loop wraps copyFileSync in try/catch and logs non-fatal skip', () => {
const content = fs.readFileSync(
path.join(__dirname, '..', 'get-shit-done', 'workflows', 'update.md'),
'utf8',
);
const hasTryCatch = /try\s*\{[\s\S]*copyFileSync\([\s\S]*\}[\s\S]*catch\s*\(err\)/.test(content);
assert.ok(hasTryCatch, 'backup copy loop must catch per-file copy errors');
const hasNonFatalSkipMessage = /Skipped \(non-fatal\):/.test(content);
assert.ok(
hasNonFatalSkipMessage,
'workflow must log a non-fatal skip message for unreadable custom files',
);
});
});