{"record":{"id":"f0fdf099b3c19e78","repo":"block/buzz","slug":"load-event-partition","errorCode":null,"errorMessage":"load event partition","messagePattern":"load event partition","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/buzz-db/src/store/channel_members.rs","lineNumber":3069,"sourceCode":"        let admin = PgPool::connect(&admin_url().await)\n            .await\n            .expect(\"connect admin\");\n        let (pool, scratch_name) = create_scratch_db(&admin, \"roster_fence_catalog\").await;\n        let db = Db::from_pool(pool.clone());\n\n        db.verify_channel_roster_fence()\n            .await\n            .expect(\"migrated roster fence must verify\");\n\n        let child: String = sqlx::query_scalar(\n            \"SELECT n.nspname || '.' || c.relname \\\n             FROM pg_inherits i JOIN pg_class c ON c.oid = i.inhrelid \\\n             JOIN pg_namespace n ON n.oid = c.relnamespace \\\n             WHERE i.inhparent = 'public.events'::regclass ORDER BY i.inhrelid LIMIT 1\",\n        )\n        .fetch_one(&pool)\n        .await\n        .expect(\"load event partition\");\n        sqlx::query(sqlx::AssertSqlSafe(format!(\n            \"ALTER TABLE {child} DISABLE TRIGGER trg_events_guard_channel_roster_snapshot\"\n        )))\n        .execute(&pool)\n        .await\n        .expect(\"disable partition roster trigger\");\n        let error = db\n            .verify_channel_roster_fence()\n            .await\n            .expect_err(\"disabled partition roster fence must fail closed\");\n        assert!(\n            error.to_string().contains(&child),\n            \"verification must identify the unfenced partition: {error}\"\n        );\n\n        drop_scratch_db(&admin, pool, &scratch_name).await;\n    }\n","sourceCodeStart":3051,"sourceCodeEnd":3087,"githubUrl":"https://github.com/block/buzz/blob/dad5a33865fc81a2e55b3b60746632f615ec1e3a/crates/buzz-db/src/store/channel_members.rs#L3051-L3087","documentation":"Panic from `.expect(\"load event partition\")` on a query_scalar against pg_inherits/pg_class to find a child table of public.events. Err means the query returned zero rows (no partitions found) or the catalog query itself failed, so the test cannot locate a partition whose trigger it wants to disable.","triggerScenarios":"public.events is not declared PARTITION BY (so pg_inherits has no rows), the scratch DB's migrations did not create partitions, or the regclass cast fails because public.events does not exist.","commonSituations":"Schema refactor removed/renamed partitioning on events; scratch DB created without full migrations; search_path/schema mismatch hiding public.events.","solutions":["Confirm migrations created public.events as a partitioned table with children in the scratch DB","Verify the table exists: SELECT 'public.events'::regclass","If partitioning was renamed/removed, update the test's catalog query to the new layout","Check search_path if events lives in a non-public schema"],"exampleFix":"// before\n.fetch_one(&pool).await.expect(\"load event partition\");\n// after\n.fetch_optional(&pool).await\n    .unwrap_or_else(|e| panic!(\"load event partition: {e} — is events partitioned?\"))\n    .expect(\"load event partition\");","handlingStrategy":"type-guard","validationCode":"let is_partitioned: bool = sqlx::query_scalar(\n    \"SELECT relkind = 'p' FROM pg_class WHERE oid = 'public.events'::regclass\"\n).fetch_one(&pool).await?;\nassert!(is_partitioned, \"public.events must be partitioned\");","typeGuard":"fn has_partitions(children: &[String]) -> bool { !children.is_empty() }","tryCatchPattern":"let child: Option<String> = sqlx::query_scalar(\n    \"SELECT n.nspname || '.' || c.relname FROM pg_inherits i \\\n     JOIN pg_class c ON c.oid = i.inhrelid \\\n     JOIN pg_namespace n ON n.oid = c.relnamespace \\\n     WHERE i.inhparent = 'public.events'::regclass ORDER BY i.inhrelid LIMIT 1\"\n).fetch_optional(&pool).await\n .map_err(|e| anyhow!(\"load event partition: {e}\"))?;\nlet child = child.ok_or_else(|| anyhow!(\"public.events has no partitions\"))?;","preventionTips":["Assert events is partitioned before catalog-dependent tests","Keep partition layout changes in sync with tests querying pg_inherits","Run full migrations on scratch DBs, never a partial subset"],"tags":["postgres","partitioning","catalog-query","test-setup","panic"],"backgroundTag":"missing-partitioned-table","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"}