Make automation pause recoverable and fix log folder selection
CI / verify (push) Canceled after 0s

This commit is contained in:
Sucukdeluxe committed 2026-10-03 11:36:17 +02:00
1 parent 0cef0dd3a1
commit f2e400c89e
6 files changed
+140 -31

No files matched your search

+12 -3
View File
@@ -289,12 +289,14 @@
const candidates = asArray(value.candidates);
const historyRows = asArray(value.historyRows);
const uploadLogRows = asArray(value.uploadLogRows);
const exactPaths = new Set(asArray(value.queuePaths).map(normalizePath).filter(Boolean));
const queuePaths = new Set(asArray(value.queuePaths).map(normalizePath).filter(Boolean));
const exactPaths = new Set();
for (const row of historyRows) {
const exact = normalizePath(row?.path || row?.file);
if (exact) exactPaths.add(exact);
}
const evidenceNames = new Set();
const historyNames = new Set(historyRows.map(row => baseName(row?.fileName || row?.filename || row?.name || row?.path || row?.file)).filter(Boolean));
for (const row of [...historyRows, ...uploadLogRows]) {
const name = baseName(row?.fileName || row?.filename || row?.name || row?.path || row?.file);
if (name) evidenceNames.add(name);
@@ -307,14 +309,21 @@
const processedPaths = [];
const ambiguousPaths = [];
const unprocessedPaths = [];
const reasons = {};
for (const candidate of candidates) {
const exact = normalizePath(candidate?.path);
const name = baseName(candidate?.name || candidate?.path);
if ((exact && exactPaths.has(exact)) || (evidenceNames.has(name) && nameCounts.get(name) === 1)) processedPaths.push(candidate?.path);
if (exact && queuePaths.has(exact)) {
processedPaths.push(candidate?.path);
reasons[exact] = 'in-queue';
} else if ((exact && exactPaths.has(exact)) || (evidenceNames.has(name) && nameCounts.get(name) === 1)) {
processedPaths.push(candidate?.path);
reasons[exact] = exactPaths.has(exact) || historyNames.has(name) ? 'history' : 'upload-log';
}
else if (evidenceNames.has(name) && nameCounts.get(name) > 1) ambiguousPaths.push(candidate?.path);
else unprocessedPaths.push(candidate?.path);
}
return { processedPaths, ambiguousPaths, unprocessedPaths };
return { processedPaths, ambiguousPaths, unprocessedPaths, reasons };
}
return {
+9 -4
View File
@@ -349,21 +349,26 @@ class FolderMonitor extends EventEmitter {
const settings = this._settings;
try {
await this._access(settings.folderPath);
} catch {
} catch (error) {
if (!this._isCurrent(generation)) return this._cancelledResult(trigger);
return this._result([], false, false, trigger);
return this._result([], false, false, trigger, { errorCode: this._scanErrorCode(error) });
}
if (!this._isCurrent(generation)) return this._cancelledResult(trigger);
try {
const files = await this._discoverFiles(settings, generation);
if (!this._isCurrent(generation)) return this._cancelledResult(trigger);
return this._result(files, true, this._reachable === false, trigger);
} catch {
} catch (error) {
if (!this._isCurrent(generation)) return this._cancelledResult(trigger);
return this._result([], true, false, trigger, { error: 'Ordnerscan fehlgeschlagen' });
return this._result([], true, false, trigger, { error: 'Ordnerscan fehlgeschlagen', errorCode: this._scanErrorCode(error) });
}
}
_scanErrorCode(error) {
const code = String(error?.code || '');
return ['ENOENT', 'ENOTDIR', 'EACCES', 'EPERM', 'EBUSY', 'EIO', 'EMFILE', 'ENFILE'].includes(code) ? code : '';
}
async _discoverFiles(settings, generation) {
const discovered = await this._walkFolder(settings.folderPath, { recursive: !!settings.recursive });
if (!this._isCurrent(generation)) return [];