fix: make pgss max advisory informational

This commit is contained in:
Andrey Avtomonov 2026-05-11 19:27:57 +02:00
parent 98a475d6c5
commit 77baa1f20a
3 changed files with 52 additions and 11 deletions

View file

@ -16,6 +16,7 @@ export interface PostgresHistoricSqlDoctorProbeInput {
export interface PostgresHistoricSqlDoctorProbeResult {
pgServerVersion: string;
warnings: string[];
info?: string[];
}
export type PostgresHistoricSqlDoctorProbe = (
@ -72,6 +73,13 @@ function failureDetail(error: unknown): string {
return String(error);
}
function readinessDetail(result: PostgresHistoricSqlDoctorProbeResult): string {
const warningText = result.warnings.length > 0 ? ` with warnings: ${result.warnings.join('; ')}` : '';
const info = result.info ?? [];
const infoText = info.length > 0 ? `; info: ${info.join('; ')}` : '';
return `pg_stat_statements ready (${result.pgServerVersion})${warningText}${infoText}`;
}
async function defaultPostgresHistoricSqlProbe(
input: PostgresHistoricSqlDoctorProbeInput,
): Promise<PostgresHistoricSqlDoctorProbeResult> {
@ -134,14 +142,12 @@ export async function runPostgresHistoricSqlDoctorChecks(
'warn',
checkId(connectionId),
label,
`pg_stat_statements ready (${result.pgServerVersion}) with warnings: ${result.warnings.join('; ')}`,
readinessDetail(result),
`Update the Postgres parameter group or config, then rerun \`ktx dev doctor --project-dir ${project.projectDir}\``,
),
);
} else {
checks.push(
check('pass', checkId(connectionId), label, `pg_stat_statements ready (${result.pgServerVersion})`),
);
checks.push(check('pass', checkId(connectionId), label, readinessDetail(result)));
}
} catch (error) {
checks.push(