{"record":{"id":"86dcf18cc6262075","repo":"block/buzz","slug":"connect-admin-86dcf1","errorCode":null,"errorMessage":"connect admin","messagePattern":"connect admin","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/buzz-db/src/store/channel_members.rs","lineNumber":3023,"sourceCode":"            \"failed startup gate must not publish a roster\"\n        );\n\n        migration::run_migrations(&pool)\n            .await\n            .expect(\"apply migration 0032\");\n        db.verify_channel_roster_fence()\n            .await\n            .expect(\"0032 must open the startup gate\");\n\n        drop_scratch_db(&admin, pool, &scratch_name).await;\n    }\n\n    #[tokio::test]\n    #[ignore = \"requires Postgres\"]\n    async fn channel_roster_fence_behavior_verification_detects_inert_function() {\n        let admin = PgPool::connect(&admin_url().await)\n            .await\n            .expect(\"connect admin\");\n        let (pool, scratch_name) = create_scratch_db(&admin, \"roster_fence_inert\").await;\n        let db = Db::from_pool(pool.clone());\n\n        sqlx::raw_sql(\n            \"CREATE OR REPLACE FUNCTION guard_channel_roster_snapshot() \\\n             RETURNS TRIGGER AS $$ BEGIN RETURN NEW; END; $$ LANGUAGE plpgsql;\",\n        )\n        .execute(&pool)\n        .await\n        .expect(\"replace roster fence with inert body\");\n        let error = db\n            .verify_channel_roster_fence()\n            .await\n            .expect_err(\"inert roster fence must fail closed\");\n        assert!(\n            error\n                .to_string()\n                .contains(\"stale probe roster was accepted\"),","sourceCodeStart":3005,"sourceCodeEnd":3041,"githubUrl":"https://github.com/block/buzz/blob/dad5a33865fc81a2e55b3b60746632f615ec1e3a/crates/buzz-db/src/store/channel_members.rs#L3005-L3041","documentation":"Panic from `.expect(\"connect admin\")` on `PgPool::connect(&admin_url().await)` in the ignored Postgres-gated test `channel_roster_fence_behavior_verification_detects_inert_function`. The admin connection is required to create a scratch database; Err means Postgres refused or timed out.","triggerScenarios":"admin_url() points to a non-listening host/port, wrong credentials, TLS mismatch, or Postgres max_connections exhausted when running the test.","commonSituations":"Tests run without the required Postgres (`#[ignore = \"requires Postgres\"]` bypassed via --ignored), DATABASE_URL unset or wrong, Docker Postgres not started, pg_hba rejecting the user.","solutions":["Start the required Postgres (just test prerequisites / docker compose) before running ignored tests","Verify the admin connection string (host, port, user, password, sslmode) returned by admin_url()","Test connectivity with psql using the same URL","Check pg_hba.conf and max_connections if auth or limit errors appear"],"exampleFix":"// before\nlet admin = PgPool::connect(&admin_url().await).await.expect(\"connect admin\");\n// after\nlet admin = PgPool::connect(&admin_url().await).await\n    .unwrap_or_else(|e| panic!(\"connect admin: {e} — is Postgres running?\"));","handlingStrategy":"validation","validationCode":"// probe the admin URL before PgPool::connect\nlet url = admin_url().await;\nassert!(url.starts_with(\"postgres://\"));\n// or: tokio::net::TcpStream::connect((host, port)).await.expect(\"postgres reachable\");","typeGuard":null,"tryCatchPattern":"let admin = PgPool::connect(&url).await\n    .map_err(|e| anyhow!(\"connect admin ({url}): {e}\"))?;","preventionTips":["Always start the test Postgres before running #[ignore] tests","Keep admin_url() sourced from one env var and validate it at startup","Smoke-test connectivity with psql in CI setup steps"],"tags":["postgres","connection","test-infrastructure","panic"],"backgroundTag":"database-connection-refused","analyzedSha":"dad5a33865fc81a2e55b3b60746632f615ec1e3a","analyzedAt":"2026-08-30T13:49:18.474Z","contentChangedAt":"2026-08-30T13:49:18.474Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}