fix(proxies): preserve inactive and dead statuses during pool validation (#13612)

Pool validation no longer rewrites `inactive` or `dead` proxies to `active`: `validateProxyPool` only ever touched rows that were already live. Covered by 8 status × probe combinations plus case and null variants.

Validated first on the combined board of all 38 PRs of this batch (10 merged as-is, 28 after the maintainer rework) on top of release/v3.8.51 c0f92ec: typecheck:core, check:open-sse-typecheck and check:dashboard-typecheck clean; ESLint clean on every changed file; file-size (rebaselined for the combined growth), complexity, cognitive-complexity, changelog-integrity, docs-counts, docs-sync, migration-numbering and i18n new-key gates green; 735 focused node:test cases with the only batch-caused failure (a flag-count assertion) fixed. Then re-validated alone on the fresh release tip right before this merge: ESLint on the changed files, typecheck:core, check:open-sse-typecheck, the file-size/complexity/changelog gates and this PR's own tests.

Thanks @maxmad64bis!
This commit is contained in:
Dizzle
2026-09-15 15:11:44 +02:00
committed by GitHub
parent 1d03ba0ed2
commit ee3fbaf3f6
3 changed files with 221 additions and 1 deletions

View File

@@ -363,7 +363,8 @@ export interface ProxyValidationResult {
egressIp: string | null;
latencyMs: number;
previousStatus: string | null;
newStatus: "active" | "error";
newStatus: string;
preserved: boolean;
}
/**
@@ -428,6 +429,25 @@ export async function validateProxyPool(deps?: {
});
const probe = await resolveEgressIp(url, { force: true });
const alive = !!probe.ip && !probe.error;
// Operator/health statuses stay untouched by validation: the probe still
// ran above, so the report keeps its alive/egressIp signal. The two-value
// literal mirrors PROXY_ALIVE_PREDICATE in db/proxies/guards.ts; revisit if
// the status registry is ever derived from a single shared source (part 2).
const previous = (p.status ?? "").toLowerCase();
if (previous === "inactive" || previous === "dead") {
report.push({
proxyId: p.id,
host: p.host,
port: p.port,
alive,
egressIp: probe.ip,
latencyMs: probe.latencyMs,
previousStatus: p.status ?? null,
newStatus: p.status as string,
preserved: true,
});
continue;
}
const newStatus: "active" | "error" = alive ? "active" : "error";
await markStatus(p.id, newStatus, { latencyMs: probe.latencyMs, egressIp: probe.ip });
report.push({
@@ -439,6 +459,7 @@ export async function validateProxyPool(deps?: {
latencyMs: probe.latencyMs,
previousStatus: p.status ?? null,
newStatus,
preserved: false,
});
}