Fix flushDiagnostics not ensuring directories exist

This commit is contained in:
Michael B. Gale
2026-10-09 23:38:11 +01:00
parent f2412f892d
commit 520eff7a22
3 changed files with 25 additions and 7 deletions

13
lib/entry-points.js generated
View File

@@ -173070,6 +173070,7 @@ function flushDiagnostics(action, config) {
action.logger.debug(
`Moving ${diagnosticsCount} diagnostic(s) to their respective databases.`
);
const failedFlushDiagnostics = [];
for (const temporary of temporaryDiagnostics) {
const directory = getDatabaseDiagnosticsPath(
config,
@@ -173077,9 +173078,17 @@ function flushDiagnostics(action, config) {
);
const filename = import_path2.default.basename(temporary.path);
const destination = import_path2.default.join(directory, filename);
action.fs.renameSync(temporary.path, destination);
try {
action.fs.mkdirSync(directory, { recursive: true });
action.fs.renameSync(temporary.path, destination);
} catch (err) {
action.logger.warning(
`Failed to rename '${temporary.path}' to '${destination}': ${getErrorMessage(err)}`
);
failedFlushDiagnostics.push(temporary);
}
}
temporaryDiagnostics = [];
temporaryDiagnostics = failedFlushDiagnostics;
}
function makeTelemetryDiagnostic(id, name, attributes, tags) {
return makeDiagnostic(id, name, {