fix(labs): register the lab repair's undecryptable count as a job fact

The count rides out in the job's outcome facts, whose vocabulary is an
allowlist, and is kept as a failure tally so the catch that feeds it is
not a silent one.
This commit is contained in:
Marc-André Bombeck committed 2026-10-29 11:16:18 +01:00
1 parent 6b820fa3c5
commit 34f8a856b4
2 files changed
+11 -3

No files matched your search

+2
View File
@@ -317,6 +317,8 @@ export const JOB_FACT_ALLOWLIST: ReadonlySet<string> = new Set([
"total",
"trusted_devices_deleted",
"unchanged",
// The lab date repair: staged facts that would not decrypt, skipped.
"undecryptable",
"updated",
"users",
"users_clean_zero",
+9 -3
View File
@@ -160,14 +160,15 @@ export async function repairUndatedDocumentLabValues(
const touchedUsers = new Set<string>();
let updated = 0;
let unchanged = 0;
let undecryptable = 0;
// Reported as `undecryptable` in the outcome facts.
let decryptFailed = 0;
for (const row of rows) {
let data: ObservationFactData;
try {
data = decryptFactData(row.dataEncrypted) as ObservationFactData;
} catch {
undecryptable += 1;
decryptFailed += 1;
continue;
}
// A value with a date of its own is never touched, whatever its row says.
@@ -204,7 +205,12 @@ export async function repairUndatedDocumentLabValues(
}
for (const userId of touchedUsers) invalidateUserHealthScore(userId);
return { scanned: rows.length, updated, unchanged, undecryptable };
return {
scanned: rows.length,
updated,
unchanged,
undecryptable: decryptFailed,
};
}
/** The queue handler: one run over every account. */