fix: surface pgdata backup read-only blockers

This commit is contained in:
Codex
2026-05-20 20:03:43 +00:00
parent c6a27e6c2b
commit d766875a39
6 changed files with 173 additions and 4 deletions
+27
View File
@@ -1,4 +1,5 @@
import { scheduleRetryRunObservation, scheduleRunObservation, scheduleRunsScope } from "./src/schedules";
import { backendCoreUnavailableDiagnostic } from "./src/microservices";
type JsonRecord = Record<string, unknown>;
@@ -43,6 +44,31 @@ export function runScheduleCliContract(): JsonRecord {
assertCondition(retryObservation.newRunId === "schedrun_retry", "retry-run output must expose newRunId", retryObservation);
assertCondition(String(retryObservation.observeCommand).includes("schedule runs unidesk-pgdata-baidu-daily --limit 20"), "retry-run output must expose observeCommand", retryObservation);
const unavailable = backendCoreUnavailableDiagnostic({
exitCode: 1,
stdoutTail: "",
stderrTail: "Error response from daemon: No such container: unidesk-backend-core\n",
relatedContainers: [
{ name: "unidesk-backend-core.verify-20260520T153456Z", image: "unidesk-backend-core:latest", status: "Exited (255)" },
{ name: "unidesk-database.verify-20260520T153456Z", image: "postgres:16-alpine", status: "Exited (255)" },
],
envPath: "/tmp/docker-compose.env",
baiduSecretPresence: {
envPath: "/tmp/docker-compose.env",
exists: true,
keys: {
UNIDESK_BAIDU_NETDISK_CLIENT_ID: { present: true, nonEmpty: false },
UNIDESK_BAIDU_NETDISK_CLIENT_SECRET: { present: true, nonEmpty: false },
UNIDESK_BAIDU_NETDISK_TOKEN_KEY: { present: true, nonEmpty: false },
},
},
});
assertCondition(unavailable.ok === false, "backend-core unavailable diagnostic must be a failed result", unavailable);
assertCondition(unavailable.failureKind === "target-stack-not-running", "backend-core unavailable diagnostic must classify target stack absence", unavailable);
assertCondition((unavailable.targetStack as JsonRecord).verifyOnlyObserved === true, "backend-core unavailable diagnostic must expose verify-only evidence", unavailable);
assertCondition(Array.isArray(unavailable.authorizationRequiredForRecovery), "backend-core unavailable diagnostic must list authorization-gated recovery actions", unavailable);
assertCondition(Array.isArray(unavailable.readOnlyCommands), "backend-core unavailable diagnostic must list read-only observation commands", unavailable);
return {
ok: true,
checks: [
@@ -51,6 +77,7 @@ export function runScheduleCliContract(): JsonRecord {
"numeric positional guard",
"run wait timeout observation",
"retry-run observation",
"target stack unavailable diagnostic",
],
};
}