Fresh-connection probe (never pooled) that times connect/query/total for a Neon-style scale-to-zero compute, with --repeat/--every-seconds to catch the real cold-vs-warm gap and a --json summary (min/p50/p95/max). Verified for real against a local Postgres 16 container: happy path, --repeat/--every-seconds, --json, and all three failure paths (wrong port, wrong password, missing connection string) — see test-fixtures/local-postgres-verification.md for the full transcript, including an honest note on two false "cold" readings that transcript caught (local network/load jitter, not a real suspend/resume). No real Neon account was available in this environment (no credentials, and the Neon MCP needs an interactive browser OAuth this session can't complete) so the real Neon suspend/resume cycle itself is not verified live — logged honestly in the README's "Honest limits" section rather than claimed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3.3 KiB
Verification run (real, not mocked)
Date: 2026-11-17. Environment: this build/test had no Neon account
credentials available (no NEON_* in ~/products/.env; the Neon MCP
server requires an interactive OAuth sign-in this environment can't
complete). Everything below ran against a real local Postgres 16
container instead, to prove the connect/query/timing/retry/classification
code is correct — it does not reproduce a real Neon suspend/resume
cycle (a local container never suspends).
docker run -d --name ncsp-test-pg -e POSTGRES_PASSWORD=test -p 15499:5432 postgres:16
Single probe:
$ node bin/neon-cold-start-probe.mjs "postgres://postgres:test@127.0.0.1:15499/postgres"
probe 1/1: connect=73ms query=3ms total=77ms [warm]
4 probes, 2s apart:
$ node bin/neon-cold-start-probe.mjs --url "postgres://postgres:test@127.0.0.1:15499/postgres" --repeat 4 --every-seconds 2
probe 1/4: connect=42ms query=4ms total=46ms [warm]
probe 2/4: connect=18ms query=3ms total=21ms [warm]
probe 3/4: connect=16ms query=2ms total=18ms [warm]
probe 4/4: connect=793ms query=27ms total=819ms [COLD]
summary: min=18ms p50=21ms p95=819ms max=819ms (1/4 probes >= 500ms, 0 failed)
That one 819ms reading against a local container that never suspends is
real and reproducible on this machine (Docker Desktop on macOS proxies
container ports through a VM; under any concurrent load — this run had a
fresh postgres:16 image pulling moments earlier — a single connection
can spike well past the 500ms default threshold with nothing to do with
a cold start). This is the actual reason the README tells people to take
more than one sample before concluding a connection felt slow because of
a suspended compute specifically. The --json run below shows the same
thing at a larger scale (a 1664ms and a 434ms reading, both against the
same idle local container, both false "cold" by the classifier):
$ node bin/neon-cold-start-probe.mjs "postgres://postgres:test@127.0.0.1:15499/postgres" --repeat 2 --json
{
"results": [
{ "ok": true, "error": null, "connectMs": 1474.68875, "queryMs": 190.176875, "totalMs": 1664.865625 },
{ "ok": true, "error": null, "connectMs": 406.783542, "queryMs": 27.964, "totalMs": 434.747542 }
],
"summary": { "probes": 2, "failed": 0, "minMs": 434.747542, "p50Ms": 434.747542, "p95Ms": 1664.865625, "maxMs": 1664.865625, "coldThresholdMs": 500, "coldCount": 1 }
}
Failure paths, also real:
$ node bin/neon-cold-start-probe.mjs "postgres://postgres:test@127.0.0.1:19999/postgres" --timeout 2
probe 1/1: FAILED (connect ECONNREFUSED 127.0.0.1:19999)
# exit code 1
$ node bin/neon-cold-start-probe.mjs "postgres://postgres:wrongpass@127.0.0.1:15499/postgres"
probe 1/1: FAILED (password authentication failed for user "postgres")
# exit code 1
$ node bin/neon-cold-start-probe.mjs
error: a connection string is required (positional arg, --url, or DATABASE_URL). Run with --help.
# exit code 1
$ DATABASE_URL="postgres://postgres:test@127.0.0.1:15499/postgres" node bin/neon-cold-start-probe.mjs
probe 1/1: connect=122ms query=24ms total=146ms [warm]
# exit code 0
Not verified live: a real Neon (or other serverless-Postgres) project actually suspending and this tool catching the real wake-up latency on the next probe. Logged honestly rather than faked — see the README's "Honest limits" section.